Help us shape the future of Go! Take the 2026 Go Developer Survey

iptables

package
v1.7.20 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CNIInputChain  = "AZURECNIINPUT"
	CNIOutputChain = "AZURECNIOUTPUT"
)

cni iptable chains

View Source
const (
	Input       = "INPUT"
	Output      = "OUTPUT"
	Forward     = "FORWARD"
	Prerouting  = "PREROUTING"
	Postrouting = "POSTROUTING"
	Swift       = "SWIFT"
	Snat        = "SNAT"
	Return      = "RETURN"
)

standard iptable chains

View Source
const (
	Filter = "filter"
	Nat    = "nat"
	Mangle = "mangle"
)

Standard Table names

View Source
const (
	Accept     = "ACCEPT"
	Drop       = "DROP"
	Masquerade = "MASQUERADE"
)

target

View Source
const (
	Insert = "I"
	Append = "A"
	Delete = "D"
)

actions

View Source
const (
	Established = "ESTABLISHED"
	Related     = "RELATED"
)

states

View Source
const (
	V4 = "4"
	V6 = "6"
)
View Source
const (
	DNSPort  = 53
	HTTPPort = 80
)

known ports

View Source
const (
	UDP = "udp"
	TCP = "tcp"
)

known protocols

Variables

View Source
var DisableIPTableLock bool

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) AppendIptableRule

func (c *Client) AppendIptableRule(version, tableName, chainName, match, target string) error

Append iptable rule at end of iptable chain

func (*Client) ChainExists

func (c *Client) ChainExists(version, tableName, chainName string) bool

check if iptable chain alreay exists

func (*Client) CreateChain

func (c *Client) CreateChain(version, tableName, chainName string) error

create new iptable chain under specified table name

func (*Client) DeleteIptableRule

func (c *Client) DeleteIptableRule(version, tableName, chainName, match, target string) error

Delete matched iptable rule

func (*Client) GetAppendIptableRuleCmd

func (c *Client) GetAppendIptableRuleCmd(version, tableName, chainName, match, target string) IPTableEntry

func (*Client) GetCreateChainCmd

func (c *Client) GetCreateChainCmd(version, tableName, chainName string) IPTableEntry

func (*Client) GetInsertIptableRuleCmd

func (c *Client) GetInsertIptableRuleCmd(version, tableName, chainName, match, target string) IPTableEntry

func (*Client) InsertIptableRule

func (c *Client) InsertIptableRule(version, tableName, chainName, match, target string) error

Insert iptable rule at beginning of iptable chain

func (*Client) RuleExists

func (c *Client) RuleExists(version, tableName, chainName, match, target string) bool

check if iptable rule alreay exists

func (*Client) RunCmd

func (c *Client) RunCmd(version, params string) error

Run iptables command

type IPTableEntry

type IPTableEntry struct {
	Version string
	Params  string
}

Jump to

Keyboard shortcuts

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