routetable

package
v3.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetFailed       = errors.New("netlink get operation failed")
	ConnectFailed   = errors.New("connect to netlink failed")
	ListFailed      = errors.New("netlink list operation failed")
	UpdateFailed    = errors.New("netlink update operation failed")
	IfaceNotPresent = errors.New("interface not present")
	IfaceDown       = errors.New("interface down")
	IfaceGrace      = errors.New("interface in cleanup grace period")
)

Functions

This section is empty.

Types

type HandleIface

type HandleIface interface {
	SetSocketTimeout(to time.Duration) error
	LinkList() ([]netlink.Link, error)
	LinkByName(name string) (netlink.Link, error)
	RouteList(link netlink.Link, family int) ([]netlink.Route, error)
	RouteAdd(route *netlink.Route) error
	RouteDel(route *netlink.Route) error
	Delete()
}

type L2Target

type L2Target struct {
	// For VXLAN targets, this is the node's real IP address.
	IP ip.Addr

	// For VXLAN targets, this is the MAC address of the remote VTEP.
	VTEPMAC net.HardwareAddr

	// For VXLAN targets, this is the IP address of the remote VTEP.
	GW ip.Addr
}

type RouteTable

type RouteTable struct {
	// contains filtered or unexported fields
}

func New

func New(interfacePrefixes []string, ipVersion uint8, vxlan bool, netlinkTimeout time.Duration) *RouteTable

func NewWithShims

func NewWithShims(
	interfacePrefixes []string,
	ipVersion uint8,
	newNetlinkHandle func() (HandleIface, error),
	vxlan bool,
	netlinkTimeout time.Duration,
	addStaticARPEntry func(cidr ip.CIDR, destMAC net.HardwareAddr, ifaceName string) error,
	conntrack conntrackIface,
	timeShim timeIface,
) *RouteTable

NewWithShims is a test constructor, which allows netlink, arp and time to be replaced by shims.

func (*RouteTable) Apply

func (r *RouteTable) Apply() error

func (*RouteTable) OnIfaceStateChanged

func (r *RouteTable) OnIfaceStateChanged(ifaceName string, state ifacemonitor.State)

func (*RouteTable) QueueResync

func (r *RouteTable) QueueResync()

func (*RouteTable) SetL2Routes

func (r *RouteTable) SetL2Routes(ifaceName string, targets []L2Target)

func (*RouteTable) SetRoutes

func (r *RouteTable) SetRoutes(ifaceName string, targets []Target)

type Target

type Target struct {
	Type    TargetType
	CIDR    ip.CIDR
	GW      ip.Addr
	DestMAC net.HardwareAddr
}

type TargetType

type TargetType string
const (
	TargetTypeVXLAN TargetType = "vxlan"
)

Jump to

Keyboard shortcuts

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