775bb7813d9e6602583f68044f7ccce83a245edd
libnftables-dotnet
.NET bindings for system-installed libnftables, generated with SWIG.
Requirements
- Linux
libnftablesheaders and shared library installedgcc- .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 withValidate,Apply,Snapshot, andRestore(sync + async).
- Fail-fast runtime policy: Linux x64 only for native operations.
Documentation
- High-level managed API XML docs are provided on all public
LibNftablestypes/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
Languages
C#
86.5%
C
12.7%
Shell
0.7%
SWIG
0.1%