routemanager

package
v0.0.0-...-de402c9 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MainTableID = 254

MainTableID is the default routing table. IPRoute2 names the default routing table as 'main'

Variables

This section is empty.

Functions

func RoutePartiallyEqual

func RoutePartiallyEqual(r, x netlink.Route) bool

RoutePartiallyEqual compares a limited set of route attributes. The reason for not using the Equal method associated with type netlink.Route is because a user will only specify a limited subset of fields but when we introspect routes seen on the system, other fields are populated by default and therefore won't be equal anymore with user defined routes. Compare a limited set of fields that we care about. Also, netlink.Routes Equal method doesn't compare MTU.

Types

type Controller

type Controller struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func NewController

func NewController() *Controller

NewController manages routes which include adding and deletion of routes. It also manages restoration of managed routes. Begin managing routes by calling Run() to start the manager. Routes should be added via add(route) and deletion via del(route) functions only. All other functions are used internally.

func (*Controller) Add

func (c *Controller) Add(r netlink.Route) error

Add submits a request to add a route

func (*Controller) Del

func (c *Controller) Del(r netlink.Route) error

Del submits a request to del a route

func (*Controller) Run

func (c *Controller) Run(stopCh <-chan struct{}, syncPeriod time.Duration)

Run starts route manager and syncs at least every syncPeriod

Jump to

Keyboard shortcuts

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