mocks

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MockInterfacesEth = []nt.Interface{
	&mockInterface{
		Name: "eth0",
		Addresses: []net.IPNet{
			{
				IP:   net.ParseIP("192.168.1.1"),
				Mask: net.IPv4Mask(255, 255, 255, 0),
			},
		},
		Index: 1,
	},
	&mockInterface{
		Name: "eth2",
		Addresses: []net.IPNet{
			{
				IP:   net.ParseIP("10.10.10.10"),
				Mask: net.IPv4Mask(255, 255, 255, 0),
			},
			{
				IP:   net.ParseIP("10.10.10.11"),
				Mask: net.IPv4Mask(255, 255, 255, 0),
			},
		},
		Index: 2,
	},
}
View Source
var MockInterfacesOther = []nt.Interface{
	&mockInterface{
		Name: "lo",
		Addresses: []net.IPNet{
			{
				IP:   net.ParseIP("127.0.0.1"),
				Mask: net.IPv4Mask(255, 255, 255, 255),
			},
		},
		Index: 3,
	},
	&mockInterface{
		Name: "wifi1",
		Addresses: []net.IPNet{
			{
				IP:   net.ParseIP("10.50.10.10"),
				Mask: net.IPv4Mask(255, 255, 255, 0),
			},
		},
		Index: 4,
	},
}

Functions

func NewMockInterfaceProvider

func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,
	chan time.Time, error)

NewMockInterfaceProvider creates a new InterfaceProvider that delivers information about local interfaces from the in-code constant

Types

type ConntrackHelper

type ConntrackHelper struct {
	mock.Mock
}

ConntrackHelper is an autogenerated mock type for the ConntrackHelper type

func (*ConntrackHelper) RemoveEntriesDNATingToIP

func (_m *ConntrackHelper) RemoveEntriesDNATingToIP(ip net.IP) (time.Duration, error)

RemoveEntriesDNATingToIP provides a mock function with given fields: ip

type IPRouteHelper

type IPRouteHelper struct {
	mock.Mock
}

IPRouteHelper is an autogenerated mock type for the IPRouteHelper type

func (*IPRouteHelper) EnsureOnlyOneIPRuleExistsForFwMark

func (_m *IPRouteHelper) EnsureOnlyOneIPRuleExistsForFwMark(rule nettools.IPRule) ([]nettools.IPRule, time.Duration, error)

EnsureOnlyOneIPRuleExistsForFwMark provides a mock function with given fields: rule

func (*IPRouteHelper) EnsureOnlyOneIPRuleExistsForSourceIP

func (_m *IPRouteHelper) EnsureOnlyOneIPRuleExistsForSourceIP(rule nettools.IPRule) ([]nettools.IPRule, time.Duration, error)

EnsureOnlyOneIPRuleExistsForSourceIP provides a mock function with given fields: rule

func (*IPRouteHelper) EnsureRoutes

func (_m *IPRouteHelper) EnsureRoutes(entries []nettools.IPRouteEntry) (time.Duration, error)

EnsureRoutes provides a mock function with given fields: entries

func (*IPRouteHelper) InitializeRoutingTablesPerInterface

func (_m *IPRouteHelper) InitializeRoutingTablesPerInterface(ifaces []nettools.Interface) (time.Duration, error)

InitializeRoutingTablesPerInterface provides a mock function with given fields: ifaces

func (*IPRouteHelper) RemoveAllIPRulesForAddress

func (_m *IPRouteHelper) RemoveAllIPRulesForAddress(ip net.IP) ([]nettools.IPRule, time.Duration, error)

RemoveAllIPRulesForAddress provides a mock function with given fields: ip

func (*IPRouteHelper) RemoveAllIPRulesForAddressesInSubnet

func (_m *IPRouteHelper) RemoveAllIPRulesForAddressesInSubnet(sourceSubnet net.IPNet) ([]nettools.IPRule, time.Duration, error)

RemoveAllIPRulesForAddressesInSubnet provides a mock function with given fields: sourceSubnet

func (*IPRouteHelper) RemoveIPRuleForSourceIP

func (_m *IPRouteHelper) RemoveIPRuleForSourceIP(rule nettools.IPRule) (time.Duration, error)

RemoveIPRuleForSourceIP provides a mock function with given fields: rule

type IPSetHelper

type IPSetHelper struct {
	mock.Mock
}

IPSetHelper is an autogenerated mock type for the IPSetHelper type

func (*IPSetHelper) DeleteSet

func (_m *IPSetHelper) DeleteSet(name string) error

DeleteSet provides a mock function with given fields: name

func (*IPSetHelper) EnsureSetExists

func (_m *IPSetHelper) EnsureSetExists(name string, setType string) error

EnsureSetExists provides a mock function with given fields: name, setType

func (*IPSetHelper) EnsureSetHasOnly

func (_m *IPSetHelper) EnsureSetHasOnly(name string, ips []net.IP) error

EnsureSetHasOnly provides a mock function with given fields: name, ips

func (*IPSetHelper) EnsureSetHasOnlyNetPort added in v0.2.1

func (_m *IPSetHelper) EnsureSetHasOnlyNetPort(name string, netports []nettools.NetPort) error

EnsureSetHasOnlyNetPort provides a mock function with given fields: name, netports

func (*IPSetHelper) GetIPs

func (_m *IPSetHelper) GetIPs(name string) ([]net.IP, error)

GetIPs provides a mock function with given fields: name

func (*IPSetHelper) GetNetPorts added in v0.2.1

func (_m *IPSetHelper) GetNetPorts(name string) ([]nettools.NetPort, error)

GetNetPorts provides a mock function with given fields: name

type IPTablesHelper

type IPTablesHelper struct {
	mock.Mock
}

IPTablesHelper is an autogenerated mock type for the IPTablesHelper type

func (*IPTablesHelper) Delete

func (_m *IPTablesHelper) Delete(args nettools.IPTablesRuleArgs) error

Delete provides a mock function with given fields: args

func (*IPTablesHelper) DeleteByComment

func (_m *IPTablesHelper) DeleteByComment(table string, chain string, comment string) error

DeleteByComment provides a mock function with given fields: table, chain, comment

func (*IPTablesHelper) DeleteChain

func (_m *IPTablesHelper) DeleteChain(tableName string, chainName string) error

DeleteChain provides a mock function with given fields: tableName, chainName

func (*IPTablesHelper) EnsureChainExists

func (_m *IPTablesHelper) EnsureChainExists(table string, customChainName string) error

EnsureChainExists provides a mock function with given fields: table, customChainName

func (*IPTablesHelper) EnsureExistsAppend

func (_m *IPTablesHelper) EnsureExistsAppend(args nettools.IPTablesRuleArgs) error

EnsureExistsAppend provides a mock function with given fields: args

func (*IPTablesHelper) EnsureExistsInsert

func (_m *IPTablesHelper) EnsureExistsInsert(args nettools.IPTablesRuleArgs) error

EnsureExistsInsert provides a mock function with given fields: args

func (*IPTablesHelper) EnsureExistsOnlyAppend

func (_m *IPTablesHelper) EnsureExistsOnlyAppend(args nettools.IPTablesRuleArgs) error

EnsureExistsOnlyAppend provides a mock function with given fields: args

func (*IPTablesHelper) EnsureJumpToChainExists

func (_m *IPTablesHelper) EnsureJumpToChainExists(table string, customChainName string, baseChainName string) error

EnsureJumpToChainExists provides a mock function with given fields: table, customChainName, baseChainName

func (*IPTablesHelper) FlushChain

func (_m *IPTablesHelper) FlushChain(tableName string, chainName string) error

FlushChain provides a mock function with given fields: tableName, chainName

func (*IPTablesHelper) LoadRules

func (_m *IPTablesHelper) LoadRules(tableName string, chainName string) ([]*nettools.IPTablesRuleArgs, error)

LoadRules provides a mock function with given fields: tableName, chainName

type MockInterfaceLister

type MockInterfaceLister struct {
}

func (*MockInterfaceLister) GetInterfaces

func (m *MockInterfaceLister) GetInterfaces() ([]nt.Interface, error)

type MockSimpleFileOperator

type MockSimpleFileOperator struct {
	mock.Mock
}

func (*MockSimpleFileOperator) AppendToFile

func (m *MockSimpleFileOperator) AppendToFile(fileName, textToAppend string) error

func (*MockSimpleFileOperator) ReadFile

func (m *MockSimpleFileOperator) ReadFile(fileName string) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL