iptables

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 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

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

Append iptable rule at end of iptable chain

func ChainExists

func ChainExists(version, tableName, chainName string) bool

check if iptable chain alreay exists

func CreateChain

func CreateChain(version, tableName, chainName string) error

create new iptable chain under specified table name

func DeleteIptableRule

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

Delete matched iptable rule

func InsertIptableRule

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

Insert iptable rule at beginning of iptable chain

func RuleExists

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

check if iptable rule alreay exists

func RunCmd

func RunCmd(version, params string) error

Run iptables command

Types

type IPTableEntry

type IPTableEntry struct {
	Version string
	Params  string
}

func GetAppendIptableRuleCmd

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

func GetCreateChainCmd

func GetCreateChainCmd(version, tableName, chainName string) IPTableEntry

func GetInsertIptableRuleCmd

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