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) AddStaticArpEntry(cidr ip.CIDR, destMAC net.HardwareAddr, ifaceName string) error
- 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) Delete()
- func (d *MockNetlinkDataplane) GetDeletedConntrackEntries() []net.IP
- func (d *MockNetlinkDataplane) GetFeatures() *environment.Features
- func (d *MockNetlinkDataplane) HasStaticArpEntry(cidr ip.CIDR, destMAC net.HardwareAddr, ifaceName string) bool
- 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) 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) 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
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SimulatedError = errors.New("dummy error") NotFoundError = errors.New("not found") 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, FailNextAddARP, FailNextNewNetlink, FailNextSetSocketTimeout, FailNextSetStrict, }
Functions ¶
func KeyForRoute ¶
Types ¶
type FailFlags ¶
type FailFlags uint32
const ( FailNextLinkList FailFlags = 1 << iota FailNextLinkByName FailNextLinkByNameNotFound FailNextRouteList FailNextRouteAdd FailNextRouteDel FailNextAddARP 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] 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) AddStaticArpEntry ¶
func (d *MockNetlinkDataplane) AddStaticArpEntry(cidr ip.CIDR, destMAC net.HardwareAddr, ifaceName string) error
func (*MockNetlinkDataplane) Delete ¶
func (d *MockNetlinkDataplane) Delete()
func (*MockNetlinkDataplane) GetDeletedConntrackEntries ¶
func (d *MockNetlinkDataplane) GetDeletedConntrackEntries() []net.IP
func (*MockNetlinkDataplane) GetFeatures ¶
func (d *MockNetlinkDataplane) GetFeatures() *environment.Features
func (*MockNetlinkDataplane) HasStaticArpEntry ¶
func (d *MockNetlinkDataplane) HasStaticArpEntry(cidr ip.CIDR, destMAC net.HardwareAddr, ifaceName string) bool
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) 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) 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.