capture

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config, w io.Writer) error

Run opens a live packet capture on the configured interface and emits parsed HTTP/gRPC records as NDJSON to w. It blocks until ctx is cancelled.

Types

type Config

type Config struct {
	Interface string
	BPFFilter string
	SnapLen   int32
}

Config holds the settings for a capture session.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

type Emitter

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

Emitter writes Records as NDJSON to an io.Writer. It is safe for concurrent use.

func NewEmitter

func NewEmitter(w io.Writer) *Emitter

NewEmitter creates an Emitter that writes to w.

func (*Emitter) Emit

func (e *Emitter) Emit(r model.Record) error

Emit serializes r as a single JSON line.

Jump to

Keyboard shortcuts

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