connection

package
v0.0.0-...-a5a9a89 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package connection provides network connection tracking functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracer

type Tracer interface {
	// Start begins collecting network connection data.
	Start(func(*network.ConnectionStats)) error
	// Stop halts all network data collection.
	Stop()
	// GetConnections returns the list of currently active connections, using the buffer provided.
	// The optional filter function is used to prevent unwanted connections from being returned and consuming resources.
	GetConnections(buffer *network.ConnectionBuffer, filter func(*network.ConnectionStats) bool) error
	// FlushPending forces any closed connections waiting for batching to be processed immediately.
	FlushPending()
	// Remove deletes the connection from tracking state.
	// It does not prevent the connection from re-appearing later, if additional traffic occurs.
	Remove(conn *network.ConnectionStats) error
	// GetMap returns the underlying named map. This is useful if any maps are shared with other eBPF components.
	// An individual tracer implementation may choose which maps to expose via this function.
	GetMap(string) (*ebpf.Map, error)
	// DumpMaps (for debugging purpose) returns all maps content by default or selected maps from maps parameter.
	DumpMaps(w io.Writer, maps ...string) error
	// Type returns the type of the underlying ebpf tracer that is currently loaded
	Type() TracerType

	Pause() error
	Resume() error

	// Describe returns all descriptions of the collector
	Describe(descs chan<- *prometheus.Desc)
	// Collect returns the current state of all metrics of the collector
	Collect(metrics chan<- prometheus.Metric)
}

Tracer is the common interface implemented by all connection tracers.

func NewTracer

func NewTracer(_ *config.Config, _ telemetry.Component) (Tracer, error)

NewTracer is not supported on platforms other than Linux and Darwin.

type TracerType

type TracerType int

TracerType is the type of the underlying tracer

const (
	// TracerTypeKProbePrebuilt is the TracerType for prebuilt kprobe tracer
	TracerTypeKProbePrebuilt TracerType = iota
	// TracerTypeKProbeRuntimeCompiled is the TracerType for the runtime compiled kprobe tracer
	TracerTypeKProbeRuntimeCompiled
	// TracerTypeKProbeCORE is the TracerType for the CORE kprobe tracer
	TracerTypeKProbeCORE
	// TracerTypeFentry is the TracerType for the fentry tracer
	TracerTypeFentry
	// TracerTypeEbpfless is the TracerType for the EBPF-less tracer
	TracerTypeEbpfless
	// TracerTypeDarwin is the TracerType for the Darwin tracer (uses ebpfless implementation)
	TracerTypeDarwin
	// TracerTypeSK is the TracerType for the SK-based tracer
	TracerTypeSK
)

Directories

Path Synopsis
Package ebpfless contains supporting code for the ebpfless tracer
Package ebpfless contains supporting code for the ebpfless tracer

Jump to

Keyboard shortcuts

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