2026-03-11 01:40:27 +00:00
2026-03-11 01:40:27 +00:00
2026-03-11 01:40:27 +00:00
2026-03-11 01:40:16 +00:00
2026-03-11 01:40:27 +00:00
2026-03-11 01:40:27 +00:00

libnftables-dotnet

.NET bindings for system-installed libnftables, generated with SWIG.

Requirements

  • Linux
  • libnftables headers and shared library installed
  • gcc
  • .NET SDK 10+
  • swig (only needed to regenerate bindings)

Build

dotnet build

dotnet build compiles the native SWIG wrapper (libLibNftablesBindings.so) from checked-in generated C wrapper code.

Regenerate SWIG bindings

./eng/regen-bindings.sh

Native wrapper build only

./eng/build-native.sh

Notes

  • Native dependency remains system-level libnftables (-lnftables).
  • Managed APIs:
    • NftContext: advanced low-level context wrapper over native calls.
    • INftablesClient / NftablesClient: high-level command-centric API with Validate, Apply, Snapshot, and Restore (sync + async).
  • Fail-fast runtime policy: Linux x64 only for native operations.

Documentation

  • High-level managed API XML docs are provided on all public LibNftables types/members.
  • Low-level generated binding reference: docs/low-level-bindings-reference.md.
  • Generated SWIG files under src/LibNftables.Bindings/Generated/ are auto-generated and not hand-edited.

High-level example

using LibNftables;

INftablesClient client = new NftablesClient();

var validation = client.Validate(NftApplyRequest.FromText("add table inet my_table"));
if (validation.IsValid)
{
    client.Apply(NftApplyRequest.FromText("add table inet my_table"));
}
Description
No description provided
Readme 96 KiB
Languages
C# 86.5%
C 12.7%
Shell 0.7%
SWIG 0.1%