evidence

package
v0.16.6 Latest Latest
Warning

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

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

View Source
const AuditReadyFile = "audit-output-ready.json"
View Source
const MaxCommunityScopes = 32768

Variables

View Source
var ErrNoMatchingPackets = errors.New("no packets matched the requested selection")

Functions

This section is empty.

Types

type Capture

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

func NewCapture

func NewCapture(ctx context.Context, directory string, config CaptureConfig) (*Capture, error)

func (*Capture) Checkpoint

func (c *Capture) Checkpoint(admitted, drops uint64) error

func (*Capture) Close

func (c *Capture) Close(status string, admitted, drops uint64, captureError error) error

func (*Capture) Kernel

func (c *Capture) Kernel(received, dropped *uint64, statsError string)

func (*Capture) MarkAuditOutputReady

func (c *Capture) MarkAuditOutputReady() (resultErr error)

MarkAuditOutputReady is called only after stream finalization and writer teardown.

func (*Capture) Observe

func (c *Capture) Observe(data []byte, ci gopacket.CaptureInfo, linkType layers.LinkType) error

func (*Capture) ObserveScope

func (c *Capture) ObserveScope(cid string, iface int, vlans []uint16)

ObserveScope runs at serialized packet ingress, before worker ownership. A Community ID observed in multiple scopes never becomes unambiguous again.

func (*Capture) RunID added in v0.16.0

func (c *Capture) RunID() string

type CaptureConfig

type CaptureConfig struct {
	Source          string `json:"source"`
	Kind            string `json:"kind"`
	BPF             string `json:"bpf"`
	SnapLen         int    `json:"snapLen"`
	Workers         int    `json:"workers"`
	IncludeDecoders string `json:"includeDecoders"`
	ExcludeDecoders string `json:"excludeDecoders"`
	Reassembly      bool   `json:"reassembly"`
	RetainPackets   bool   `json:"retainPackets"`
	SegmentBytes    int64  `json:"segmentBytes,string"`
	RetentionBytes  int64  `json:"retentionBytes,string"`

	MaxRetainedTCPBytes        int64 `json:"maxRetainedTCPBytes,omitempty,string"`
	MaxRetainedReassemblyBytes int64 `json:"maxRetainedReassemblyBytes,omitempty,string"`
	IncrementalHTTP            bool  `json:"incrementalHTTP,omitempty"`
	MaxRetainedTCPStateBytes   int64 `json:"maxRetainedTCPStateBytes,omitempty,string"`
	CaptureTimeIdleExpiry      bool  `json:"captureTimeIdleExpiry,omitempty"`
}

type CaptureInspection added in v0.16.0

type CaptureInspection struct {
	Version          int         `json:"version"`
	SourceSHA256     string      `json:"sourceSHA256"`
	SourceBytes      string      `json:"sourceBytes"`
	Format           string      `json:"format"`
	Compression      string      `json:"compression"`
	Packets          uint64      `json:"packets,string"`
	CapturedBytes    uint64      `json:"capturedBytes,string"`
	WireBytes        uint64      `json:"wireBytes,string"`
	TruncatedPackets uint64      `json:"truncatedPackets,string"`
	FirstNs          string      `json:"firstNs,omitempty"`
	LastNs           string      `json:"lastNs,omitempty"`
	OutOfOrder       bool        `json:"outOfOrder"`
	Interfaces       []Interface `json:"interfaces"`
	Limitations      []string    `json:"limitations"`
}

func InspectCapture added in v0.16.0

func InspectCapture(ctx context.Context, path string, maxPackets int, maxBytes int64) (CaptureInspection, error)

type CaptureManifest

type CaptureManifest struct {
	Producer         *ProducerIdentity `json:"producer,omitempty"`
	CommunityScopes  *ScopeLedger      `json:"communityScopes,omitempty"`
	Version          int               `json:"version"`
	RunID            string            `json:"runId"`
	CreatedAt        string            `json:"createdAt"`
	Status           string            `json:"status"`
	Error            string            `json:"error,omitempty"`
	Config           CaptureConfig     `json:"config"`
	ConfigSHA256     string            `json:"configSHA256"`
	InputSHA256      string            `json:"inputSHA256,omitempty"`
	IngressPackets   uint64            `json:"ingressPackets"`
	AdmittedPackets  uint64            `json:"admittedPackets"`
	QueueDrops       uint64            `json:"queueDrops"`
	CapturedBytes    uint64            `json:"capturedBytes,string"`
	WireBytes        uint64            `json:"wireBytes,string"`
	TruncatedPackets uint64            `json:"truncatedPackets"`
	FirstNs          *int64            `json:"firstNs,omitempty,string"`
	LastNs           *int64            `json:"lastNs,omitempty,string"`
	KernelReceived   *uint64           `json:"kernelReceived"`
	KernelDrops      *uint64           `json:"kernelDrops"`
	KernelStatsError string            `json:"kernelStatsError,omitempty"`
	Segments         []CaptureSegment  `json:"segments"`
	Limitations      []string          `json:"limitations"`
}

type CaptureSegment

type CaptureSegment struct {
	Name         string `json:"name"`
	Bytes        int64  `json:"bytes,string"`
	Packets      uint64 `json:"packets"`
	FirstOrdinal uint64 `json:"firstOrdinal"`
	LastOrdinal  uint64 `json:"lastOrdinal"`
	FirstNs      string `json:"firstNs"`
	LastNs       string `json:"lastNs"`
	SHA256       string `json:"sha256"`
	State        string `json:"state"`
}

type CommunityScope

type CommunityScope struct {
	CommunityID string    `json:"communityId"`
	Scope       FlowScope `json:"scope"`
	Ambiguous   bool      `json:"ambiguous"`
}

type FlowScope

type FlowScope struct {
	Sensor         string   `json:"sensor"`
	InterfaceIndex int      `json:"interfaceIndex"`
	VLANs          []uint16 `json:"vlans"`
}

FlowScope is packet-derived scope within this capture's RunID namespace.

type Interface

type Interface struct {
	Section     int                `json:"section"`
	SourceIndex int                `json:"sourceIndex"`
	OutputIndex int                `json:"outputIndex"`
	Metadata    pcapgo.NgInterface `json:"metadata"`
}

type PacketManifest

type PacketManifest struct {
	Version                  int          `json:"version"`
	SourceSHA256             string       `json:"sourceSHA256"`
	OutputSHA256             string       `json:"outputSHA256"`
	OutputFormat             string       `json:"outputFormat"`
	Selection                Selection    `json:"selection"`
	SourcePackets            uint64       `json:"sourcePackets"`
	Selected                 uint64       `json:"selectedPackets"`
	PacketSpans              []PacketSpan `json:"sourcePacketSpans"`
	Interfaces               []Interface  `json:"interfaces"`
	Limitations              []string     `json:"limitations"`
	SourceTruncatedPackets   uint64       `json:"sourceTruncatedPackets"`
	SelectedTruncatedPackets uint64       `json:"selectedTruncatedPackets"`
	MaxCapturedPacketBytes   int          `json:"maxCapturedPacketBytes"`
	MaxCaptureBlockBytes     int          `json:"maxCaptureBlockBytes"`
}

func ArchiveToFile

func ArchiveToFile(ctx context.Context, input, target string, selection Selection) (PacketManifest, error)

ArchiveToFile atomically publishes a complete archive without replacing existing work.

func ExportPackets

func ExportPackets(ctx context.Context, input string, output io.Writer, selection Selection) (PacketManifest, error)

ExportPackets writes a PCAPNG derivative and hashes the actual input/output bytes. Callers must discard output on any error; no partial export is evidence-qualified.

func WriteArchive

func WriteArchive(ctx context.Context, input string, output io.Writer, selection Selection) (PacketManifest, error)

type PacketSpan

type PacketSpan struct {
	First uint64 `json:"first"`
	Last  uint64 `json:"last"`
}

type ProducerIdentity added in v0.16.0

type ProducerIdentity struct {
	GoMemoryLimitBytes int64  `json:"goMemoryLimitBytes,omitempty,string"`
	Version            string `json:"version"`
	Commit             string `json:"commit"`
	GoVersion          string `json:"goVersion"`
	Platform           string `json:"platform"`
	ExecutableModule   string `json:"executableModule,omitempty"`
	ExecutableRevision string `json:"executableRevision,omitempty"`
	ExecutableModified *bool  `json:"executableModified,omitempty"`
	CoreModuleVersion  string `json:"coreModuleVersion,omitempty"`
	CoreModuleReplaced bool   `json:"coreModuleReplaced,omitempty"`
}

func CurrentProducerIdentity added in v0.16.0

func CurrentProducerIdentity() *ProducerIdentity

type ScopeLedger

type ScopeLedger struct {
	Schema   int              `json:"schema"`
	Complete bool             `json:"complete"`
	Overflow uint64           `json:"overflow"`
	Entries  []CommunityScope `json:"entries"`
}

type Selection

type Selection struct {
	BPF        string `json:"bpf"`
	StartNs    *int64 `json:"startNs,omitempty,string"`
	EndNs      *int64 `json:"endNs,omitempty,string"`
	MaxPackets int    `json:"maxPackets"`
}

Selection uses an inclusive capture-time window. It does not identify a TCP incarnation.

Jump to

Keyboard shortcuts

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