Documentation ¶
Index ¶
- Constants
- func Lock(lockFilePath string, timeout time.Duration) (func() error, error)
- func MakeChainLine(chain string) string
- type Client
- func (c *Client) ChainExists(table string, chain string) (bool, error)
- func (c *Client) DeleteChain(table string, chain string) error
- func (c *Client) DeleteRule(table string, chain string, ruleSpec []string) error
- func (c *Client) EnsureChain(table string, chain string) error
- func (c *Client) EnsureRule(table string, chain string, ruleSpec []string) error
- func (c *Client) ListRules(table string, chain string) ([]string, error)
- func (c *Client) Restore(data []byte, flush bool, useIPv6 bool) error
- func (c *Client) Save() ([]byte, error)
Constants ¶
View Source
const ( NATTable = "nat" FilterTable = "filter" MangleTable = "mangle" RawTable = "raw" AcceptTarget = "ACCEPT" MasqueradeTarget = "MASQUERADE" MarkTarget = "MARK" ConnTrackTarget = "CT" NoTrackTarget = "NOTRACK" PreRoutingChain = "PREROUTING" ForwardChain = "FORWARD" PostRoutingChain = "POSTROUTING" OutputChain = "OUTPUT" )
View Source
const (
XtablesLockFilePath = "/var/run/xtables.lock"
)
Variables ¶
This section is empty.
Functions ¶
func Lock ¶ added in v0.10.2
Lock acquires the provided file lock. It's thread-safe. It will block until the lock is acquired or the timeout is reached.
func MakeChainLine ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChainExists ¶ added in v0.13.0
ChainExists checks if a chain already exists in a table
func (*Client) DeleteChain ¶ added in v0.13.0
DeleteChain deletes all rules from a chain in a table and then delete the chain
func (*Client) DeleteRule ¶ added in v0.13.0
DeleteRule checks if target rule already exists, deletes the rule if found.
func (*Client) EnsureChain ¶
EnsureChain checks if target chain already exists, creates it if not.
func (*Client) EnsureRule ¶
EnsureRule checks if target rule already exists, appends it if not.
Click to show internal directories.
Click to hide internal directories.