Documentation ¶
Index ¶
- Constants
- func ChainExists(ipt *iptables.IPTables, table, chain string) (bool, error)
- func ClearChain(ipt *iptables.IPTables, table, chain string) error
- func DeleteChain(ipt *iptables.IPTables, table, chain string) error
- func DeleteConntrackEntriesForDstIP(dstIP string, protocol uint8) error
- func DeleteConntrackEntriesForDstPort(port uint16, protocol uint8, family netlink.InetFamily) error
- func DeleteRule(ipt *iptables.IPTables, table, chain string, rulespec ...string) error
- func EnsureChain(ipt *iptables.IPTables, table, chain string) error
- func FormatChainName(name string, id string) string
- func FormatComment(name string, id string) string
- func InsertUnique(ipt *iptables.IPTables, table, chain string, prepend bool, rule []string) error
- func MustFormatChainNameWithPrefix(name string, id string, prefix string) string
- func MustFormatHashWithPrefix(length int, prefix string, toHash string) string
Constants ¶
const ( PROTOCOL_TCP = 6 PROTOCOL_UDP = 17 PROTOCOL_SCTP = 132 )
Assigned Internet Protocol Numbers https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
const MaxHashLen = sha512.Size * 2
Variables ¶
This section is empty.
Functions ¶
func ChainExists ¶ added in v0.8.4
ChainExists checks whether an iptables chain exists.
func ClearChain ¶ added in v0.8.4
ClearChain idempotently clear the iptables rules in the specified table/chain. If the chain does not exist, a new one will be created
func DeleteChain ¶ added in v0.8.4
DeleteChain idempotently deletes the specified table/chain. It does not return an errors if the chain does not exist
func DeleteConntrackEntriesForDstIP ¶ added in v0.9.0
DeleteConntrackEntriesForDstIP delete the conntrack entries for the connections specified by the given destination IP and protocol
func DeleteConntrackEntriesForDstPort ¶ added in v0.9.0
func DeleteConntrackEntriesForDstPort(port uint16, protocol uint8, family netlink.InetFamily) error
DeleteConntrackEntriesForDstPort delete the conntrack entries for the connections specified by the given destination port, protocol and IP family
func DeleteRule ¶ added in v0.8.4
DeleteRule idempotently delete the iptables rule in the specified table/chain. It does not return an error if the referring chain doesn't exist
func EnsureChain ¶ added in v0.8.4
EnsureChain idempotently creates the iptables chain. It does not return an error if the chain already exists.
func FormatChainName ¶
FormatChainName generates a chain name to be used with iptables. Ensures that the generated chain name is exactly maxChainLength chars in length.
func FormatComment ¶
FormatComment returns a comment used for easier rule identification within iptables.
func InsertUnique ¶ added in v1.1.0
InsertUnique will add a rule to a chain if it does not already exist. By default the rule is appended, unless prepend is true.
func MustFormatChainNameWithPrefix ¶ added in v0.8.2
MustFormatChainNameWithPrefix generates a chain name similar to FormatChainName, but adds a custom prefix between chainPrefix and unique identifier. Ensures that the generated chain name is exactly maxChainLength chars in length. Panics if the given prefix is too long.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Buildversion is a destination for the linker trickery so we can auto set the build-version
|
Buildversion is a destination for the linker trickery so we can auto set the build-version |