forked from vaegt/go-traceroute
/
tracedata.go
28 lines (25 loc) · 922 Bytes
/
tracedata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package traceroute
import (
"net"
"time"
)
// TraceData represents data received by executing traceroute.
type TraceData struct {
Hops [][]Hop `json:"hops,omitempty"`
Dest net.IP `json:"dest,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Tries int `json:"tries,omitempty"`
MaxTTL int `json:"max_ttl,omitempty"`
Port int `json:"port,omitempty"`
Proto string `json:"proto,omitempty"`
IPv string `json:"i_pv,omitempty"`
}
// Hop represents a path between a source and a destination.
type Hop struct {
TryNumber int `json:"try_numberomitempty"`
TTL int `json:"ttl,omitempty"`
AddrIP net.IP `json:"addr_ip,omitempty"`
AddrDNS []string `json:"addr_dns,omitempty"` //net.IPAddr
Latency time.Duration `json:"latency,omitempty"`
Err error `json:"err,omitempty"`
}