routemanager

package
v0.29.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultManager

type DefaultManager struct {
	// contains filtered or unexported fields
}

DefaultManager is the default instance of a route manager

func NewManager

func NewManager(
	ctx context.Context,
	pubKey string,
	dnsRouteInterval time.Duration,
	wgInterface iface.IWGIface,
	statusRecorder *peer.Status,
	relayMgr *relayClient.Manager,
	initialRoutes []*route.Route,
) *DefaultManager

func (*DefaultManager) EnableServerRouter added in v0.24.4

func (m *DefaultManager) EnableServerRouter(firewall firewall.Manager) error

func (*DefaultManager) GetClientRoutes added in v0.27.4

func (m *DefaultManager) GetClientRoutes() map[route.HAUniqueID]*clientNetwork

GetClientRoutes returns the client routes

func (*DefaultManager) GetRouteSelector added in v0.27.4

func (m *DefaultManager) GetRouteSelector() *routeselector.RouteSelector

GetRouteSelector returns the route selector

func (*DefaultManager) Init added in v0.26.4

Init sets up the routing

func (*DefaultManager) InitialRouteRange added in v0.21.2

func (m *DefaultManager) InitialRouteRange() []string

InitialRouteRange return the list of initial routes. It used by mobile systems

func (*DefaultManager) SetRouteChangeListener added in v0.21.0

func (m *DefaultManager) SetRouteChangeListener(listener listener.NetworkChangeListener)

SetRouteChangeListener set RouteListener for route change Notifier

func (*DefaultManager) Stop

func (m *DefaultManager) Stop()

Stop stops the manager watchers and clean firewall rules

func (*DefaultManager) TriggerSelection added in v0.27.4

func (m *DefaultManager) TriggerSelection(networks route.HAMap)

TriggerSelection triggers the selection of routes, stopping deselected watchers and starting newly selected ones

func (*DefaultManager) UpdateRoutes

func (m *DefaultManager) UpdateRoutes(updateSerial uint64, newRoutes []*route.Route) (map[route.ID]*route.Route, route.HAMap, error)

UpdateRoutes compares received routes with existing routes and removes, updates or adds them to the client and server maps

type Manager

type Manager interface {
	Init() (nbnet.AddHookFunc, nbnet.RemoveHookFunc, error)
	UpdateRoutes(updateSerial uint64, newRoutes []*route.Route) (map[route.ID]*route.Route, route.HAMap, error)
	TriggerSelection(route.HAMap)
	GetRouteSelector() *routeselector.RouteSelector
	SetRouteChangeListener(listener listener.NetworkChangeListener)
	InitialRouteRange() []string
	EnableServerRouter(firewall firewall.Manager) error
	Stop()
}

Manager is a route manager interface

type MockManager

type MockManager struct {
	UpdateRoutesFunc     func(updateSerial uint64, newRoutes []*route.Route) (map[route.ID]*route.Route, route.HAMap, error)
	TriggerSelectionFunc func(haMap route.HAMap)
	GetRouteSelectorFunc func() *routeselector.RouteSelector
	StopFunc             func()
}

MockManager is the mock instance of a route manager

func (*MockManager) EnableServerRouter added in v0.24.4

func (m *MockManager) EnableServerRouter(firewall firewall.Manager) error

func (*MockManager) GetRouteSelector added in v0.27.4

func (m *MockManager) GetRouteSelector() *routeselector.RouteSelector

GetRouteSelector mock implementation of GetRouteSelector from Manager interface

func (*MockManager) Init added in v0.26.4

func (*MockManager) InitialRouteRange added in v0.21.2

func (m *MockManager) InitialRouteRange() []string

InitialRouteRange mock implementation of InitialRouteRange from Manager interface

func (*MockManager) SetRouteChangeListener added in v0.21.0

func (m *MockManager) SetRouteChangeListener(listener listener.NetworkChangeListener)

SetRouteChangeListener mock implementation of SetRouteChangeListener from Manager interface

func (*MockManager) Start added in v0.21.0

func (m *MockManager) Start(ctx context.Context, iface *iface.WGIface)

Start mock implementation of Start from Manager interface

func (*MockManager) Stop

func (m *MockManager) Stop()

Stop mock implementation of Stop from Manager interface

func (*MockManager) TriggerSelection added in v0.27.4

func (m *MockManager) TriggerSelection(networks route.HAMap)

func (*MockManager) UpdateRoutes

func (m *MockManager) UpdateRoutes(updateSerial uint64, newRoutes []*route.Route) (map[route.ID]*route.Route, route.HAMap, error)

UpdateRoutes mock implementation of UpdateRoutes from Manager interface

type RouteHandler added in v0.28.0

type RouteHandler interface {
	String() string
	AddRoute(ctx context.Context) error
	RemoveRoute() error
	AddAllowedIPs(peerKey string) error
	RemoveAllowedIPs() error
}

RouteHandler defines the interface for handling routes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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