utils

package
v0.16.9 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalProtocol added in v0.16.7

func CanonicalProtocol(name string) string

func NormalizeDecoderList added in v0.16.7

func NormalizeDecoderList(list string, invalidDecoder error) ([]string, error)

func SelectDecoders

func SelectDecoders[T any](defaults []T, include, exclude string, nameOf func(T) string, invalidDecoder error) ([]T, error)

SelectDecoders selects a private slice of defaults using globally registered names.

func SetErrorMap

func SetErrorMap(e *AtomicCounterMap)

SetErrorMap sets the map for tracking errors it gets passed in from the collector during initialization

Types

type AtomicCounterMap

type AtomicCounterMap struct {
	sync.Mutex
	Items map[string]int64
	// contains filtered or unexported fields
}

AtomicCounterMap maps strings to integers.

var (
	// AllDecoderNames contains the decoder names at runtime.
	AllDecoderNames = make(map[string]struct{})

	// ErrorMap contains error during reassembly at runtime.
	ErrorMap *AtomicCounterMap
)

func NewAtomicCounterMap

func NewAtomicCounterMap() *AtomicCounterMap

NewAtomicCounterMap returns a new AtomicCounterMap.

func (*AtomicCounterMap) Inc

func (a *AtomicCounterMap) Inc(val string)

Inc increments a value.

func (*AtomicCounterMap) NewShard

func (a *AtomicCounterMap) NewShard() *AtomicCounterMap

NewShard registers a worker-local counter on the root. Call only on the root.

func (*AtomicCounterMap) Snapshot

func (a *AtomicCounterMap) Snapshot() map[string]int64

Snapshot copies root and shard counts. Each map is read under its own lock; the result is not a global cross-shard transaction.

type PacketInfo

type PacketInfo struct {
	Packet    gopacket.Packet
	Timestamp int64
	SrcMAC    string
	DstMAC    string
	SrcIP     string
	DstIP     string
}

PacketInfo contains packet meta information.

func NewPacketInfo

func NewPacketInfo(p gopacket.Packet) *PacketInfo

NewPacketInfo returns a new packet summary

Jump to

Keyboard shortcuts

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