xdpgtp

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PingEndpoint

func PingEndpoint(endpointIP string) (bool, error)

This Function reports whether an IP address is reachable with an ICMP echo request.

Types

type UsageStats

type UsageStats struct {
	Packets uint64 // Number of packets sent since program was loaded
	Bytes   uint64 // Number of bytes sent since program was loaded
}

Struct for storing usage statistics in BPF map.

type XDPGTP

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

XDPGTP holds the state of the running application.

func NewXDPGTP

func NewXDPGTP(xdpFlags link.XDPAttachFlags) (*XDPGTP, error)

NewXDPGTP loads compiled eBPF programs and maps into the kernel and returns a new XDPGTP.

Users must call x.Close() to safely unload eBPF programs and maps from the kernel.

func (XDPGTP) AddClient

func (x XDPGTP) AddClient(clientIP net.IP, teid uint32, upfIP net.IP) error

Method for adding a new client to the BPF map.

func (XDPGTP) AddUpf

func (x XDPGTP) AddUpf(upfIP net.IP) error

Method for adding a new UPF to the BPF map.

func (XDPGTP) AttachClientFacingProgramToInterface

func (x XDPGTP) AttachClientFacingProgramToInterface(clientIfindex int) error

Method for attaching the client-facing eBPF program to an interface given its index.

Users must call x.DetachProgramFromInterface(ifindex) to safely detach the eBPF program.

func (XDPGTP) AttachCommonProgramToInterface

func (x XDPGTP) AttachCommonProgramToInterface(commonIfindex int) error

Method for attaching the common eBPF program to an interface given its index.

Users must call x.DetachProgramFromInterface(ifindex) to safely detach the eBPF program.

func (XDPGTP) AttachUpfFacingProgramToInterface

func (x XDPGTP) AttachUpfFacingProgramToInterface(upfIfindex int) error

Method for attaching the UPF-facing eBPF program to an interface given its index.

Users must call x.DetachProgramFromInterface(ifindex) to safely detach the eBPF program.

func (XDPGTP) ClientIsRegistered

func (x XDPGTP) ClientIsRegistered(clientIP net.IP) bool

ClientIsRegistered reports whether the indicated client is present in the corresponding BPF map.

func (XDPGTP) Close

func (x XDPGTP) Close() error

Method for safely unloading the eBPF programs and maps from the kernel.

func (XDPGTP) DetachProgramFromInterface

func (x XDPGTP) DetachProgramFromInterface(ifindex int) error

Method for safely detaching an eBPF program from an interface.

func (XDPGTP) GetClients added in v0.2.1

func (x XDPGTP) GetClients() ([]net.IP, []uint32, []net.IP)

func (XDPGTP) GetClientsForUpf

func (x XDPGTP) GetClientsForUpf(upfIP net.IP) []net.IP

GetClientsForUpf returns a net.IP slice containing all the clients' IPs which are attached to a certain UPF.

func (XDPGTP) GetUpfs added in v0.2.1

func (x XDPGTP) GetUpfs() []net.IP

func (XDPGTP) GetUsageStats

func (x XDPGTP) GetUsageStats() ([2]UsageStats, error)

Method for extracting the stats of transmitted packets in both directions (client->UPF and UPF->client).

This function returns an array of UsageStats of length 2 ([0] for client->UPF and [1] for UPF->client).

func (XDPGTP) RemoveClient

func (x XDPGTP) RemoveClient(clientIP net.IP) error

Method for removing a client from the BPF map.

func (XDPGTP) RemoveUpf

func (x XDPGTP) RemoveUpf(upfIP net.IP) error

Method for removing an UPF from the BPF map.

Will fail if there are any clients attached to this UPF. Users will need to remove all attached clients beforehand.

func (XDPGTP) UpfIsRegistered

func (x XDPGTP) UpfIsRegistered(upfIP net.IP) bool

UpfIsRegistered reports whether the indicated UPF is present in the corresponing BPF map.

Jump to

Keyboard shortcuts

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