Documentation ¶
Index ¶
- Variables
- func KeyForRoute(route *netlink.Route) string
- type FailFlags
- type MockLink
- type MockNetlinkDataplane
- func (d *MockNetlinkDataplane) AddIface(idx int, name string, up bool, running bool) *MockLink
- func (d *MockNetlinkDataplane) AddMockRoute(route *netlink.Route)
- func (d *MockNetlinkDataplane) AddNeighs(family int, neighs ...netlink.Neigh)
- func (d *MockNetlinkDataplane) AddrAdd(link netlink.Link, addr *netlink.Addr) error
- func (d *MockNetlinkDataplane) AddrDel(link netlink.Link, addr *netlink.Addr) error
- func (d *MockNetlinkDataplane) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
- func (d *MockNetlinkDataplane) DelIface(name string)
- func (d *MockNetlinkDataplane) Delete()
- func (d *MockNetlinkDataplane) ExpectNeighs(family int, neighs ...netlink.Neigh)
- func (d *MockNetlinkDataplane) FeatureGate(name string) string
- func (d *MockNetlinkDataplane) GetDeletedConntrackEntries() []net.IP
- func (d *MockNetlinkDataplane) GetFeatures() *environment.Features
- func (d *MockNetlinkDataplane) IfIndex(name string) int
- func (d *MockNetlinkDataplane) LinkAdd(link netlink.Link) error
- func (d *MockNetlinkDataplane) LinkByName(name string) (netlink.Link, error)
- func (d *MockNetlinkDataplane) LinkDel(link netlink.Link) error
- func (d *MockNetlinkDataplane) LinkList() ([]netlink.Link, error)
- func (d *MockNetlinkDataplane) LinkSetMTU(link netlink.Link, mtu int) error
- func (d *MockNetlinkDataplane) LinkSetUp(link netlink.Link) error
- func (d *MockNetlinkDataplane) NeighAdd(neigh *netlink.Neigh) error
- func (d *MockNetlinkDataplane) NeighDel(neigh *netlink.Neigh) error
- func (d *MockNetlinkDataplane) NeighList(linkIndex, family int) ([]netlink.Neigh, error)
- func (d *MockNetlinkDataplane) NeighSet(neigh *netlink.Neigh) error
- func (d *MockNetlinkDataplane) NewMockNetlink() (netlinkshim.Interface, error)
- func (d *MockNetlinkDataplane) NewMockWireguard() (netlinkshim.Wireguard, error)
- func (d *MockNetlinkDataplane) RefreshFeatures()
- func (d *MockNetlinkDataplane) RemoveConntrackFlows(ipVersion uint8, ipAddr net.IP)
- func (d *MockNetlinkDataplane) RemoveMockRoute(route *netlink.Route)
- func (d *MockNetlinkDataplane) ResetDeltas()
- func (d *MockNetlinkDataplane) RouteAdd(route *netlink.Route) error
- func (d *MockNetlinkDataplane) RouteDel(route *netlink.Route) error
- func (d *MockNetlinkDataplane) RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error)
- func (d *MockNetlinkDataplane) RouteListFilteredIter(family int, filter *netlink.Route, filterMask uint64, ...) error
- func (d *MockNetlinkDataplane) RouteReplace(route *netlink.Route) error
- func (d *MockNetlinkDataplane) RuleAdd(rule *netlink.Rule) error
- func (d *MockNetlinkDataplane) RuleDel(rule *netlink.Rule) error
- func (d *MockNetlinkDataplane) RuleList(family int) ([]netlink.Rule, error)
- func (d *MockNetlinkDataplane) SetIface(name string, up bool, running bool)
- func (d *MockNetlinkDataplane) SetSocketTimeout(to time.Duration) error
- func (d *MockNetlinkDataplane) SetStrictCheck(b bool) error
- type MockWireguard
- type NeighKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SimulatedError = errors.New("dummy error") NotFoundError = errors.New("not found") LinkNotFoundError = netlink.LinkNotFoundError{} FileDoesNotExistError = errors.New("file does not exist") AlreadyExistsError = errors.New("already exists") NotSupportedError = errors.New("operation not supported") )
View Source
var RoutetableFailureScenarios = []FailFlags{ FailNone, FailNextLinkList, FailNextLinkByName, FailNextLinkByNameNotFound, FailNextRouteList, FailNextRouteAdd, FailNextRouteDel, FailNextNeighSet, FailNextNewNetlink, FailNextSetSocketTimeout, FailNextSetStrict, }
Functions ¶
func KeyForRoute ¶
Types ¶
type FailFlags ¶
type FailFlags uint64
const ( FailNextLinkList FailFlags = 1 << iota FailNextLinkByName FailNextLinkByNameNotFound FailNextRouteList FailNextRouteListEINTR FailNextRouteAddOrReplace FailNextRouteAdd FailNextRouteReplace FailNextRouteDel FailNextNeighSet FailNextNeighDel FailNextNeighList FailNextNewNetlink FailNextSetSocketTimeout FailNextLinkAdd FailNextLinkAddNotSupported FailNextLinkDel FailNextLinkSetMTU FailNextLinkSetUp FailNextAddrList FailNextAddrAdd FailNextAddrDel FailNextRuleList FailNextRuleAdd FailNextRuleDel FailNextNewWireguard FailNextNewWireguardNotSupported FailNextWireguardClose FailNextWireguardDeviceByName FailNextWireguardConfigureDevice FailNextSetStrict FailNone FailFlags = 0 )
type MockLink ¶
type MockNetlinkDataplane ¶
type MockNetlinkDataplane struct { NameToLink map[string]*MockLink AddedLinks set.Set[string] DeletedLinks set.Set[string] AddedAddrs set.Set[string] DeletedAddrs set.Set[string] Rules []netlink.Rule AddedRules []netlink.Rule DeletedRules []netlink.Rule ExistingTables set.Set[int] RouteKeyToRoute map[string]netlink.Route AddedRouteKeys set.Set[string] DeletedRouteKeys set.Set[string] UpdatedRouteKeys set.Set[string] NeighsByFamily map[int]map[NeighKey]*netlink.Neigh StrictEnabled bool NumNewNetlinkCalls int NetlinkOpen bool NumNewWireguardCalls int WireguardOpen bool NumLinkAddCalls int NumLinkDeleteCalls int ImmediateLinkUp bool NumRuleListCalls int NumRuleAddCalls int NumRuleDelCalls int WireguardConfigUpdated bool HitRouteListFilteredNoDev bool HitRouteListFilteredNoTable bool LastWireguardUpdates map[wgtypes.Key]wgtypes.PeerConfig PersistentlyFailToConnect bool PersistFailures bool FailuresToSimulate FailFlags SetStrictCheckErr error DeleteInterfaceAfterLinkByName bool ConntrackSleep time.Duration // contains filtered or unexported fields }
func New ¶
func New() *MockNetlinkDataplane
func (*MockNetlinkDataplane) AddMockRoute ¶
func (d *MockNetlinkDataplane) AddMockRoute(route *netlink.Route)
func (*MockNetlinkDataplane) AddNeighs ¶
func (d *MockNetlinkDataplane) AddNeighs(family int, neighs ...netlink.Neigh)
AddNeighs allows test code to add neighbours to the mock dataplane without going through the netlink API.
func (*MockNetlinkDataplane) DelIface ¶
func (d *MockNetlinkDataplane) DelIface(name string)
func (*MockNetlinkDataplane) Delete ¶
func (d *MockNetlinkDataplane) Delete()
func (*MockNetlinkDataplane) ExpectNeighs ¶
func (d *MockNetlinkDataplane) ExpectNeighs(family int, neighs ...netlink.Neigh)
func (*MockNetlinkDataplane) FeatureGate ¶
func (d *MockNetlinkDataplane) FeatureGate(name string) string
func (*MockNetlinkDataplane) GetDeletedConntrackEntries ¶
func (d *MockNetlinkDataplane) GetDeletedConntrackEntries() []net.IP
func (*MockNetlinkDataplane) GetFeatures ¶
func (d *MockNetlinkDataplane) GetFeatures() *environment.Features
func (*MockNetlinkDataplane) IfIndex ¶
func (d *MockNetlinkDataplane) IfIndex(name string) int
func (*MockNetlinkDataplane) LinkAdd ¶
func (d *MockNetlinkDataplane) LinkAdd(link netlink.Link) error
func (*MockNetlinkDataplane) LinkByName ¶
func (d *MockNetlinkDataplane) LinkByName(name string) (netlink.Link, error)
func (*MockNetlinkDataplane) LinkDel ¶
func (d *MockNetlinkDataplane) LinkDel(link netlink.Link) error
func (*MockNetlinkDataplane) LinkList ¶
func (d *MockNetlinkDataplane) LinkList() ([]netlink.Link, error)
func (*MockNetlinkDataplane) LinkSetMTU ¶
func (d *MockNetlinkDataplane) LinkSetMTU(link netlink.Link, mtu int) error
func (*MockNetlinkDataplane) LinkSetUp ¶
func (d *MockNetlinkDataplane) LinkSetUp(link netlink.Link) error
func (*MockNetlinkDataplane) NeighAdd ¶
func (d *MockNetlinkDataplane) NeighAdd(neigh *netlink.Neigh) error
func (*MockNetlinkDataplane) NeighDel ¶
func (d *MockNetlinkDataplane) NeighDel(neigh *netlink.Neigh) error
func (*MockNetlinkDataplane) NeighList ¶
func (d *MockNetlinkDataplane) NeighList(linkIndex, family int) ([]netlink.Neigh, error)
func (*MockNetlinkDataplane) NeighSet ¶
func (d *MockNetlinkDataplane) NeighSet(neigh *netlink.Neigh) error
func (*MockNetlinkDataplane) NewMockNetlink ¶
func (d *MockNetlinkDataplane) NewMockNetlink() (netlinkshim.Interface, error)
func (*MockNetlinkDataplane) NewMockWireguard ¶
func (d *MockNetlinkDataplane) NewMockWireguard() (netlinkshim.Wireguard, error)
func (*MockNetlinkDataplane) RefreshFeatures ¶
func (d *MockNetlinkDataplane) RefreshFeatures()
func (*MockNetlinkDataplane) RemoveConntrackFlows ¶
func (d *MockNetlinkDataplane) RemoveConntrackFlows(ipVersion uint8, ipAddr net.IP)
func (*MockNetlinkDataplane) RemoveMockRoute ¶
func (d *MockNetlinkDataplane) RemoveMockRoute(route *netlink.Route)
func (*MockNetlinkDataplane) ResetDeltas ¶
func (d *MockNetlinkDataplane) ResetDeltas()
func (*MockNetlinkDataplane) RouteAdd ¶
func (d *MockNetlinkDataplane) RouteAdd(route *netlink.Route) error
func (*MockNetlinkDataplane) RouteDel ¶
func (d *MockNetlinkDataplane) RouteDel(route *netlink.Route) error
func (*MockNetlinkDataplane) RouteListFiltered ¶
func (*MockNetlinkDataplane) RouteListFilteredIter ¶
func (*MockNetlinkDataplane) RouteReplace ¶
func (d *MockNetlinkDataplane) RouteReplace(route *netlink.Route) error
func (*MockNetlinkDataplane) RuleAdd ¶
func (d *MockNetlinkDataplane) RuleAdd(rule *netlink.Rule) error
func (*MockNetlinkDataplane) RuleDel ¶
func (d *MockNetlinkDataplane) RuleDel(rule *netlink.Rule) error
func (*MockNetlinkDataplane) RuleList ¶
func (d *MockNetlinkDataplane) RuleList(family int) ([]netlink.Rule, error)
func (*MockNetlinkDataplane) SetIface ¶
func (d *MockNetlinkDataplane) SetIface(name string, up bool, running bool)
func (*MockNetlinkDataplane) SetSocketTimeout ¶
func (d *MockNetlinkDataplane) SetSocketTimeout(to time.Duration) error
func (*MockNetlinkDataplane) SetStrictCheck ¶
func (d *MockNetlinkDataplane) SetStrictCheck(b bool) error
type MockWireguard ¶
type MockWireguard struct {
*MockNetlinkDataplane
}
func (*MockWireguard) Close ¶
func (d *MockWireguard) Close() error
func (*MockWireguard) ConfigureDevice ¶
func (d *MockWireguard) ConfigureDevice(name string, cfg wgtypes.Config) error
func (*MockWireguard) DeviceByName ¶
func (d *MockWireguard) DeviceByName(name string) (*wgtypes.Device, error)
Click to show internal directories.
Click to hide internal directories.