routing

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	LocalIP   net.IP
	RoutedNet *net.IPNet
	Interface *net.Interface
	Gateway   net.IP
	Default   bool
}

func DefaultRoute

func DefaultRoute(ctx context.Context) (*Route, error)

func GetRoute

func GetRoute(ctx context.Context, routedNet *net.IPNet) (*Route, error)

func GetRoutingTable

func GetRoutingTable(ctx context.Context) ([]*Route, error)

func (*Route) AddStatic

func (r *Route) AddStatic(ctx context.Context) (err error)

AddStatic adds a specific route. This can be used to prevent certain IP addresses from being routed to the route's interface.

func (*Route) RemoveStatic

func (r *Route) RemoveStatic(ctx context.Context) (err error)

RemoveStatic removes a specific route added via AddStatic.

func (*Route) Routes

func (r *Route) Routes(ip net.IP) bool

func (*Route) String

func (r *Route) String() string

type Table added in v2.14.0

type Table interface {
	// Add adds a route to the routing table
	Add(ctx context.Context, r *Route) error
	// Remove removes a route from the routing table
	Remove(ctx context.Context, r *Route) error
	// Close closes the routing table
	Close(ctx context.Context) error
}

func OpenTable added in v2.14.0

func OpenTable(ctx context.Context) (Table, error)

Jump to

Keyboard shortcuts

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