# 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 ```bash dotnet build ``` `dotnet build` compiles the native SWIG wrapper (`libLibNftablesBindings.so`) from checked-in generated C wrapper code. ## Regenerate SWIG bindings ```bash ./eng/regen-bindings.sh ``` ## Native wrapper build only ```bash ./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 ```csharp 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")); } ```