tcmanager

package
v0.0.0-...-c73473a Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

line below avoids linter errors on Mac

Index

Constants

View Source
const (
	AttachmentEgress = AttachmentType(iota)
	AttachmentIngress
)
View Source
const (
	MonitorPoll = MonitorMode(iota)
	MonitorWatch
)
View Source
const (
	DefaultMonitorMode      = MonitorWatch
	DefaultChannelBufferLen = 10
	DefaultPollPeriod       = 10 * time.Second
)

Variables

View Source
var IsTCXSupported = sync.OnceValue(func() bool {
	prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{
		Type: ebpf.SchedCLS,
		Instructions: asm.Instructions{
			asm.Mov.Imm(asm.R0, 0),
			asm.Return(),
		},
		License: "Apache-2.0",
	})
	if err != nil {
		return false
	}

	defer func() { _ = prog.Close() }()

	l, err := link.AttachTCX(link.TCXOptions{
		Program:   prog,
		Attach:    ebpf.AttachTCXIngress,
		Interface: 1,
		Anchor:    link.Tail(),
	})
	if err != nil {
		return false
	}

	if err := l.Close(); err != nil {
		return false
	}

	return true
})

Functions

func EnsureCiliumCompatibility

func EnsureCiliumCompatibility(backend config.TCBackend) error

Types

type AttachmentType

type AttachmentType uint8

type IMIfaceMap

type IMIfaceMap map[int]*ifaces.Interface

type InterfaceFilter

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

func NewInterfaceFilter

func NewInterfaceFilter(allowed []string, excluded []string) (*InterfaceFilter, error)

func (*InterfaceFilter) Allow

func (itf *InterfaceFilter) Allow(pattern string) error

func (*InterfaceFilter) Deny

func (itf *InterfaceFilter) Deny(pattern string) error

func (*InterfaceFilter) IsAllowed

func (itf *InterfaceFilter) IsAllowed(name string) bool

type InterfaceManager

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

func NewInterfaceManager

func NewInterfaceManager() *InterfaceManager

func (*InterfaceManager) AddErrorCallback

func (im *InterfaceManager) AddErrorCallback(cb InterfaceManagerErrorCB) uint64

func (*InterfaceManager) AddInterfaceAddedCallback

func (im *InterfaceManager) AddInterfaceAddedCallback(cb InterfaceManagerCB) uint64

func (*InterfaceManager) AddInterfaceRemovedCallback

func (im *InterfaceManager) AddInterfaceRemovedCallback(cb InterfaceManagerCB) uint64

func (*InterfaceManager) InterfaceName

func (im *InterfaceManager) InterfaceName(ifaceIndex int) (string, bool)

func (*InterfaceManager) Interfaces

func (im *InterfaceManager) Interfaces() IMIfaceMap

func (*InterfaceManager) RemoveCallback

func (im *InterfaceManager) RemoveCallback(id uint64)

func (*InterfaceManager) SetChannelBufferLen

func (im *InterfaceManager) SetChannelBufferLen(channelBufferLen int)

func (*InterfaceManager) SetInterfaceFilter

func (im *InterfaceManager) SetInterfaceFilter(filter *InterfaceFilter)

func (*InterfaceManager) SetMonitorMode

func (im *InterfaceManager) SetMonitorMode(mode MonitorMode)

func (*InterfaceManager) SetPollPeriod

func (im *InterfaceManager) SetPollPeriod(period time.Duration)

func (*InterfaceManager) Start

func (im *InterfaceManager) Start(ctx context.Context)

func (*InterfaceManager) Stop

func (im *InterfaceManager) Stop()

func (*InterfaceManager) Wait

func (im *InterfaceManager) Wait()

type InterfaceManagerCB

type InterfaceManagerCB func(iface *ifaces.Interface)

type InterfaceManagerErrorCB

type InterfaceManagerErrorCB func(error)

type MonitorMode

type MonitorMode uint8

type TCManager

type TCManager interface {
	Shutdown()
	AddProgram(name string, prog *ebpf.Program, attachment AttachmentType)
	RemoveProgram(name string)
	SetInterfaceManager(im *InterfaceManager)
	Errors() chan error
}

func NewNetlinkManager

func NewNetlinkManager() TCManager

func NewTCManager

func NewTCManager(backend config.TCBackend) TCManager

func NewTCXManager

func NewTCXManager() TCManager

Jump to

Keyboard shortcuts

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