Documentation
¶
Index ¶
- Constants
- Variables
- func OpenAuditStageContext(ctx context.Context, directory, runID, recordType, generation string) (AuditStage, AuditStages, *os.File, error)
- func ReadAuditStage(directory, runID, recordType, generation string) (stage AuditStage, snapshot AuditStages, resultErr error)
- func ReadAuditStageContext(ctx context.Context, directory, runID, recordType, generation string) (stage AuditStage, snapshot AuditStages, resultErr error)
- type AuditStage
- type AuditStages
- type Capture
- func (c *Capture) Checkpoint(admitted, drops uint64) error
- func (c *Capture) Close(status string, admitted, drops uint64, captureError error) error
- func (c *Capture) CoverageError(err error)
- func (c *Capture) Kernel(received, dropped *uint64, statsError string)
- func (c *Capture) MarkAuditOutputReady() (resultErr error)
- func (c *Capture) Observe(data []byte, ci gopacket.CaptureInfo, linkType layers.LinkType) error
- func (c *Capture) ObserveScope(cid string, iface int, vlans []uint16)
- func (c *Capture) ObserveSource(data []byte, ci gopacket.CaptureInfo, linkType layers.LinkType, ...) error
- func (c *Capture) RunID() string
- func (c *Capture) SealAuditStages(stages []AuditStage) (resultErr error)
- func (c *Capture) SourceRecords(total uint64)
- type CaptureConfig
- type CaptureInspection
- type CaptureManifest
- type CaptureSegment
- type CommunityScope
- type FlowScope
- type Interface
- type PacketManifest
- func ArchiveToFile(ctx context.Context, input, target string, selection Selection) (PacketManifest, error)
- func ExportPackets(ctx context.Context, input string, output io.Writer, selection Selection) (PacketManifest, error)
- func WriteArchive(ctx context.Context, input string, output io.Writer, selection Selection) (PacketManifest, error)
- type PacketSpan
- type ProducerIdentity
- type ScopeLedger
- type SealedAuditFile
- type Selection
- type SourcePacket
Constants ¶
const AuditReadyFile = "audit-output-ready.json"
const AuditStagesFile = "audit-output-stages.json"
const MaxCommunityScopes = 32768
const SourceOffsetNamespace = "decompressed-input-bytes"
Variables ¶
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 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 (*Capture) Checkpoint ¶
func (*Capture) CoverageError ¶ added in v0.16.11
func (*Capture) MarkAuditOutputReady ¶
MarkAuditOutputReady is called only after stream finalization and writer teardown.
func (*Capture) ObserveScope ¶
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) 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
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
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 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 ¶
type PacketSpan ¶
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 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"`
}