xdp

package module
v0.0.0-...-edc748c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 9 Imported by: 0

README

XDP

This package contains XDP/eBPF code to accelerate ADK.

It is container in its own Go module because of the way the bpf ELF file is built.

This repo already contains the built ELF artifacts (bpf_bpfeb.o, bpf_bpfel.o) and associated Go files (bpf_bpfeb.go, bpf_bpfel.go). In order to build them from scratch you can use the provided container image:

# Docker is required
$ make build

Documentation

Index

Constants

View Source
const ADKProofLength = 4 // bytes

Variables

View Source
var ErrNotSupported = errors.New("XDP support is not supported")
View Source
var NativeOrder = binary.LittleEndian

Functions

func IsSupported

func IsSupported() bool

Types

type ADK

type ADK interface {
	StatsProvider
	Start() error
	Stop() error
}

func NewADK

func NewADK(s ADKSettings, proof ADKProofGenerator) (ADK, error)

type ADKProofGenerator

type ADKProofGenerator interface {
	ADKProofNow() uint32
	ADKProofNext() uint32
}

type ADKSettings

type ADKSettings struct {
	InterfaceName   string
	Mode            Mode
	ReplaceIfLoaded bool
	UDPServerPort   int
}

type Action

type Action uint8
const (
	ActionAborted Action = iota
	ActionDrop
	ActionPass
	ActionTX
	ActionRedirect
)

func (Action) String

func (x Action) String() string

func (Action) Uint32

func (x Action) Uint32() uint32

type Mode

type Mode uint8
const (
	ModeUndefined Mode = iota
	ModeSKB
	ModeDriver
)

func ModeFromString

func ModeFromString(s string) (m Mode, ok bool)

func (Mode) Valid

func (m Mode) Valid() bool

type OSPAStatID

type OSPAStatID uint8
const (
	OSPAStatIDNotOpenSPAPacket OSPAStatID = iota
	OSPAStatIDADKProofInvalid
	OSPAStatIDADKProofValid
)

func (OSPAStatID) Uint32

func (o OSPAStatID) Uint32() uint32

type Stats

type Stats struct {
	XDPAborted  StatsRecord
	XDPDrop     StatsRecord
	XDPPass     StatsRecord
	XDPTX       StatsRecord
	XDPRedirect StatsRecord

	OpenSPANot             uint64
	OpenSPAADKProofInvalid uint64
	OpenSPAADKProofValid   uint64
}

func (Stats) Merge

func (s Stats) Merge(u Stats) Stats

type StatsProvider

type StatsProvider interface {
	Stats() (Stats, error)
}

type StatsRecord

type StatsRecord struct {
	Packets uint64
	Bytes   uint64
}

Jump to

Keyboard shortcuts

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