routemanager

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFirewall

func NewFirewall(parentCTX context.Context) firewallManager

NewFirewall if supported, returns an iptables manager, otherwise returns a nftables manager

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, wgInterface *iface.WGIface, statusRecorder *peer.Status, initialRoutes []*route.Route) *DefaultManager

NewManager returns a new route manager

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 RouteListener)

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) UpdateRoutes

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

UpdateRoutes compares received routes with existing routes and remove, update or add them to the client and server maps

type Manager

type Manager interface {
	UpdateRoutes(updateSerial uint64, newRoutes []*route.Route) error
	SetRouteChangeListener(listener RouteListener)
	InitialRouteRange() []string
	Stop()
}

Manager is a route manager interface

type MockManager

type MockManager struct {
	UpdateRoutesFunc func(updateSerial uint64, newRoutes []*route.Route) error
	StopFunc         func()
}

MockManager is the mock instance of a route manager

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 RouteListener)

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) UpdateRoutes

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

UpdateRoutes mock implementation of UpdateRoutes from Manager interface

type RouteListener added in v0.21.0

type RouteListener interface {
	// OnNewRouteSetting invoke when new route setting has been arrived
	OnNewRouteSetting()
}

RouteListener is a callback interface for mobile system

Jump to

Keyboard shortcuts

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