bpf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumeEvents

func ConsumeEvents[T Event](
	ctx context.Context,
	log *slog.Logger,
	evReader *ringbuf.Reader,
	evCh chan *T,
)

func ProcessNetworkEvent

func ProcessNetworkEvent(
	event *NetworkEvent,
	pod string,
	log *slog.Logger,
)

func ProcessSyscallEvent

func ProcessSyscallEvent(
	event *SyscallEvent,
	pod string,
	log *slog.Logger,
)

Types

type Event

type Event interface {
	SyscallEvent | NetworkEvent
}

type KBContext

type KBContext struct {
	SyscallRingBuffer *ringbuf.Reader
	NetworkRingBuffer *ringbuf.Reader

	Tps []link.Link
	Kps []link.Link
}

Define a Kernel BPF context.

func Attach

func Attach(
	log *slog.Logger,
	bpfProgramElf string,
) (*KBContext, error)

type KProbeMeta

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

Struct that holds bpf kprobe required metadata

type NetworkEvent

type NetworkEvent struct {
	Pid      uint64
	CgroupID uint64
	Size     uint64

	Saddr uint32
	Daddr uint32

	Sport uint16
	Dport uint16

	Direction NetworkEventDirection
	Protocol  NetworkEventProtocol
}

type NetworkEventDirection added in v0.1.0

type NetworkEventDirection uint8
const (
	NetworkEventDirectionInbound  NetworkEventDirection = 0
	NetworkEventDirectionOutbound NetworkEventDirection = 1
)

func (NetworkEventDirection) String added in v0.1.0

func (d NetworkEventDirection) String() string

type NetworkEventProtocol added in v0.1.0

type NetworkEventProtocol uint8
const (
	NetworkEventProtocolTCP NetworkEventProtocol = 6
	NetworkEventProtocolUDP NetworkEventProtocol = 17
)

func (NetworkEventProtocol) String added in v0.1.0

func (p NetworkEventProtocol) String() string

type SyscallEvent

type SyscallEvent struct {
	SyscallNr int64
	CgroupID  uint64
	Pid       uint64
}

func (SyscallEvent) GetSyscallName

func (s SyscallEvent) GetSyscallName() string

type TpMeta

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

Struct that holds bpf tracepoint required metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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