Documentation ¶
Overview ¶
Package rule A library for managing nftables rules
Index ¶
- type RuleData
- type RuleTarget
- func (r *RuleTarget) Add(c *nftables.Conn, ruleData RuleData) (bool, error)
- func (r *RuleTarget) Delete(c *nftables.Conn, ruleData RuleData) (bool, error)
- func (r *RuleTarget) Exists(c *nftables.Conn, ruleData RuleData) (bool, error)
- func (r *RuleTarget) FindRuleByID(c *nftables.Conn, ruleData RuleData) (*nftables.Rule, error)
- func (r *RuleTarget) GetTableAndChain() (*nftables.Table, *nftables.Chain)
- func (r *RuleTarget) Insert(c *nftables.Conn, ruleData RuleData) (bool, error)
- func (r *RuleTarget) List(c *nftables.Conn) ([]*nftables.Rule, error)
- func (r *RuleTarget) Update(c *nftables.Conn, ruleData RuleData) (bool, error)
- func (r *RuleTarget) UpdateAll(c *nftables.Conn, rules []RuleData) (bool, int, int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RuleData ¶
type RuleData struct { Exprs []expr.Any // we use rule user data to store the ID // we do this so we can give each rule a specific id across hosts and etc // handles are less deterministic without setting them explicitly and lack context (only ints) ID []byte Handle uint64 Position uint64 }
RuleData is a struct that is used to create rules in a given table and chain
type RuleTarget ¶
type RuleTarget struct {
// contains filtered or unexported fields
}
RuleTarget represents a location to manipulate nftables rules
func New ¶
func New(table *nftables.Table, chain *nftables.Chain) RuleTarget
Create a new location to manipulate nftables rules
func (*RuleTarget) Add ¶
Add a rule with a given ID to a specific table and chain, returns true if the rule was added
func (*RuleTarget) Delete ¶
Delete a rule with a given ID from a specific table and chain, returns true if the rule was deleted
func (*RuleTarget) Exists ¶
Determine if a rule with a given ID exists in a specific table and chain
func (*RuleTarget) FindRuleByID ¶
func (*RuleTarget) GetTableAndChain ¶
func (r *RuleTarget) GetTableAndChain() (*nftables.Table, *nftables.Chain)
Get the nftables table and chain associated with this RuleTarget
Click to show internal directories.
Click to hide internal directories.