counters

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TotalPackets = iota
	AcceptedByFailsafe
	AcceptedByPolicy
	AcceptedByAnotherProgram
	DroppedByPolicy
	DroppedShortPacket
	DroppedFailedCSUM
	DroppedIPOptions
	DroppredIPMalformed
	DroppedFailedEncap
	DroppedFailedDecap
	DroppedUnauthSource
	DroppedUnknownRoute
)

The following values are used as index to counters map, and should be kept in sync with constants defined in bpf-gpl/reasons.h.

View Source
const (
	MaxCounterNumber int = 14
)
View Source
const PolicyMapKeySize = 8
View Source
const PolicyMapValueSize = 8

Variables

View Source
var MapParameters = maps.MapParameters{
	Type:       "percpu_hash",
	KeySize:    counterMapKeySize,
	ValueSize:  counterMapValueSize * MaxCounterNumber,
	MaxEntries: 20000,
	Name:       "cali_counters",
	Version:    2,
}
View Source
var PolicyMapParameters = maps.MapParameters{
	Type:       "percpu_hash",
	KeySize:    PolicyMapKeySize,
	ValueSize:  PolicyMapValueSize,
	MaxEntries: 10000,
	Name:       "cali_rule_ctrs",
	Version:    2,
}

Functions

func EnsureExists

func EnsureExists(m maps.Map, ifindex int, hook bpf.Hook) error

func Flush

func Flush(m maps.Map, ifindex int, hook bpf.Hook) error

func Map

func Map() maps.Map

func PolicyMap

func PolicyMap() maps.Map

func PolicyMapMemIter

func PolicyMapMemIter(m PolicyMapMem) func(k, v []byte)

PolicyMapMemIter returns maps.MapIter that loads the provided PolicyMapMem

func Read

func Read(m maps.Map, ifindex int, hook bpf.Hook) ([]uint64, error)

Types

type DescList

type DescList []Description

func Descriptions

func Descriptions() DescList

func (DescList) Len

func (d DescList) Len() int

func (DescList) Less

func (d DescList) Less(i, j int) bool

func (DescList) Swap

func (d DescList) Swap(i, j int)

type Description

type Description struct {
	Category string
	Caption  string
	Counter  int
}

type Key

type Key [8]byte

func NewKey

func NewKey(ifindex int, hook bpf.Hook) Key

func (Key) AsBytes

func (k Key) AsBytes() []byte

func (Key) IfIndex

func (k Key) IfIndex() int

type PolicyMapMem

type PolicyMapMem map[uint64]uint64

func LoadPolicyMap

func LoadPolicyMap(m maps.Map) (PolicyMapMem, error)

Jump to

Keyboard shortcuts

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