type Interface … type nftContext … type realNFTables … // newInternal creates a new nftables.Interface for interacting with the given table; this // is split out from New() so it can be used from unit tests with a fakeExec. func newInternal(family Family, table string, execer execer) (Interface, error) { … } // New creates a new nftables.Interface for interacting with the given table. If nftables // is not available/usable on the current host, it will return an error. func New(family Family, table string) (Interface, error) { … } // NewTransaction is part of Interface func (nft *realNFTables) NewTransaction() *Transaction { … } // Run is part of Interface func (nft *realNFTables) Run(ctx context.Context, tx *Transaction) error { … } // Check is part of Interface func (nft *realNFTables) Check(ctx context.Context, tx *Transaction) error { … } // jsonVal looks up key in json; if it exists and is of type T, it returns (json[key], true). // Otherwise it returns (_, false). func jsonVal[T any](json map[string]interface{ … } // getJSONObjects takes the output of "nft -j list", validates it, and returns an array // of just the objects of objectType. func getJSONObjects(listOutput, objectType string) ([]map[string]interface{ … } // List is part of Interface. func (nft *realNFTables) List(ctx context.Context, objectType string) ([]string, error) { … } // ListRules is part of Interface func (nft *realNFTables) ListRules(ctx context.Context, chain string) ([]*Rule, error) { … } // ListElements is part of Interface func (nft *realNFTables) ListElements(ctx context.Context, objectType, name string) ([]*Element, error) { … } // parseElementValue parses a JSON element key/value, handling concatenations, prefixes, and // converting numeric or "verdict" values to strings. func parseElementValue(json interface{ … }