kubernetesk8s.io/kubernetes/pkg/proxy/util/nfacct Index | Files

package nfacct

import "k8s.io/kubernetes/pkg/proxy/util/nfacct"

Index

Constants

const MaxLength = 31

MaxLength represents the maximum length allowed for the name in a nfacct counter.

Variables

var ErrEmptyName = errors.New("object name cannot be empty")
var ErrNameExceedsMaxLength = fmt.Errorf("object name exceeds the maximum allowed length of %d characters", MaxLength)
var ErrNotSupported = errors.New("nfacct sub-system not available")
var ErrObjectAlreadyExists = errors.New("object already exists")
var ErrObjectNotFound = errors.New("object not found")
var ErrUnexpected = errors.New("unexpected error")

Types

type Counter

type Counter struct {
	Name    string
	Packets uint64
	Bytes   uint64
}

Counter represents a nfacct accounting object.

type Interface

type Interface interface {
	// Ensure checks the existence of a nfacct counter with the provided name and creates it if absent.
	Ensure(name string) error
	// Add creates a nfacct counter with the given name, returning an error if it already exists.
	Add(name string) error
	// Get retrieves the nfacct counter with the specified name, returning an error if it doesn't exist.
	Get(name string) (*Counter, error)
	// List retrieves nfacct counters, it could receive all counters or a subset of them with an unix.EINTR error.
	List() ([]*Counter, error)
}

Interface is an injectable interface for running nfacct commands.

func New

func New() (Interface, error)

New returns a new Interface. If the netfilter_nfacct subsystem is not available in the kernel it will return error.

Source Files

handler.go nfacct.go nfacct_linux.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
3 hours ago

Tools for package owners.