iptables

package
Version: v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = all{0}

Consume no more arg and accept rest as single option (use as default for Trailing)

View Source
var AllArg = all{1}

Consume one more arg and accept rest as single option (use as default for Trailing)

View Source
var Any = any{0}

Consume no more args (use as default for Nested)

View Source
var AnyArg = any{1}

Consume one more args (use as default for Nested)

Functions

func Fields

func Fields(line string) []string

func RegisterArgType

func RegisterArgType(name string, n int, nested ...NestedType)

func RegisterType

func RegisterType(t OptionType)

Types

type Chain

type Chain struct {
	Table string
	Chain string
	Rules Rules
}

func (*Chain) Add

func (this *Chain) Add(r Rule) *Chain

func (*Chain) Index

func (this *Chain) Index(r Rule) int

type ChainRequest

type ChainRequest struct {
	*Chain
	Cleanup bool
}

func NewChainRequest

func NewChainRequest(table, chain string, rules Rules, cleanup bool) *ChainRequest

type IPTables

type IPTables struct {
	*iptables.IPTables
}

func New

func New() (*IPTables, error)

func (*IPTables) AppendRule

func (this *IPTables) AppendRule(table, chain string, rule Rule) error

func (*IPTables) AssureChain

func (this *IPTables) AssureChain(logger utils.NotificationLogger, chain *Chain) error

func (*IPTables) CleanupChain

func (this *IPTables) CleanupChain(table, chain string) error

CleanupChain deletes all rules in the specified table/chain and finally deletes the chain

func (*IPTables) DeleteRule

func (this *IPTables) DeleteRule(table, chain string, rule Rule) error

func (*IPTables) Execute

func (this *IPTables) Execute(logger utils.NotificationLogger, req *ChainRequest) error

func (*IPTables) InsertRule

func (this *IPTables) InsertRule(table, chain string, pos int, rule Rule) error

func (*IPTables) ListChain

func (this *IPTables) ListChain(table, chain string) (*Chain, error)

func (*IPTables) UpdateChain

func (this *IPTables) UpdateChain(logger utils.NotificationLogger, chain *Chain) error

type NestedType

type NestedType interface {
	Consume(list []string) (int, Options, []string)
}

func MultiArgType

func MultiArgType(name string, n int, nested ...OptionType) NestedType

func Nested

func Nested(name string, n int, nested ...NestedType) NestedType

func Trailing

func Trailing(name string, n int, nested ...OptionType) NestedType

type Option

type Option []OptionArg

func ComposeOpt

func ComposeOpt(args ...interface{}) Option

func Opt

func Opt(args ...string) Option

func (*Option) Add

func (this *Option) Add(args ...OptionArg) *Option

func (Option) AsArgs

func (this Option) AsArgs() []string

func (Option) Equals

func (this Option) Equals(s OptionArg) bool

func (Option) Index

func (this Option) Index(val string) int

type OptionArg

type OptionArg interface {
	AsArgs() []string
	Index(s string) int
	Equals(a OptionArg) bool
}

type OptionType

type OptionType interface {
	Consume(list []string) (Options, []string)
}

func ArgType

func ArgType(name string, n int, nested ...NestedType) OptionType

type Options

type Options []Option

func (*Options) Add

func (this *Options) Add(opts ...Option) *Options

func (Options) AsOption

func (this Options) AsOption() Option

func (Options) GetOption

func (this Options) GetOption(name string) Option

func (Options) HasOption

func (this Options) HasOption(name string) bool

func (Options) Index

func (this Options) Index(opt Option) int

func (Options) IndexOption

func (this Options) IndexOption(name string) int

func (*Options) Remove

func (this *Options) Remove(opt Option) *Options

func (*Options) RemoveOption

func (this *Options) RemoveOption(name string) *Options

type Requests

type Requests []*ChainRequest

type Rule

type Rule Options

func ParseRule

func ParseRule(list ...string) Rule

func (*Rule) Add

func (this *Rule) Add(o Option) *Rule

func (Rule) AsList

func (this Rule) AsList() []string

func (Rule) Equals

func (this Rule) Equals(r Rule) bool

func (Rule) HasOption

func (this Rule) HasOption(name string) bool

func (Rule) Index

func (this Rule) Index(o Option) int

func (*Rule) Remove

func (this *Rule) Remove(o Option) *Rule

func (*Rule) RemoveOption

func (this *Rule) RemoveOption(name string) *Rule

type Rules

type Rules []Rule

func (*Rules) Add

func (this *Rules) Add(r Rule) *Rules

func (Rules) Index

func (this Rules) Index(r Rule) int

type StringArg

type StringArg string

func (StringArg) AsArgs

func (this StringArg) AsArgs() []string

func (StringArg) Equals

func (this StringArg) Equals(o OptionArg) bool

func (StringArg) Index

func (this StringArg) Index(s string) int

type StringList

type StringList []string

func (StringList) Index

func (this StringList) Index(val string) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL