Documentation
¶
Index ¶
- Variables
- func AddTestDNATRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
- func AddTestRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
- func AddTestSNATRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
- func AreExprsValid(t *testing.T, test *TestsT, rule *nftables.Rule) bool
- func CleanupSystemConn(t *testing.T, newNS netns.NsHandle)
- func OpenSystemConn(t *testing.T) (*nftables.Conn, netns.NsHandle)
- func SkipIfNotPrivileged(t *testing.T)
- type TestsT
Constants ¶
This section is empty.
Variables ¶
var (
// Fw represents the nftables Fw object.
Fw, _ = nftb.Fw()
)
Functions ¶
func AddTestDNATRule ¶
func AddTestDNATRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
AddTestDNATRule adds a generic table, chain and rule with the given expression.
func AddTestRule ¶
func AddTestRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
AddTestRule adds a generic table, chain and rule with the given expression.
func AddTestSNATRule ¶
func AddTestSNATRule(t *testing.T, conn *nftables.Conn, exp *[]expr.Any) (*nftables.Rule, *nftables.Chain)
AddTestSNATRule adds a generic table, chain and rule with the given expression.
func AreExprsValid ¶
AreExprsValid checks if the expressions defined in the given rule are valid according to the expected expressions defined in the tests.
func CleanupSystemConn ¶
CleanupSystemConn closes the given namespace.
func OpenSystemConn ¶
OpenSystemConn opens a new connection with the kernel in a new namespace. https://github.com/google/nftables/blob/8f2d395e1089dea4966c483fbeae7e336917c095/internal/nftest/system_conn.go#L15
func SkipIfNotPrivileged ¶
SkipIfNotPrivileged will skip the test from where it's invoked, to skip the test if we don't have root privileges. This may occur when executing the tests on restricted environments, such as containers, chroots, etc.