import "github.com/docker/docker/vendor/github.com/docker/libnetwork/iptables"
conntrack.go firewalld.go iptables.go
const ( // Append appends the rule at the end of the chain. Append Action = "-A" // Delete deletes the rule from the chain. Delete Action = "-D" // Insert inserts the rule at the top of the chain. Insert Action = "-I" // Nat table is used for nat translation rules. Nat Table = "nat" // Filter table is used for filter rules. Filter Table = "filter" // Mangle table is used for mangling the packet. Mangle Table = "mangle" // Drop is the default iptables DROP policy Drop Policy = "DROP" // Accept is the default iptables ACCEPT policy Accept Policy = "ACCEPT" // IPv4 is version 4 IPv4 IPVersion = "IPV4" // IPv6 is version 6 IPv6 IPVersion = "IPV6" )
var ( // ErrConntrackNotConfigurable means that conntrack module is not loaded or does not have the netlink module loaded ErrConntrackNotConfigurable = errors.New("conntrack is not available") )
var ( // ErrIptablesNotFound is returned when the rule is not found. ErrIptablesNotFound = errors.New("Iptables not found") )
AddInterfaceFirewalld adds the interface to the trusted zone
DelInterfaceFirewalld removes the interface from the trusted zone
func DeleteConntrackEntries(nlh *netlink.Handle, ipv4List []net.IP, ipv6List []net.IP) (uint, uint, error)
DeleteConntrackEntries deletes all the conntrack connections on the host for the specified IP Returns the number of flows deleted for IPv4, IPv6 else error
FirewalldInit initializes firewalld management code.
GetVersion reads the iptables version numbers during initialization
IsConntrackProgrammable returns true if the handle supports the NETLINK_NETFILTER and the base modules are loaded
func OnReloaded(callback func())
OnReloaded add callback
Passthrough method simply passes args through to iptables/ip6tables
Action signifies the iptable action.
ChainError is returned to represent errors during ip table operation.
func (e ChainError) Error() string
ChainInfo defines the iptables chain.
func (c *ChainInfo) Forward(action Action, ip net.IP, port int, proto, destAddr string, destPort int, bridgeName string) error
Forward adds forwarding rule to 'filter' table and corresponding nat rule to 'nat' table.
func (c *ChainInfo) Link(action Action, ip1, ip2 net.IP, port int, proto string, bridgeName string) error
Link adds reciprocal ACCEPT rule for two supplied IP addresses. Traffic is allowed from ip1 to ip2 and vice-versa
Output adds linking rule to an OUTPUT chain.
Prerouting adds linking rule to nat/PREROUTING chain.
Remove removes the chain.
type Conn struct {
// contains filtered or unexported fields
}
Conn is a connection to firewalld dbus endpoint.
IPTable defines struct with IPVersion
GetIptable returns an instance of IPTable with specified version
AddReturnRule adds a return rule for the chain in the filter table
EnsureJumpRule ensures the jump rule is on top
ExistChain checks if a chain exists
Exists checks if a rule exists
ExistsNative behaves as Exists with the difference it will always invoke `iptables` binary.
LoopbackByVersion returns loopback address by version
NewChain adds a new chain to ip table.
func (iptable IPTable) ProgramChain(c *ChainInfo, bridgeName string, hairpinMode, enable bool) error
ProgramChain is used to add rules to a chain
ProgramRule adds the rule specified by args only if the rule is not already present in the chain. Reciprocally, it removes the rule only if present.
Raw calls 'iptables' system command, passing supplied arguments.
RawCombinedOutput internally calls the Raw function and returns a non nil error if Raw returned a non nil error or a non empty output
RawCombinedOutputNative behave as RawCombinedOutput with the difference it will always invoke `iptables` binary
RemoveExistingChain removes existing chain from the table.
SetDefaultPolicy sets the passed default policy for the table/chain
IPV defines the table string
const ( // Iptables point ipv4 table Iptables IPV = "ipv4" // IP6Tables point to ipv6 table IP6Tables IPV = "ipv6" // Ebtables point to bridge table Ebtables IPV = "eb" )
IPVersion refers to IP version, v4 or v6
Policy is the default iptable policies
Table refers to Nat, Filter or Mangle.
type ZoneSettings struct {
// contains filtered or unexported fields
}
ZoneSettings holds the firewalld zone settings, documented in https://firewalld.org/documentation/man-pages/firewalld.dbus.html
Package iptables imports 13 packages (graph). Updated 2020-12-24. Refresh now. Tools for package owners.