evidence

package
v0.16.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 31 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 AuditStagesFile = "audit-output-stages.json"
View Source
const MaxCommunityScopes = 32768
View Source
const SourceOffsetNamespace = "decompressed-input-bytes"

Variables

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

Functions

func OpenAuditStageContext added in v0.16.11

func OpenAuditStageContext(ctx context.Context, directory, runID, recordType, generation string) (AuditStage, AuditStages, *os.File, error)

OpenAuditStageContext verifies a stage and returns its rewound protobuf file. The caller closes the file. A sealed empty stage returns no file.

func ReadAuditStage added in v0.16.11

func ReadAuditStage(directory, runID, recordType, generation string) (stage AuditStage, snapshot AuditStages, resultErr error)

func ReadAuditStageContext added in v0.16.11

func ReadAuditStageContext(ctx context.Context, directory, runID, recordType, generation string) (stage AuditStage, snapshot AuditStages, resultErr error)

Types

type AuditStage added in v0.16.11

type AuditStage struct {
	Type     string            `json:"type"`
	Stage    string            `json:"stage"`
	State    string            `json:"state"`
	Coverage string            `json:"coverage"`
	Reason   string            `json:"reason,omitempty"`
	Records  int64             `json:"records,string"`
	Files    []SealedAuditFile `json:"files"`
}

type AuditStages added in v0.16.11

type AuditStages struct {
	Version     int          `json:"version"`
	RunID       string       `json:"runId"`
	Generation  string       `json:"generation"`
	InputSHA256 string       `json:"inputSHA256,omitempty"`
	Stages      []AuditStage `json:"stages"`
}

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) CoverageError added in v0.16.11

func (c *Capture) CoverageError(err 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) ObserveSource added in v0.16.11

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

func (*Capture) RunID added in v0.16.0

func (c *Capture) RunID() string

func (*Capture) SealAuditStages added in v0.16.11

func (c *Capture) SealAuditStages(stages []AuditStage) (resultErr error)

SealAuditStages publishes immutable per-type writer results after every producer stops.

func (*Capture) SourceRecords added in v0.16.11

func (c *Capture) SourceRecords(total uint64)

type CaptureConfig

type CaptureConfig struct {
	Enrichment          *enrichment.Snapshot `json:"enrichment,omitempty"`
	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"`
	DefragIPv4          bool                 `json:"defragIPv4"`
	MergePCAPNGSections bool                 `json:"mergePCAPNGSections"`
	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"`
	LocalReassemblyPageLoss    bool  `json:"localReassemblyPageLoss,omitempty"`
	LocalRetainedPayloadLoss   bool  `json:"localRetainedPayloadLoss,omitempty"`
	LocalCompletionStateLoss   bool  `json:"localCompletionStateLoss,omitempty"`
	IncrementalHTTP            bool  `json:"incrementalHTTP,omitempty"`
	MaxRetainedTCPStateBytes   int64 `json:"maxRetainedTCPStateBytes,omitempty,string"`
	MaxAggregateStateBytes     int64 `json:"maxAggregateStateBytes,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 {
	OrdinalNamespaces     map[string]string `json:"ordinalNamespaces"`
	SourcePacketRecords   uint64            `json:"sourcePacketRecords,string"`
	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"`
	CoverageError         string            `json:"coverageError,omitempty"`
	AuditStagesGeneration string            `json:"auditStagesGeneration,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 SealedAuditFile added in v0.16.11

type SealedAuditFile struct {
	Name   string `json:"name"`
	Size   int64  `json:"size,string"`
	SHA256 string `json:"sha256"`
}

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.

type SourcePacket added in v0.16.11

type SourcePacket struct {
	Ordinal           uint64 `json:"ordinal,string"`
	Offset            int64  `json:"offset,omitempty,string"`
	OffsetNamespace   string `json:"offsetNamespace,omitempty"`
	OffsetKind        string `json:"offsetKind,omitempty"`
	Section           uint64 `json:"section,omitempty"`
	Interface         uint32 `json:"interface,omitempty"`
	ByteOrder         string `json:"byteOrder,omitempty"`
	TimestampEncoding string `json:"timestampEncoding,omitempty"`
	TimestampSeconds  uint64 `json:"timestampSeconds,omitempty,string"`
	TimestampFraction uint32 `json:"timestampFraction,omitempty"`
	TimestampTicks    uint64 `json:"timestampTicks,omitempty,string"`
	TimestampUnits    uint64 `json:"timestampUnits,omitempty,string"`
	TimestampOffset   int64  `json:"timestampOffset,omitempty,string"`
	SHA256            string `json:"packetSHA256,omitempty"`
}

Jump to

Keyboard shortcuts

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