transformer

package
v0.0.0-...-388f960 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextID        = ContextKey("id")
	ContextLogName   = ContextKey("logName")
	ContextVerbosity = ContextKey("verbosity")
	ContextDebug     = ContextKey("debug")
)

Variables

This section is empty.

Functions

func NewPcapFilters

func NewPcapFilters() *pcapFilters

Types

type Addr

type Addr netip.Addr

type ContextKey

type ContextKey string

type FTSTSM

type FTSTSM = *haxmap.Map[uint64, STSM] // FlowTo[StreamTo[SequenceToTracedFlow]]Map

type IPcapTransformer

type IPcapTransformer interface {
	WaitDone(context.Context, *time.Duration)
	Apply(context.Context, *gopacket.Packet, *uint64) error
}

func NewConnTrackTransformer

func NewConnTrackTransformer(
	ctx context.Context,
	verbosity PcapVerbosity,
	iface *PcapIface,
	ephemerals *PcapEphemeralPorts,
	filters PcapFilters,
	writers []io.Writer,
	format *string,
	debug, compat bool,
) (IPcapTransformer, error)

func NewDebugTransformer

func NewDebugTransformer(
	ctx context.Context,
	verbosity PcapVerbosity,
	iface *PcapIface,
	ephemerals *PcapEphemeralPorts,
	filters PcapFilters,
	writers []io.Writer,
	format *string,
	compat bool,
) (IPcapTransformer, error)

func NewOrderedTransformer

func NewOrderedTransformer(
	ctx context.Context,
	verbosity PcapVerbosity,
	iface *PcapIface,
	ephemerals *PcapEphemeralPorts,
	filters PcapFilters,
	writers []io.Writer,
	format *string,
	debug, compat bool,
) (IPcapTransformer, error)

func NewTransformer

func NewTransformer(
	ctx context.Context,
	verbosity PcapVerbosity,
	iface *PcapIface,
	ephemerals *PcapEphemeralPorts,
	filters PcapFilters,
	writers []io.Writer,
	format *string,
	debug, compat bool,
) (IPcapTransformer, error)

type L3Proto

type L3Proto uint8

type L4Proto

type L4Proto uint8

type PcapEphemeralPorts

type PcapEphemeralPorts struct {
	Min, Max uint16
}

type PcapFilters

type PcapFilters interface {
	HasL3Protos() bool
	HasIPs() bool
	HasIPv4s() bool
	HasIPv6s() bool

	HasL4Protos() bool
	HasTCPflags() bool
	HasL4Addrs() bool

	AllowsL3Proto(*uint8) bool
	AllowsIP(*netip.Addr) bool
	AllowsIPv4() bool
	AllowsIPv4Addr(*netip.Addr) bool
	AllowsIPv4Bytes([4]byte) bool
	AllowsIPv6() bool
	AllowsIPv6Addr(*netip.Addr) bool
	AllowsIPv6Bytes([16]byte) bool

	AllowsL4Proto(*uint8) bool
	AllowsTCP() bool
	AllowsUDP() bool
	AllowsL4Addr(*uint16) bool
	AllowsAnyL4Addr(...uint16) bool
	DeniesAnyL4Addr(...uint16) bool

	AllowsSocket(*netip.Addr, *uint16, *netip.Addr, *uint16) bool
	DeniesSocket(*netip.Addr, *uint16, *netip.Addr, *uint16) bool

	AllowsAnyTCPflags(*uint8) bool
}

type PcapIface

type PcapIface struct {
	Index uint8
	Name  string
	Addrs mapset.Set[string]
}

type PcapTransformer

type PcapTransformer struct {
	// contains filtered or unexported fields
}

func (*PcapTransformer) Apply

func (t *PcapTransformer) Apply(ctx context.Context, packet *gopacket.Packet, serial *uint64) error

func (*PcapTransformer) WaitDone

func (t *PcapTransformer) WaitDone(ctx context.Context, timeout *time.Duration)

returns when all packets have been transformed and written

type PcapTranslator

type PcapTranslator interface {
	// contains filtered or unexported methods
}

type PcapTranslatorFmt

type PcapTranslatorFmt uint8
const (
	TEXT PcapTranslatorFmt = iota
	JSON
	PROTO
)

type PcapVerbosity

type PcapVerbosity uint8
const (
	VERBOSITY_INFO PcapVerbosity = iota
	VERBOSITY_DEBUG
)

type STSM

type STSM = *haxmap.Map[uint32, STTFM] // StreamTo[SequenceToTracedFlow]Map

type STTFM

type STTFM = *skipmap.Uint32Map[*TracedFlow] // SequenceTo[TracedFlow]Map

type TCPFlag

type TCPFlag string

func (*TCPFlag) ToUint8

func (flag *TCPFlag) ToUint8() uint8

type TCPFlags

type TCPFlags []uint8

type TraceAndSpanProvider

type TraceAndSpanProvider = func(*uint32) (*traceAndSpan, bool)

type TracedFlow

type TracedFlow struct {
	// contains filtered or unexported fields
}

type TracedFlowProvider

type TracedFlowProvider = func(*uint32) (*TracedFlow, bool)

type Unlock

type Unlock = func(context.Context) (bool, *time.Duration)

type UnlockWithTCPFlags

type UnlockWithTCPFlags = func(
	context.Context,
	*uint8,
) (bool, *time.Duration)

type UnlockWithTraceAndSpan

type UnlockWithTraceAndSpan = func(
	context.Context,
	*uint8,
	bool,
	[]uint32, []uint32,
	map[uint32]*traceAndSpan,
	map[uint32]*traceAndSpan,
) (*int64, *time.Duration)

Jump to

Keyboard shortcuts

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