iptables

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NATTable    = "nat"
	FilterTable = "filter"
	MangleTable = "mangle"
	RawTable    = "raw"

	AcceptTarget     = "ACCEPT"
	MasqueradeTarget = "MASQUERADE"
	MarkTarget       = "MARK"
	ConnTrackTarget  = "CT"

	PreRoutingChain  = "PREROUTING"
	ForwardChain     = "FORWARD"
	PostRoutingChain = "POSTROUTING"
)

Variables

This section is empty.

Functions

func MakeChainLine

func MakeChainLine(chain string) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New() (*Client, error)

func (*Client) EnsureChain

func (c *Client) EnsureChain(table string, chain string) error

ensureChain checks if target chain already exists, creates it if not.

func (*Client) EnsureRule

func (c *Client) EnsureRule(table string, chain string, ruleSpec []string) error

ensureRule checks if target rule already exists, appends it if not.

func (*Client) Restore

func (c *Client) Restore(data []byte, flush bool) error

Restore calls iptable-restore to restore iptables with the provided content. If flush is true, all previous contents of the respective tables will be flushed. Otherwise only involved chains will be flushed.

func (*Client) Save added in v0.7.0

func (c *Client) Save() ([]byte, error)

Save calls iptables-saves to dump chains and tables in iptables.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL