common

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 14 Imported by: 6

Documentation

Overview

package common contains common functions and types used by all Retina plugins.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const (
	// MapPath is the path to pinned BPF maps
	MapPath = "/sys/fs/bpf"
	// FilterMapName is the name of the BPF filter map
	FilterMapName = "retina_filter"
	// ConntrackMapName is the name of the BPF conntrack map
	ConntrackMapName = "retina_conntrack"
)

Variables

This section is empty.

Functions

func GetKernelVersionMajMin added in v0.0.32

func GetKernelVersionMajMin() (semver.Version, error)

Function to only extract the X.Y version components, used as fallback for version.GetKernelVersion() Needed for images which don't follow standard Linux version format, e.g.: 5.15.153.1-microsoft-standard-WSL2

func IsAzureLinux added in v0.0.32

func IsAzureLinux() bool

func NewPerfReader

func NewPerfReader(l *log.ZapLogger, m *ebpf.Map, max, min int) (*perf.Reader, error)

NewPerfReader creates a new perf reader with a buffer size that is a power of 2. It starts with the maximum buffer size and tries with smaller buffer sizes if it fails with ENOMEM. Returns an error if it fails to create a perf reader or encounters any other error. Not enforced, but max and min should be a power of 2. The allocated size will be a multiple of pagesize determined at runtime.

func ProtocolToFlow

func ProtocolToFlow(protocol string) int

Interface for IG event handlers. Maps to cilum Flow.

Types

type ITracer

type ITracer interface {
	SetEventHandler(interface{})
	Attach(pid uint32) error
	Detach(pid uint32) error
	Close()
}

Interface for IG tracers. Ref: https://pkg.go.dev/github.com/inspektor-gadget/inspektor-gadget@v0.18.1/pkg/gadgets/trace/dns/tracer#Tracer

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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