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 ¶
ChainExists checks whether an iptables chain exists.
func ClearChain ¶
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 ¶
DeleteChain idempotently deletes the specified table/chain. It does not return an errors if the chain does not exist
func DeleteConntrackEntriesForDstIP ¶
DeleteConntrackEntriesForDstIP delete the conntrack entries for the connections specified by the given destination IP and protocol
func DeleteConntrackEntriesForDstPort ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 |