model

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol string

Protocol represents the application-layer protocol detected on a TCP stream.

const (
	ProtoHTTP1 Protocol = "http1"
	ProtoHTTP2 Protocol = "http2"
	ProtoGRPC  Protocol = "grpc"
)

type Record

type Record struct {
	Timestamp  time.Time `json:"ts"`
	Proto      Protocol  `json:"proto"`
	SrcIP      string    `json:"src_ip"`
	DstIP      string    `json:"dst_ip"`
	Method     string    `json:"method"`
	Path       string    `json:"path"`
	Status     int       `json:"status"`
	GRPCStatus string    `json:"grpc_status,omitempty"`
	DurationMs float64   `json:"duration_ms"`
	TraceID    string    `json:"trace_id,omitempty"`

	// SrcName and DstName are resolved by the CLI, not set by trcd.
	SrcName string `json:"src_name,omitempty"`
	DstName string `json:"dst_name,omitempty"`
}

Record is a single request/response pair captured from the network. trcd emits these as NDJSON; the CLI reads and enriches them with service names.

func (Record) MarshalNDJSON

func (r Record) MarshalNDJSON() ([]byte, error)

MarshalNDJSON encodes r as a single JSON line followed by a newline.

func (*Record) UnmarshalNDJSON

func (r *Record) UnmarshalNDJSON(line []byte) error

UnmarshalNDJSON decodes a single JSON line into r.

Jump to

Keyboard shortcuts

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