lwtunnel

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LWTUNNEL_IP_UNSPEC = iota
	LWTUNNEL_IP_ID
	LWTUNNEL_IP_DST
	LWTUNNEL_IP_SRC
	LWTUNNEL_IP_TTL
	LWTUNNEL_IP_TOS
	LWTUNNEL_IP_FLAGS
	LWTUNNEL_IP_PAD
	LWTUNNEL_IP_OPTS
)
View Source
const (
	// DefaultGeneveMTU is the MTU for Geneve tunnel interfaces. Must be >=
	// the tunnel TUN MTU (1420) so that overlay packets are not fragmented
	// on the Geneve leg. Safe to set high since Geneve runs over VPC
	// networks that support jumbo frames.
	DefaultGeneveMTU = 1450
)

Variables

This section is empty.

Functions

func WithDevName

func WithDevName(dev string) option

WithDevName sets the name of the Geneve interface.

func WithMTU

func WithMTU(mtu int) option

WithMTU sets the MTU for the Geneve interface.

func WithNetNS

func WithNetNS(ns string) option

WithNetNS sets the network namespace for the Geneve interface and routes.

func WithPort

func WithPort(port uint16) option

WithPort sets the UDP port for Geneve header.

func WithVNI

func WithVNI(vni uint32) option

WithVNI sets the Virtual Network Identifier to use for the tunnel.

Types

type Endpoint

type Endpoint struct {
	// Dst is the destination prefix that should be sent over the tunnel.
	Dst tunnet.NetULA
	// Remote is a VTEP/VNE address of a remote tunnel endpoint.
	Remote netip.Addr
}

Endpoint represents a tunnel route.

type Geneve

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

Geneve manages Geneve tunnel interfaces and routes.

func NewGeneve

func NewGeneve(opts ...option) *Geneve

NewGeneve creates a new Geneve tunnel manager.

func (*Geneve) SetAddr

func (r *Geneve) SetAddr(_ context.Context, ula netip.Addr) error

SetAddr sets the IPv6 overlay address on the Geneve interface, removing any previously assigned overlay addresses. This is optional and only needed for the originating end of the tunnel to assign an inner source IP address.

func (*Geneve) SetUp

func (r *Geneve) SetUp(_ context.Context, privAddr netip.Addr) error

SetUp sets up the Geneve tunnel. Can be called multiple times.

func (*Geneve) SyncEndpoints

func (r *Geneve) SyncEndpoints(ctx context.Context, eps []Endpoint) error

SyncEndpoints syncs tunnel endpoints. Endpoints that are missing from eps are removed immediately.

func (*Geneve) TearDown

func (r *Geneve) TearDown() error

TearDown removes the Geneve interface.

type IPEncap

type IPEncap struct {
	ID     uint32 // VNI - Virtual Network Identifier (24 bits)
	Remote net.IP // Remote tunnel endpoint IP address
	TTL    uint8  // Time to live (8 bits)
}

IPEncap represents IP tunnel encapsulation. Implements netlink.Encap interface.

func (*IPEncap) Decode

func (e *IPEncap) Decode(buf []byte) error

Decode parses the netlink attributes into the IPEncap structure.

func (*IPEncap) Encode

func (e *IPEncap) Encode() ([]byte, error)

Encode serializes the IPEncap structure into netlink attributes

func (*IPEncap) Equal

func (e *IPEncap) Equal(x netlink.Encap) bool

Equal compares two IPEncap instances for equality.

func (*IPEncap) String

func (e *IPEncap) String() string

String returns a human-readable representation of the encapsulation.

func (*IPEncap) Type

func (e *IPEncap) Type() int

Type returns the type of the encapsulation (LWTUNNEL_ENCAP_IP).

Jump to

Keyboard shortcuts

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