xnet

package
v0.10.0 Latest Latest
Warning

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

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

Documentation

Overview

Package xnet contains low level Linux networking calls (generally related to netlink and tunneling)

Index

Constants

View Source
const (
	// SIGRPriority is the metric to use when inserting routes in the Linux routing table.
	// This follows the convention of FRR, where BGP routes are inserted with a metric
	// equal to the administrative distance (in the case of BGP, this would be 20).
	// For Gateway routes, the administrative distance is 15, hence the priority.
	SIGRPriority = 15
	SIGTxQlen    = 1000
)

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, name string) (control.DeviceHandle, error)

Open creates a new DeviceHandle backed by a Linux network interface of type tun. The interface will have the specified name.

func UseNameResolver

func UseNameResolver(namer func(addr.IA) string,
	opener DeviceOpener) control.DeviceOpener

UseNameResolver constructs a control.DeviceOpener implementation that opens Linux devices with names resolved using the selected naming function.

Types

type DeviceOpener

type DeviceOpener interface {
	Open(string) (control.Device, error)
}

DeviceOpener opens Linux tunnels.

func OpenerWithOptions

func OpenerWithOptions(ctx context.Context, options ...DeviceOption) DeviceOpener

OpenerWithOptions returns an Open implementation with the desired options attached.

type DeviceOpenerFunc

type DeviceOpenerFunc func(name string) (control.Device, error)

func (DeviceOpenerFunc) Open

func (f DeviceOpenerFunc) Open(name string) (control.Device, error)

type DeviceOption

type DeviceOption func(*deviceOptions)

func WithRoutingOnlyNoCreate

func WithRoutingOnlyNoCreate() DeviceOption

WithRoutingOnlyNoCreate signals to create a device handle that supports routing but reading and writing return errors. This can be used for implementations where data-plane forwarding is done by other applications. The device must already exist, and an error will be returned if it does not.

Jump to

Keyboard shortcuts

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