backend

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, ctor BackendCtor)

Types

type Backend

type Backend interface {
	// Called when the backend should create or begin managing a new network
	RegisterNetwork(ctx context.Context, wg *sync.WaitGroup, config *subnet.Config) (Network, error)
}

Besides the entry points in the Backend interface, the backend's New() function receives static network interface information (like internal and external IP addresses, MTU, etc) which it should cache for later use if needed.

type BackendCtor

type BackendCtor func(sm subnet.Manager, ei *ExternalInterface) (Backend, error)

type ExternalInterface

type ExternalInterface struct {
	Iface       *net.Interface
	IfaceAddr   net.IP
	IfaceV6Addr net.IP
	ExtAddr     net.IP
	ExtV6Addr   net.IP
}

type Manager

type Manager interface {
	GetBackend(backendType string) (Backend, error)
}

func NewManager

func NewManager(ctx context.Context, sm subnet.Manager, extIface *ExternalInterface) Manager

type Network

type Network interface {
	Lease() *lease.Lease
	MTU() int
	Run(ctx context.Context)
}

type RouteNetwork

type RouteNetwork struct {
	SimpleNetwork
	BackendType string

	SM         subnet.Manager
	GetRoute   func(lease *lease.Lease) *netlink.Route
	GetV6Route func(lease *lease.Lease) *netlink.Route
	Mtu        int
	LinkIndex  int
	// contains filtered or unexported fields
}

func (*RouteNetwork) MTU

func (n *RouteNetwork) MTU() int

func (*RouteNetwork) Run

func (n *RouteNetwork) Run(ctx context.Context)

type SimpleNetwork

type SimpleNetwork struct {
	SubnetLease *lease.Lease
	ExtIface    *ExternalInterface
}

func (*SimpleNetwork) Lease

func (n *SimpleNetwork) Lease() *lease.Lease

func (*SimpleNetwork) MTU

func (n *SimpleNetwork) MTU() int

func (*SimpleNetwork) Run

func (_ *SimpleNetwork) Run(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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