Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var XTablesCmds = sets.New( constants.IPTABLES, constants.IP6TABLES, constants.IPTABLESRESTORE, constants.IP6TABLESRESTORE, constants.IPTABLESSAVE, constants.IP6TABLESSAVE, )
XTablesCmds is the set of all the xtables-related commands currently supported.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies interface { // RunOrFail runs a command and panics, if it fails RunOrFail(cmd string, args ...string) // Run runs a command Run(cmd string, args ...string) error // RunQuietlyAndIgnore runs a command quietly and ignores errors RunQuietlyAndIgnore(cmd string, args ...string) }
Dependencies is used as abstraction for the commands used from the operating system
type RealDependencies ¶
RealDependencies implementation of interface Dependencies, which is used in production
func (*RealDependencies) Run ¶
func (r *RealDependencies) Run(cmd string, args ...string) (err error)
Run runs a command
func (*RealDependencies) RunOrFail ¶
func (r *RealDependencies) RunOrFail(cmd string, args ...string)
RunOrFail runs a command and exits with an error message, if it fails
func (*RealDependencies) RunQuietlyAndIgnore ¶
func (r *RealDependencies) RunQuietlyAndIgnore(cmd string, args ...string)
RunQuietlyAndIgnore runs a command quietly and ignores errors
type StdoutStubDependencies ¶
type StdoutStubDependencies struct{}
StdoutStubDependencies implementation of interface Dependencies, which is used for testing
func (*StdoutStubDependencies) Run ¶
func (s *StdoutStubDependencies) Run(cmd string, args ...string) error
Run runs a command
func (*StdoutStubDependencies) RunOrFail ¶
func (s *StdoutStubDependencies) RunOrFail(cmd string, args ...string)
RunOrFail runs a command and panics, if it fails
func (*StdoutStubDependencies) RunQuietlyAndIgnore ¶
func (s *StdoutStubDependencies) RunQuietlyAndIgnore(cmd string, args ...string)
RunQuietlyAndIgnore runs a command quietly and ignores errors
type XTablesExittype ¶
type XTablesExittype int
XTablesExittype is the exit type of xtables commands.
const ( // XTablesOtherProblem indicates a problem of other type in xtables XTablesOtherProblem XTablesExittype = iota + 1 // XTablesParameterProblem indicates a parameter problem in xtables XTablesParameterProblem // XTablesVersionProblem indicates a version problem in xtables XTablesVersionProblem // XTablesResourceProblem indicates a resource problem in xtables XTablesResourceProblem )
Learn from `xtables_exittype` of iptables. `XTF_ONLY_ONCE`, `XTF_NO_INVERT`, `XTF_BAD_VALUE`, `XTF_ONE_ACTION` will eventually turned out to be a parameter problem with explicit error message. Thus, we do not need to support them here.