Documentation ¶
Index ¶
- Constants
- func IsNotFoundError(err error) bool
- func ListenForHealth(primaryInterface string, port int, logger logrus.FieldLogger)
- type Chain
- type FlushFlag
- type Protocol
- type RestoreCountersFlag
- type RulePosition
- type Runner
- func (runner *Runner) AddReloadFunc(reloadFunc func())
- func (runner *Runner) CheckRule(table Table, chain Chain, args ...string) (bool, error)
- func (runner *Runner) ConnectToFirewallD()
- func (runner *Runner) DeleteChain(table Table, chain Chain) error
- func (runner *Runner) DeleteRule(table Table, chain Chain, args ...string) error
- func (runner *Runner) Destroy()
- func (runner *Runner) EnsureChain(table Table, chain Chain) (bool, error)
- func (runner *Runner) EnsureRule(position RulePosition, table Table, chain Chain, args ...string) (bool, error)
- func (runner *Runner) FlushChain(table Table, chain Chain) error
- func (runner *Runner) GetVersion() (string, error)
- func (runner *Runner) IsIpv6() bool
- func (runner *Runner) Restore(table Table, data []byte, flush FlushFlag, counters RestoreCountersFlag) error
- func (runner *Runner) RestoreAll(data []byte, flush FlushFlag, counters RestoreCountersFlag) error
- func (runner *Runner) Save(table Table) ([]byte, error)
- func (runner *Runner) SaveAll() ([]byte, error)
- type Table
Constants ¶
const MinCheckVersion = "1.4.11"
Versions of iptables less than this do not support the -C / --check flag (test whether a rule exists).
const MinWait2Version = "1.4.22"
const MinWaitVersion = "1.4.20"
Minimum iptables versions supporting the -w and -w2 flags
Variables ¶
This section is empty.
Functions ¶
func IsNotFoundError ¶
IsNotFoundError returns true if the error indicates "not found". It parses the error string looking for known values, which is imperfect but works in practice.
func ListenForHealth ¶
func ListenForHealth(primaryInterface string, port int, logger logrus.FieldLogger)
listens on a port and returns a set of information about the health of the system
Types ¶
type RestoreCountersFlag ¶
type RestoreCountersFlag bool
Option flag for Restore
const NoRestoreCounters RestoreCountersFlag = false
const RestoreCounters RestoreCountersFlag = true
type RulePosition ¶
type RulePosition string
const ( Prepend RulePosition = "-I" Append RulePosition = "-A" )
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner implements Interface in terms of exec("iptables").
func NewDefault ¶
func NewDefault() *Runner
NewDefault returns an interface which will exec iptables, instantiating exec and dbus interfaces that are unique to this instance
func (*Runner) AddReloadFunc ¶
func (runner *Runner) AddReloadFunc(reloadFunc func())
AddReloadFunc is part of Interface
func (*Runner) ConnectToFirewallD ¶
func (runner *Runner) ConnectToFirewallD()
Connects to D-Bus and listens for FirewallD start/restart. (On non-FirewallD-using systems, this is effectively a no-op; we listen for the signals, but they will never be emitted, so reload() will never be called.)
func (*Runner) DeleteRule ¶
func (*Runner) EnsureChain ¶
func (*Runner) EnsureRule ¶
func (*Runner) GetVersion ¶
GetVersion returns the version string.
func (*Runner) RestoreAll ¶
func (runner *Runner) RestoreAll(data []byte, flush FlushFlag, counters RestoreCountersFlag) error