Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ipset ¶
type Ipset interface {
Add(entry string, timeout int) error
AddOption(entry string, option string, timeout int) error
Del(entry string) error
Destroy() error
Flush() error
Test(entry string) (bool, error)
}
Ipset is an abstraction of all the methods an implementation of userspace ipsets need to provide.
type IpsetProvider ¶
type IpsetProvider interface {
NewIpset(name string, hasht string, p *ipset.Params) (Ipset, error)
DestroyAll() error
}
IpsetProvider returns a fabric for Ipset.
func NewGoIPsetProvider ¶
func NewGoIPsetProvider() IpsetProvider
NewGoIPsetProvider Return a Go IPSet Provider
type IptablesProvider ¶
type IptablesProvider interface {
Append(table, chain string, rulespec ...string) error
Insert(table, chain string, pos int, rulespec ...string) error
Delete(table, chain string, rulespec ...string) error
ListChains(table string) ([]string, error)
ClearChain(table, chain string) error
DeleteChain(table, chain string) error
NewChain(table, chain string) error
}
IptablesProvider is an abstraction of all the methods an implementation of userspace iptables need to provide.
func NewGoIPTablesProvider ¶
func NewGoIPTablesProvider() (IptablesProvider, error)
NewGoIPTablesProvider returns an IptablesProvider interface based on the go-iptables external package.
type TestIpset ¶
type TestIpset interface {
Ipset
MockAdd(t *testing.T, impl func(entry string, timeout int) error)
MockAddOption(t *testing.T, impl func(entry string, option string, timeout int) error)
MockDel(t *testing.T, impl func(entry string) error)
MockDestroy(t *testing.T, impl func() error)
MockFlush(t *testing.T, impl func() error)
MockTest(t *testing.T, impl func(entry string) (bool, error))
}
TestIpset is a test implementation for Ipset
type TestIpsetProvider ¶
type TestIpsetProvider interface {
IpsetProvider
MockNewIpset(t *testing.T, impl func(name string, hasht string, p *ipset.Params) (Ipset, error))
MockDestroyAll(t *testing.T, impl func() error)
}
TestIpsetProvider is a test implementation for IpsetProvider
func NewTestIpsetProvider ¶
func NewTestIpsetProvider() TestIpsetProvider
NewTestIpsetProvider returns a new TestManipulator.
type TestIptablesProvider ¶
type TestIptablesProvider interface {
IptablesProvider
MockAppend(t *testing.T, impl func(table, chain string, rulespec ...string) error)
MockInsert(t *testing.T, impl func(table, chain string, pos int, rulespec ...string) error)
MockDelete(t *testing.T, impl func(table, chain string, rulespec ...string) error)
MockListChains(t *testing.T, impl func(table string) ([]string, error))
MockClearChain(t *testing.T, impl func(table, chain string) error)
MockDeleteChain(t *testing.T, impl func(table, chain string) error)
MockNewChain(t *testing.T, impl func(table, chain string) error)
}
TestIptablesProvider is a test implementation for IptablesProvider
func NewTestIptablesProvider ¶
func NewTestIptablesProvider() TestIptablesProvider
NewTestIptablesProvider returns a new TestManipulator.