router

package
v0.0.0-...-ef05d19 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRouteToHost = fmt.Errorf("no route to host")

Functions

This section is empty.

Types

type Router

type Router interface {

	// UpdateNode updates the connection information for a node.
	UpdateNode(proto.IP, proto.RoutingConns)

	// RemoveNode removes the connection information for a node
	RemoveNode(proto.IP)

	// NextHop returns the next hop according to the routing policy.  Note that the policy may be out of date with the
	// latest connection information, if new information has been received within the duration specified by updateWait.
	NextHop(proto.IP) (proto.IP, error)

	// SubscribeUpdates returns a channel which will be sent a routing policy whenever it is updated
	SubscribeUpdates() <-chan proto.RoutingPolicy

	// UnsubscribeUpdates unsubscribes a previously subscribed updates channel
	UnsubscribeUpdates(ch <-chan proto.RoutingPolicy)

	// Nodes returns a copy of the nodes and connections known to the router
	Nodes() proto.RoutingNodes
}

func New

func New(ctx context.Context, myAddr proto.IP, updateWait time.Duration) Router

New returns a new router. UpdateWait specifies the maximum time after an UpdateNode that a recalculation should occur.

Jump to

Keyboard shortcuts

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