evidencelink

package
v0.15.4 Latest Latest
Warning

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

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

Overview

Package evidencelink links audit records across protocols: records of one connection (Community ID within the connection's time span), the DNS answer that resolved a connection's destination, connections opened to resolved addresses, and alerts raised on any of them.

Links are computed from an output directory at query time. The result does not depend on worker count or record emission order, only on record content.

Index

Constants

View Source
const (
	KindSameConnection     = "same-connection"
	KindSameFlow           = "same-flow"
	KindAlert              = "alert"
	KindDNSResolution      = "dns-resolution"
	KindResolvedConnection = "resolved-connection"
)

Link kinds.

View Source
const (
	BasisCommunityIDSpan   = "community-id-in-connection-span"
	BasisCommunityIDWindow = "community-id-within-window"
	BasisAnswerBefore      = "dns-answer-before-connection"
	BasisConnectionAfter   = "connection-after-dns-answer"
)

Link bases: how a link was established.

View Source
const IndexBudget uint64 = 64 << 20

IndexBudget bounds accounted storage for records, summaries and join keys.

View Source
const Schema = 1

Schema is the version of the Result JSON contract.

Variables

View Source
var ErrNotFound = errors.New("record is not indexed: missing, beyond limits or without a Community ID")

ErrNotFound reports a reference that is not an indexed, joinable record.

View Source
var PacketTypes = map[string]bool{"TCP": true, "TLSRecord": true, "PacketContext": true, "PKTAP": true}

PacketTypes are per-packet records; linking them would list every packet of a connection, so they are not indexed.

Functions

func Joinable

func Joinable(id string) bool

Joinable reports whether a Community ID is a computed v1 value; fallback identifiers (connection hashes without a Community ID) never join.

Types

type Config

type Config struct {
	Enabled    bool  `json:"enabled"`
	WindowNS   int64 `json:"windowNs"`
	MaxRecords int64 `json:"maxRecords"`
	MaxLinks   int   `json:"maxLinks"`
}

Config bounds index construction and query results.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig: one hour join window, 1,000,000 indexed records, 500 links.

func (Config) Validate

func (c Config) Validate() error

Validate rejects unbounded or nonsensical limits.

type Field

type Field struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Field is one summary value, rendered as text.

func Summarize

func Summarize(typ string, record any) []Field

Summarize renders the identifying fields of a record for display.

type Index

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

Index holds the joinable records of one output directory.

func Build

func Build(dir string, config Config) (*Index, error)

Build indexes every audit file in dir, in file-name order.

func (*Index) Related

func (idx *Index) Related(typ string, ordinal int64) (*Result, error)

Related returns the records linked to type/ordinal.

func (*Index) Resolve

func (idx *Index) Resolve(sel Selector) (string, int64, error)

Resolve returns the type and ordinal of the selected record.

type Link struct {
	Kind   string `json:"kind"`
	Basis  string `json:"basis"`
	Record Record `json:"record"`
}

Link is one related record and how it was found.

type Record

type Record struct {
	Scope       *evidence.FlowScope `json:"scope,omitempty"`
	ID          string              `json:"id"`
	FileSHA256  string              `json:"fileSha256"`
	Type        string              `json:"type"`
	Ordinal     int64               `json:"ordinal"`
	Timestamp   int64               `json:"timestamp"`
	CommunityID string              `json:"communityId,omitempty"`
	Summary     []Field             `json:"summary,omitempty"`
}

Record identifies an audit record by file type and position.

type Result

type Result struct {
	ManifestSHA256 string   `json:"captureManifestSha256,omitempty"`
	CaptureID      string   `json:"captureId,omitempty"`
	ScopeStatus    string   `json:"scopeStatus"`
	Schema         int      `json:"schema"`
	Target         Record   `json:"target"`
	Session        *Session `json:"session"`
	Links          []Link   `json:"links"`
	Truncated      bool     `json:"truncated"`
	Indexed        int64    `json:"indexed"`
	Limits         Config   `json:"limits"`
	Notes          []string `json:"notes"`
}

Result is the API and CLI response.

type Selector

type Selector struct {
	ID            string
	Type          string
	Ordinal       int64
	HasOrdinal    bool
	ObservationID string
	CommunityID   string
	Time          int64
	HasTime       bool
}

Selector identifies the target record: Type+Ordinal, ObservationID (the latest snapshot of a Connection observation), or Type+CommunityID+Time (exactly one record of that type with that timestamp; ambiguous matches fail).

type Session

type Session struct {
	Scope         *evidence.FlowScope `json:"scope,omitempty"`
	ObservationID string              `json:"observationId,omitempty"`
	CommunityID   string              `json:"communityId"`
	First         int64               `json:"first"`
	Last          int64               `json:"last"`
	SrcIP         string              `json:"srcIp"`
	SrcPort       string              `json:"srcPort"`
	DstIP         string              `json:"dstIp"`
	DstPort       string              `json:"dstPort"`
	Ordinal       int64               `json:"ordinal"`
	// contains filtered or unexported fields
}

Session is the connection observation that scopes Community ID links.

Jump to

Keyboard shortcuts

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