Documentation ¶
Overview ¶
Package fake is a fake datapath implementation. It does not implement any datapath specific concepts and is useful for mocking and testing.
Index ¶
- Variables
- func NewIPv4OnlyNodeAddressing() types.NodeAddressing
- func NewIPv6OnlyNodeAddressing() types.NodeAddressing
- func NewNodeAddressing() types.NodeAddressing
- type BandwidthManager
- type FakeDatapath
- func (f *FakeDatapath) BandwidthManager() datapath.BandwidthManager
- func (f *FakeDatapath) FakeNode() *FakeNodeHandler
- func (m *FakeDatapath) GetProxyPort(name string) uint16
- func (m *FakeDatapath) InstallNoTrackRules(IP string, port uint16, ipv6 bool) error
- func (f *FakeDatapath) InstallProxyRules(context.Context, uint16, bool, bool, string) error
- func (f *FakeDatapath) InstallRules(ctx context.Context, ifName string, quiet, install bool) error
- func (f *FakeDatapath) LBMap() datapath.LBMap
- func (f *FakeDatapath) LBMockMap() *mockmaps.LBMockMap
- func (f *FakeDatapath) Loader() datapath.Loader
- func (f *FakeDatapath) LocalNodeAddressing() datapath.NodeAddressing
- func (f *FakeDatapath) Node() datapath.NodeHandler
- func (f *FakeDatapath) NodeIDs() datapath.NodeIDHandler
- func (f *FakeDatapath) NodeNeighbors() datapath.NodeNeighbors
- func (f *FakeDatapath) Procfs() string
- func (m *FakeDatapath) RemoveNoTrackRules(IP string, port uint16, ipv6 bool) error
- func (f *FakeDatapath) SupportsOriginalSourceAddr() bool
- func (f *FakeDatapath) WireguardAgent() datapath.WireguardAgent
- func (f *FakeDatapath) WriteEndpointConfig(io.Writer, datapath.EndpointConfiguration) error
- func (f *FakeDatapath) WriteNetdevConfig(io.Writer, datapath.DeviceConfiguration) error
- func (f *FakeDatapath) WriteNodeConfig(io.Writer, *datapath.LocalNodeConfiguration) error
- func (f *FakeDatapath) WriteTemplateConfig(io.Writer, datapath.EndpointConfiguration) error
- type FakeNodeHandler
- func (n *FakeNodeHandler) AllNodeValidateImplementation()
- func (n *FakeNodeHandler) DumpNodeIDs() []*models.NodeID
- func (n *FakeNodeHandler) GetNodeID(_ net.IP) (uint16, bool)
- func (n *FakeNodeHandler) GetNodeIP(_ uint16) string
- func (n *FakeNodeHandler) Name() string
- func (n *FakeNodeHandler) NodeAdd(newNode nodeTypes.Node) error
- func (n *FakeNodeHandler) NodeCleanNeighbors(migrateOnly bool)
- func (n *FakeNodeHandler) NodeConfigurationChanged(config datapath.LocalNodeConfiguration) error
- func (n *FakeNodeHandler) NodeDelete(node nodeTypes.Node) error
- func (n *FakeNodeHandler) NodeNeighDiscoveryEnabled() bool
- func (n *FakeNodeHandler) NodeNeighborRefresh(ctx context.Context, node nodeTypes.Node)
- func (n *FakeNodeHandler) NodeUpdate(oldNode, newNode nodeTypes.Node) error
- func (n *FakeNodeHandler) NodeValidateImplementation(node nodeTypes.Node) error
- func (n *FakeNodeHandler) RestoreNodeIDs()
- type MTU
Constants ¶
This section is empty.
Variables ¶
var ( IPv4InternalAddress = net.ParseIP("10.0.0.2") IPv4NodePortAddress = net.ParseIP("10.0.0.3") IPv6InternalAddress = net.ParseIP("f00d::1") IPv6NodePortAddress = net.ParseIP("f00d::2") )
var Cell = cell.Module( "fake-datapath", "Fake Datapath", cell.Provide( func(na types.NodeAddressing) (*FakeDatapath, types.Datapath, types.NodeIDHandler) { dp := newDatapath(na) return dp, dp, dp.NodeIDs() }, func() signalmap.Map { return fakesignalmap.NewFakeSignalMap([][]byte{}, time.Second) }, func() authmap.Map { return fakeauthmap.NewFakeAuthMap() }, func() egressmap.PolicyMap { return nil }, func() *bigtcp.Configuration { return &bigtcp.Configuration{} }, func() *iptables.Manager { return &iptables.Manager{} }, func() types.BandwidthManager { return &BandwidthManager{} }, func() types.IPsecKeyCustodian { return &ipsecKeyCustodian{} }, func() mtu.MTU { return &MTU{} }, tables.NewDeviceTable, tables.NewL2AnnounceTable, statedb.RWTable[*tables.L2AnnounceEntry].ToTable, tables.NewRouteTable, statedb.RWTable[*tables.Route].ToTable, ), tables.NodeAddressCell, tables.NodeAddressingCell, cell.Invoke( statedb.RegisterTable[*tables.Device], statedb.RegisterTable[*tables.L2AnnounceEntry], statedb.RegisterTable[*tables.Route], ), tunnel.Cell, cell.Provide(fakeDevices), )
Cell provides a fake version of the datapath cell.
Used in integration tests in daemon/cmd and test/controlplane.
Functions ¶
func NewIPv4OnlyNodeAddressing ¶
func NewIPv4OnlyNodeAddressing() types.NodeAddressing
NewIPv4OnlyNodeAddressing returns a new fake node addressing where IPv6 is disabled
func NewIPv6OnlyNodeAddressing ¶
func NewIPv6OnlyNodeAddressing() types.NodeAddressing
NewIPv6OnlyNodeAddressing returns a new fake node addressing where IPv4 is disabled
func NewNodeAddressing ¶
func NewNodeAddressing() types.NodeAddressing
NewNodeAddressing returns a new fake node addressing
Types ¶
type BandwidthManager ¶ added in v1.15.0
type BandwidthManager struct{}
func (*BandwidthManager) BBREnabled ¶ added in v1.15.0
func (fbm *BandwidthManager) BBREnabled() bool
func (*BandwidthManager) DeleteEndpointBandwidthLimit ¶ added in v1.15.0
func (fbm *BandwidthManager) DeleteEndpointBandwidthLimit(epID uint16) error
func (*BandwidthManager) Enabled ¶ added in v1.15.0
func (fbm *BandwidthManager) Enabled() bool
func (*BandwidthManager) ResetQueues ¶ added in v1.15.0
func (fbm *BandwidthManager) ResetQueues() bool
type FakeDatapath ¶
type FakeDatapath struct {
// contains filtered or unexported fields
}
func (*FakeDatapath) BandwidthManager ¶ added in v1.15.0
func (f *FakeDatapath) BandwidthManager() datapath.BandwidthManager
func (*FakeDatapath) FakeNode ¶
func (f *FakeDatapath) FakeNode() *FakeNodeHandler
func (*FakeDatapath) GetProxyPort ¶
func (m *FakeDatapath) GetProxyPort(name string) uint16
func (*FakeDatapath) InstallNoTrackRules ¶
func (m *FakeDatapath) InstallNoTrackRules(IP string, port uint16, ipv6 bool) error
func (*FakeDatapath) InstallProxyRules ¶
func (*FakeDatapath) InstallRules ¶
func (*FakeDatapath) LBMap ¶
func (f *FakeDatapath) LBMap() datapath.LBMap
func (*FakeDatapath) LBMockMap ¶
func (f *FakeDatapath) LBMockMap() *mockmaps.LBMockMap
func (*FakeDatapath) Loader ¶
func (f *FakeDatapath) Loader() datapath.Loader
func (*FakeDatapath) LocalNodeAddressing ¶
func (f *FakeDatapath) LocalNodeAddressing() datapath.NodeAddressing
LocalNodeAddressing returns a fake node addressing implementation of the local node
func (*FakeDatapath) Node ¶
func (f *FakeDatapath) Node() datapath.NodeHandler
Node returns a fake handler for node events
func (*FakeDatapath) NodeIDs ¶
func (f *FakeDatapath) NodeIDs() datapath.NodeIDHandler
func (*FakeDatapath) NodeNeighbors ¶
func (f *FakeDatapath) NodeNeighbors() datapath.NodeNeighbors
func (*FakeDatapath) Procfs ¶
func (f *FakeDatapath) Procfs() string
func (*FakeDatapath) RemoveNoTrackRules ¶
func (m *FakeDatapath) RemoveNoTrackRules(IP string, port uint16, ipv6 bool) error
func (*FakeDatapath) SupportsOriginalSourceAddr ¶
func (f *FakeDatapath) SupportsOriginalSourceAddr() bool
func (*FakeDatapath) WireguardAgent ¶
func (f *FakeDatapath) WireguardAgent() datapath.WireguardAgent
func (*FakeDatapath) WriteEndpointConfig ¶
func (f *FakeDatapath) WriteEndpointConfig(io.Writer, datapath.EndpointConfiguration) error
WriteEndpointConfig pretends to write the endpoint configuration to a writer.
func (*FakeDatapath) WriteNetdevConfig ¶
func (f *FakeDatapath) WriteNetdevConfig(io.Writer, datapath.DeviceConfiguration) error
WriteNetdevConfig pretends to write the netdev configuration to a writer.
func (*FakeDatapath) WriteNodeConfig ¶
func (f *FakeDatapath) WriteNodeConfig(io.Writer, *datapath.LocalNodeConfiguration) error
WriteNodeConfig pretends to write the datapath configuration to the writer.
func (*FakeDatapath) WriteTemplateConfig ¶
func (f *FakeDatapath) WriteTemplateConfig(io.Writer, datapath.EndpointConfiguration) error
WriteTemplateConfig pretends to write the endpoint configuration to a writer.
type FakeNodeHandler ¶
type FakeNodeHandler struct { Nodes map[string]nodeTypes.Node // contains filtered or unexported fields }
func NewNodeHandler ¶
func NewNodeHandler() *FakeNodeHandler
NewNodeHandler returns a fake NodeHandler that stores the nodes, but performs no other actions.
func (*FakeNodeHandler) AllNodeValidateImplementation ¶
func (n *FakeNodeHandler) AllNodeValidateImplementation()
func (*FakeNodeHandler) DumpNodeIDs ¶
func (n *FakeNodeHandler) DumpNodeIDs() []*models.NodeID
func (*FakeNodeHandler) GetNodeIP ¶
func (n *FakeNodeHandler) GetNodeIP(_ uint16) string
func (*FakeNodeHandler) Name ¶
func (n *FakeNodeHandler) Name() string
func (*FakeNodeHandler) NodeCleanNeighbors ¶
func (n *FakeNodeHandler) NodeCleanNeighbors(migrateOnly bool)
func (*FakeNodeHandler) NodeConfigurationChanged ¶
func (n *FakeNodeHandler) NodeConfigurationChanged(config datapath.LocalNodeConfiguration) error
func (*FakeNodeHandler) NodeDelete ¶
func (n *FakeNodeHandler) NodeDelete(node nodeTypes.Node) error
func (*FakeNodeHandler) NodeNeighDiscoveryEnabled ¶
func (n *FakeNodeHandler) NodeNeighDiscoveryEnabled() bool
func (*FakeNodeHandler) NodeNeighborRefresh ¶
func (n *FakeNodeHandler) NodeNeighborRefresh(ctx context.Context, node nodeTypes.Node)
func (*FakeNodeHandler) NodeUpdate ¶
func (n *FakeNodeHandler) NodeUpdate(oldNode, newNode nodeTypes.Node) error
func (*FakeNodeHandler) NodeValidateImplementation ¶
func (n *FakeNodeHandler) NodeValidateImplementation(node nodeTypes.Node) error
func (*FakeNodeHandler) RestoreNodeIDs ¶
func (n *FakeNodeHandler) RestoreNodeIDs()
type MTU ¶ added in v1.15.0
type MTU struct{}
func (*MTU) GetDeviceMTU ¶ added in v1.15.0
GetDeviceMTU implements mtu.MTU.
func (*MTU) GetRouteMTU ¶ added in v1.15.0
GetRouteMTU implements mtu.MTU.
func (*MTU) GetRoutePostEncryptMTU ¶ added in v1.15.0
GetRoutePostEncryptMTU implements mtu.MTU.