reftraffictranscript

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "ref-traffic-transcript"

ID is the YAML id for the traffic proof feature.

Variables

This section is empty.

Functions

func BundleForTest

func BundleForTest(cfg Config) (traffic.PortBundle, *Transcript, *RawLog)

BundleForTest builds a traffic.PortBundle for unit tests: fresh Transcript, [PatternRedactor], and RawLog.

func NewPatternRedactor

func NewPatternRedactor(cfg Config) traffic.Redactor

NewPatternRedactor removes configured substrings on the observation path.

Types

type Config

type Config struct {
	// RedactSubstrings are removed from observer path bodies (in order). Empty uses default.
	RedactSubstrings []string `yaml:"redact_substrings"`
	Order            *int     `yaml:"order"`
}

Config for redaction pattern and default ordering.

func DecodeConfig

func DecodeConfig(n yaml.Node) (Config, error)

DecodeConfig parses the feature YAML.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default settings (for tests and smoke checks).

type RawLog

type RawLog struct {
	Rows []RawRow
	// contains filtered or unexported fields
}

RawLog records privileged verbatim payloads (unredacted).

func NewRawLog

func NewRawLog() *RawLog

NewRawLog returns a raw capture sink.

func (*RawLog) WriteRaw

func (r *RawLog) WriteRaw(_ context.Context, leg traffic.Leg, meta traffic.CaptureMeta, payload []byte) error

type RawRow

type RawRow struct {
	Leg   traffic.Leg
	Bytes []byte
	Meta  traffic.CaptureMeta
}

RawRow is a raw capture line.

type Row

type Row struct {
	Leg         traffic.Leg
	Body        []byte
	At          time.Time
	Trace       string
	Redact      bool
	AttemptSeq  int
	BLegID      string
	BackendID   string
	FrontendID  string
	SessionID   string
	PrincipalID string
}

Row is one observed sample after redaction.

type Transcript

type Transcript struct {
	Rows []Row
	// contains filtered or unexported fields
}

Transcript records structured observations (redacted path) for tests and diagnostics.

func NewTranscript

func NewTranscript() *Transcript

NewTranscript returns an empty transcript buffer.

func (*Transcript) OnObservation

func (t *Transcript) OnObservation(_ context.Context, ev traffic.Observation) error

type UsageLedger

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

UsageLedger records usage.Event observations for proof tests (attempt lineage fields preserved).

func NewUsageLedger

func NewUsageLedger() *UsageLedger

NewUsageLedger returns an empty ledger.

func (*UsageLedger) EventsSnapshot

func (u *UsageLedger) EventsSnapshot() []usage.Event

EventsSnapshot returns a defensive copy of recorded events (may be empty).

func (*UsageLedger) OnUsage

func (u *UsageLedger) OnUsage(_ context.Context, ev usage.Event) error

OnUsage implements usage.Observer.

Jump to

Keyboard shortcuts

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