Documentation
¶
Overview ¶
Package mtrsession stores explicitly recorded MTR sessions for offline replay.
Index ¶
Constants ¶
const ( FormatName = "nexttrace-mtr-session" SchemaVersion = 1 // MaxLineBytes includes the terminating newline written by Writer. MaxLineBytes = 1 << 20 StartEvent = "start" EndEvent = "end" )
Variables ¶
var ( ErrLineTooLarge = errors.New("MTR session record exceeds 1 MiB") ErrClosed = errors.New("MTR session file is closed") )
Functions ¶
This section is empty.
Types ¶
type DisplayParameters ¶
type Parameters ¶
type Parameters struct {
FWMark *uint32 `json:"fwmark,omitempty"`
MaxPerHop int `json:"max_per_hop"`
HopIntervalMs int `json:"hop_interval_ms"`
TimeoutMs int64 `json:"timeout_ms"`
BeginHop int `json:"begin_hop"`
MaxHops int `json:"max_hops"`
ParallelRequests int `json:"parallel_requests"`
SourceAddress string `json:"source_address"`
SourceDevice string `json:"source_device,omitempty"`
SourcePort *int `json:"source_port,omitempty"`
Port *int `json:"port,omitempty"`
PacketSize int `json:"packet_size"`
RandomPacketSize bool `json:"random_packet_size"`
TOS int `json:"tos"`
ICMPMode *int `json:"icmp_mode,omitempty"`
DataProvider string `json:"data_provider"`
Language string `json:"language"`
DotServer string `json:"dot_server,omitempty"`
RDNS bool `json:"rdns"`
AlwaysWaitRDNS bool `json:"always_wait_rdns"`
DisableMPLS bool `json:"disable_mpls"`
DN42 bool `json:"dn42"`
}
Parameters contains effective probe settings, never provider credentials.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader holds an open regular file and a fixed byte limit. New data appended while replaying is not followed, including after Rewind.
func OpenReader ¶
func (*Reader) Incomplete ¶
func (*Reader) Next ¶
Next returns io.EOF at the fixed end, including a recoverable partial tail. Call Incomplete after EOF to distinguish a complete session from a prefix. Invalid complete records are errors and are never silently skipped.
type Record ¶
type Record struct {
Format string `json:"format"`
SchemaVersion int `json:"schema_version"`
Seq uint64 `json:"seq"`
ElapsedNS int64 `json:"elapsed_ns"`
Timestamp time.Time `json:"timestamp"`
ProbeAgeNS *int64 `json:"probe_age_ns,omitempty"`
trace.MTRSessionEvent
Session *Session `json:"session,omitempty"`
End *End `json:"end,omitempty"`
}
Record keeps event occurrence time separate from the ordered playback clock. Sequence and ElapsedNS are monotonic, even if the wall clock moves backwards.
type Session ¶
type Session struct {
Version string `json:"version"`
Target string `json:"target"`
ResolvedIP string `json:"resolved_ip"`
Protocol string `json:"protocol"`
StartedAt time.Time `json:"started_at"`
EffectiveParameters *Parameters `json:"effective_parameters"`
SourceHost string `json:"source_host"`
SourceIP string `json:"source_ip,omitempty"`
Display DisplayParameters `json:"display"`
}
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes each complete event before returning. Finish syncs and closes the file. A failed write is sticky: later calls never append to a bad tail.
func Open ¶
Open exclusively creates a private file. Existing files, including symlinks, are never overwritten or appended to.