EdDev / go-nft

Go bindings for nft utility.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-nft

Licensed under Apache License version 2.0 Build Workflow Go Report Card

Go bindings for nft utility.

go-nft wraps invocation of the nft utility with functions to append and delete rules; create, clear and delete tables and chains.

To start using go-nft

go-nft is a library that provides a structured API to nftables.

go-nft uses the libnftables-json specification and exposes a subset of its structures.

  • Apply the configuration:
config := nft.NewConfig()
config.AddTable(nft.NewTable("mytable", nft.FamilyIP))
err := nft.ApplyConfig(config)
  • Read the configuration:
config, err := nft.ReadConfig()
nftVersion := config.Nftables[0].Metainfo.Version

For full setup example, see the integration test examples.

Contribution

We welcome contribution of any kind! Read CONTRIBUTING to learn how to contribute to the project.

Changelog

Please refer to CHANGELOG

About

Go bindings for nft utility.

License:Apache License 2.0


Languages

Language:Go 96.4%Language:Shell 3.6%