xdp

package
v1.78.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package xdp contains the XDP STUN program.

Index

Constants

View Source
const (
	// XDPDriverFallbackGenericMode attempts XDPDriverMode, and falls back to
	// XDPGenericMode if the driver does not support XDP.
	XDPDriverFallbackGenericMode = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type STUNServer

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

STUNServer manages loading and unloading of an eBPF XDP program that serves the STUN protocol. It exports statistics for the XDP program via its implementation of the prometheus.Collector interface.

func NewSTUNServer

func NewSTUNServer(config *STUNServerConfig, opts ...STUNServerOption) (*STUNServer, error)

NewSTUNServer returns an instance of a STUNServer that has attached the STUN XDP program to the netdev and destination port specified by config.

func (*STUNServer) Close

func (s *STUNServer) Close() error

Close unloads the XDP program and associated maps.

func (*STUNServer) Collect

func (s *STUNServer) Collect(metricCh chan<- prometheus.Metric)

Collect is part of the implementation of prometheus.Collector.

func (*STUNServer) Describe

func (s *STUNServer) Describe(descCh chan<- *prometheus.Desc)

Describe is part of the implementation of prometheus.Collector.

func (*STUNServer) GetDropSTUN

func (s *STUNServer) GetDropSTUN() bool

func (*STUNServer) SetDropSTUN

func (s *STUNServer) SetDropSTUN(v bool) error

type STUNServerConfig

type STUNServerConfig struct {
	DeviceName  string
	DstPort     int
	AttachFlags XDPAttachFlags
	// Return XDP verifier errors in their entirety. This is a multiline error
	// that can be very long. Full verifier errors are primarily useful during
	// development, but should be mostly unexpected in a production environment.
	FullVerifierErr bool
}

STUNServerConfig represents the configuration of a STUNServer.

type STUNServerOption

type STUNServerOption interface {
	// contains filtered or unexported methods
}

type XDPAttachFlags

type XDPAttachFlags uint32

XDPAttachFlags represents how XDP program will be attached to interface. This is a mirror of cilium/ebpf/link.AttachFlags, without pulling it in for non-Linux.

const (
	// XDPGenericMode (SKB) links XDP BPF program for drivers which do
	// not yet support native XDP.
	XDPGenericMode XDPAttachFlags = 1 << (iota + 1)
	// XDPDriverMode links XDP BPF program into the driver’s receive path.
	XDPDriverMode
	// XDPOffloadMode offloads the entire XDP BPF program into hardware.
	XDPOffloadMode
)

Directories

Path Synopsis
The update program fetches the libbpf headers from the libbpf GitHub repository and writes them to disk.
The update program fetches the libbpf headers from the libbpf GitHub repository and writes them to disk.

Jump to

Keyboard shortcuts

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