shared

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePathHashFromHops

func CalculatePathHashFromHops(hops []*HopRun, algorithm string) string

CalculatePathHashFromHops computes a hash from a slice of HopRun structs

func CalculatePathHashFromProbe

func CalculatePathHashFromProbe(probe *ProbeStats, algorithm string) string

CalculatePathHashFromProbe computes a hash from a ProbeStats struct

Types

type HopIPStats

type HopIPStats struct {
	Min        int64   `json:"min"`         // RTT in microseconds
	Max        int64   `json:"max"`         // RTT in microseconds
	Avg        int64   `json:"avg"`         // RTT in microseconds
	Last       int64   `json:"last"`        // Last RTT in microseconds
	StdDev     float64 `json:"stddev"`      // RTT standard deviation in microseconds
	Lost       uint    `json:"lost"`        // Number of timeouts/losses
	LossPct    float64 `json:"loss_pct"`    // Percentage loss
	Responses  uint    `json:"responses"`   // Number of responses
	Sum        int64   `json:"sum"`         // Sum of RTTs for calculating average
	SumSquares int64   `json:"sum_squares"` // Sum of squares for stddev calculation
	PTR        string  `json:"ptr"`         // PTR record for this IP
}

Holds stats for a single IP at a given hop

type HopRun

type HopRun struct {
	TTL      uint8     `json:"ttl"`
	IP       string    `json:"ip"`        // IP that responded (empty if timeout)
	RTT      int64     `json:"rtt"`       // RTT in microseconds (0 if timeout)
	Timeout  bool      `json:"timeout"`   // Whether this hop timed out
	PTR      string    `json:"ptr"`       // PTR record for this IP
	RecvTime time.Time `json:"recv_time"` // When response was received
}

HopRun represents the result for a single TTL in one probe run

type HopStats

type HopStats struct {
	IPs       map[string]*HopIPStats `json:"ips"`        // IP string -> stats
	CurrentIP string                 `json:"current_ip"` // Most recent IP seen at this hop
	Sent      uint                   `json:"sent"`       // Number of probes sent at this TTL
	Received  uint                   `json:"received"`   // Number of probes received at this TTL
	Lost      uint                   `json:"lost"`       // Number of probes lost at this TTL
	LossPct   float64                `json:"loss_pct"`   // Percentage loss at this TTL
}

Holds stats for a single hop (TTL)

type OutputInfo

type OutputInfo struct {
	Destination    string
	Protocol       string
	SrcPort        uint16
	DstPort        uint16
	ParallelProbes uint16
	HashAlgorithm  string
}

Holds general output information

type ProbeRun

type ProbeRun struct {
	ProbeID         uint16    `json:"probe_id"`
	ProbeNum        uint      `json:"probe_num"`        // Which iteration (0, 1, 2, ...)
	PathHash        string    `json:"path_hash"`        // Hash of the path taken
	SourceIP        string    `json:"source_ip"`        // Source IP address
	SourcePort      uint16    `json:"source_port"`      // Source port
	DestinationIP   string    `json:"destination_ip"`   // Destination IP address
	DestinationPort uint16    `json:"destination_port"` // Destination port
	DestinationPTR  string    `json:"destination_ptr"`  // PTR record for destination
	Protocol        string    `json:"protocol"`         // Protocol (TCP/UDP)
	ReachedDest     bool      `json:"reached_dest"`     // Whether destination was reached
	Hops            []*HopRun `json:"hops"`             // Hops sorted by TTL
	Timestamp       time.Time `json:"timestamp"`
}

ProbeRun represents a single TTL iteration for one probe

type ProbeStats

type ProbeStats struct {
	ProbeID uint16              `json:"probe_id"`
	Hops    map[uint8]*HopStats `json:"hops"` // TTL -> hop stats
}

Holds stats for a single probe instance

Jump to

Keyboard shortcuts

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