Documentation
¶
Index ¶
- type Config
- func (c *Config) AddChain(chain *schema.Chain)
- func (c *Config) AddRule(rule *schema.Rule)
- func (c *Config) AddTable(table *schema.Table)
- func (c *Config) DeleteChain(chain *schema.Chain)
- func (c *Config) DeleteRule(rule *schema.Rule)
- func (c *Config) DeleteTable(table *schema.Table)
- func (c *Config) FlushChain(chain *schema.Chain)
- func (c *Config) FlushRuleset()
- func (c *Config) FlushTable(table *schema.Table)
- func (c *Config) FromJSON(data []byte) error
- func (c *Config) LookupChain(toFind *schema.Chain) *schema.Chain
- func (c *Config) LookupRule(toFind *schema.Rule) []*schema.Rule
- func (c *Config) LookupTable(toFind *schema.Table) *schema.Table
- func (c *Config) ToJSON() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
func (*Config) AddChain ¶
AddChain appends the given chain to the nftable config. The chain is added without an explicit action (`add`). Adding multiple times the same chain has no affect when the config is applied.
func (*Config) AddRule ¶
AddRule appends the given rule to the nftable config. The rule is added without an explicit action (`add`). Adding multiple times the same rule will result in multiple identical rules when applied.
func (*Config) AddTable ¶
AddTable appends the given table to the nftable config. The table is added without an explicit action (`add`). Adding multiple times the same table has no effect when the config is applied.
func (*Config) DeleteChain ¶
DeleteChain appends a given chain to the nftable config with the `delete` action. Attempting to delete a non-existing chain, results with a failure when the config is applied. The chain must not contain any rules or be used as a jump target.
func (*Config) DeleteRule ¶
DeleteRule appends a given rule to the nftable config with the `delete` action. A rule is identified by its handle ID and it must be present in the given rule. Attempting to delete a non-existing rule, results with a failure when the config is applied. A common usage is to use LookupRule() and then to pass the result to DeleteRule.
func (*Config) DeleteTable ¶
DeleteTable appends a given table to the nftable config with the `delete` action. Attempting to delete a non-existing table, results with a failure when the config is applied. All chains and rules under the table are removed as well (when applied).
func (*Config) FlushChain ¶
FlushChain appends a given chain to the nftable config with the `flush` action. All rules under the chain are removed (when applied). Attempting to flush a non-existing chain, results with a failure when the config is applied.
func (*Config) FlushRuleset ¶
func (c *Config) FlushRuleset()
FlushRuleset adds a command to the nftables config that erases all the configuration when applied. It is commonly used as the first config instruction, followed by a declarative configuration. When used, any previous configuration is flushed away before adding the new one. Calling FlushRuleset updates the configuration and will take effect only when applied on the system.
func (*Config) FlushTable ¶
FlushTable appends a given table to the nftable config with the `flush` action. All chains and rules under the table are removed (when applied). Attempting to flush a non-existing table, results with a failure when the config is applied.
func (*Config) FromJSON ¶
FromJSON decodes the provided JSON-encoded data and populates the nftables config.
func (*Config) LookupChain ¶
LookupChain searches the configuration for a matching chain and returns it. The chain is matched first by the table and chain name. Other matching fields are optional (for matching base chains). Mutating the returned chain will result in mutating the configuration.
func (*Config) LookupRule ¶
LookupRule searches the configuration for a matching rule and returns it. The rule is matched first by the table and chain. Other matching fields are optional (nil or an empty string arguments imply no-matching). Mutating the returned chain will result in mutating the configuration.
func (*Config) LookupTable ¶
LookupTable searches the configuration for a matching table and returns it. Mutating the returned table will result in mutating the configuration.