tcp

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 34 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

View Source
var ErrRetainedPayloadLimit = errors.New("TCP retained payload budget exceeded")

ErrRetainedPayloadLimit means reader-owned TCP payload could not be retained.

View Source
var StreamFactory = newStreamFactory()

StreamFactory is a structure that manages TCP stream reassembly

Functions

func CleanupReassembly

func CleanupReassembly(_ bool, assemblers []*reassembly.Assembler)

CleanupReassembly finalizes all pools after packet workers have joined. The wait argument is retained for callers; even forced shutdown must drain data.

func CloseStreamReaderChannelsAndWait

func CloseStreamReaderChannelsAndWait()

CloseStreamReaderChannelsAndWait closes all TCP stream reader channels and waits for goroutines to finish. Call only after packet workers join and every assembler has been flushed. This MUST be called BEFORE closing log files to avoid write errors. CRITICAL: Each TCP connection spawns 2 goroutines (client + server) that run tcpStreamReader.Run() These goroutines must be properly shut down before log files are closed.

func CloseStreamReaderChannelsAndWaitQuiet

func CloseStreamReaderChannelsAndWaitQuiet()

CloseStreamReaderChannelsAndWaitQuiet is like CloseStreamReaderChannelsAndWait but doesn't log. Use this when log files may already be closed (e.g., between multi-file processing).

func ConfigureIncrementalState added in v0.16.0

func ConfigureIncrementalState(b *core.StateBudget, cancel func())

func ConfigureRetainedPayloadBudget added in v0.16.0

func ConfigureRetainedPayloadBudget(limit int64, cancel func()) error

ConfigureRetainedPayloadBudget must run before this capture creates stream readers.

func GetStreamPool

func GetStreamPool() *reassembly.StreamPool

GetStreamPool returns the stream pool.

func IncrementalError added in v0.16.0

func IncrementalError() error

func NumSavedTCPConns

func NumSavedTCPConns() int64

NumSavedTCPConns returns the number of saved TCP connections.

func PayloadRetentionError added in v0.16.0

func PayloadRetentionError() error

PayloadRetentionError preserves an abort cause until capture finalization resets the factory.

func ReassemblePacket

func ReassemblePacket(packet gopacket.Packet, assembler *reassembly.Assembler)

ReassemblePacket takes care of submitting a TCP / UDP packet to the reassembly. The caller owns the assembler and serializes assembly and maintenance.

func ResetStreamFactory

func ResetStreamFactory()

ResetStreamFactory clears state between captures, after all workers and readers join.

func SetLogger

func SetLogger(l *zap.Logger)

SetLogger sets the logger instance.

func WriteReassemblyHealth

func WriteReassemblyHealth() error

Types

type IncrementalHealth added in v0.16.0

type IncrementalHealth struct {
	Support               map[string]string `json:"support"`
	IncrementalStreams    uint64            `json:"incrementalStreams"`
	CompletedTransactions uint64            `json:"completedTransactions"`
	GapResets             uint64            `json:"gapResets"`
	DeferredTails         uint64            `json:"deferredTails"`
	CompletionOnly        map[string]uint64 `json:"completionOnlyBySelectedDecoder"`
}

func IncrementalHealthSnapshot added in v0.16.0

func IncrementalHealthSnapshot() IncrementalHealth

type PayloadRetentionHealth added in v0.16.0

type PayloadRetentionHealth struct {
	Scope         string `json:"scope"`
	Policy        string `json:"policy"`
	LimitBytes    int64  `json:"limitBytes"`
	RetainedBytes int64  `json:"retainedBytes"`
	PeakBytes     int64  `json:"peakBytes"`
	RejectedBytes int64  `json:"rejectedBytes"`
	Exceeded      bool   `json:"exceeded"`
}

PayloadRetentionHealth accounts for reader-owned TCP copies, not total process memory.

type ReassemblyHealth

type ReassemblyHealth struct {
	OverlapPackets        int64    `json:"overlapPackets"`
	OverlapBytes          int64    `json:"overlapBytes"`
	Version               int      `json:"version"`
	ChecksumPolicy        string   `json:"checksumPolicy"`
	RejectedChecksums     int64    `json:"rejectedChecksums"`
	RejectedIPv4Checksums int64    `json:"rejectedIPv4Checksums"`
	RejectedOptions       int64    `json:"rejectedOptions"`
	RejectedFSM           int64    `json:"rejectedFSM"`
	MissingBytes          int64    `json:"missingBytes"`
	Limitations           []string `json:"limitations"`

	RetainedPayload *PayloadRetentionHealth `json:"retainedPayload,omitempty"`
}

Jump to

Keyboard shortcuts

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