iptables

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 3 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 (
	UDP = "udp"
	TCP = "tcp"
)

known protocols

View Source
const (
	AzureDNS = "168.63.129.16"
)

known IP's

View Source
const (
	DNSPort = 53
)

known ports

Variables

View Source
var (
	DisableIPTableLock bool
)

Functions

func AppendIptableRule added in v0.1.0

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

Append iptable rule at end of iptable chain

func ChainExists added in v0.1.0

func ChainExists(version, tableName, chainName string) bool

check if iptable chain alreay exists

func CreateChain added in v0.1.0

func CreateChain(version, tableName, chainName string) error

create new iptable chain under specified table name

func DeleteIptableRule added in v0.1.0

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

Delete matched iptable rule

func InsertIptableRule added in v0.1.0

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

Insert iptable rule at beginning of iptable chain

func RuleExists added in v0.1.0

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

check if iptable rule alreay exists

func RunCmd added in v0.1.0

func RunCmd(version, params string) error

Run iptables command

Types

type IPTableEntry

type IPTableEntry struct {
	Version string
	Params  string
}

func GetAppendIptableRuleCmd added in v0.1.0

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

func GetCreateChainCmd added in v0.1.0

func GetCreateChainCmd(version, tableName, chainName string) IPTableEntry

func GetInsertIptableRuleCmd added in v0.1.0

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

Jump to

Keyboard shortcuts

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