Documentation
¶
Index ¶
Constants ¶
View Source
const UnexpectedICMPType = -1 // Represents an unexpected ICMP type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hop ¶
type Hop struct {
TTL int // Time To Live value for this hop
Address string // IP address of the hop
Host string // Resolved hostname of the hop
Latency float64 // Latency in milliseconds to reach this hop
Reachable bool // Whether the hop was reachable based on ICMP
}
Type hop represents a single hop in a traceroute
type TraceResult ¶
type TraceResult struct {
Hops []Hop
}
TraceResult holds the hops collected during a trace
type Tracer ¶
type Tracer struct {
Address string // Trace target address
Port int // Destination port
StartTTL int // Starting TTL value
MaxTTL int // Maximum TTL value
Timeout time.Duration // Timeout for each hop
DNSLookup bool // Enable DNS host lookup for hop addresses
ResultChan chan Hop // Channel to send hop results asynchronously
}
Tracer struct holds configuration and result channel for asynchronous use
func New ¶
func New() *Tracer
New creates a new tracer instance with default settings and initialized result channel
func (*Tracer) Trace ¶
func (t *Tracer) Trace() (TraceResult, error)
Trace performs the traceroute operation and returns the collected hops both synchronously and via the ResultChan
Click to show internal directories.
Click to hide internal directories.