Documentation ¶
Overview ¶
Package traceroute provides functions for executing a tracroute to a remote host.
Index ¶
- Constants
- type Hop
- type Options
- func (options *Options) FirstHop() int
- func (options *Options) MaxHops() int
- func (options *Options) PacketSize() int
- func (options *Options) Port() int
- func (options *Options) Retries() int
- func (options *Options) SetFirstHop(firstHop int)
- func (options *Options) SetMaxHops(maxHops int)
- func (options *Options) SetPacketSize(packetSize int)
- func (options *Options) SetPort(port int)
- func (options *Options) SetRetries(retries int)
- func (options *Options) SetTimeoutMs(timeoutMs int)
- func (options *Options) TimeoutMs() int
- type Result
Constants ¶
const ( // DefaultPort is the default local src port (33434) DefaultPort = 33434 // DefaultMaxHops is the default int of max hops (64) DefaultMaxHops = 64 // DefaultFirstHop is the default first hop (1) DefaultFirstHop = 1 // DefaultTimeoutMs is the default timeout in ms DefaultTimeoutMs = 500 // DefaultRetries is the default number of times to retry DefaultRetries = 3 // DefaultPacketSize is the default packet size DefaultPacketSize = 52 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hop ¶
type Hop struct { Success bool Address [4]byte Host string N int ElapsedTime time.Duration TTL int }
Hop type
func (*Hop) AddressString ¶
AddressString returns a hop address as a string
func (*Hop) HostOrAddressString ¶
HostOrAddressString returns a hostname or address string
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is the struct for options
func (*Options) PacketSize ¶
PacketSize sets the packet size
func (*Options) SetFirstHop ¶
SetFirstHop also sets the first hop to track
func (*Options) SetMaxHops ¶
SetMaxHops also sets the number of max hops
func (*Options) SetPacketSize ¶
SetPacketSize also sets the packet size
func (*Options) SetRetries ¶
SetRetries also sets the number of retries
func (*Options) SetTimeoutMs ¶
SetTimeoutMs also sets the default timeout in ms
type Result ¶
Result is a traceroute result struct
func Traceroute ¶
Traceroute uses the given dest (hostname) and options to execute a traceroute from your machine to the remote host.
Outbound packets are UDP packets and inbound packets are ICMP.
Returns a Result which contains an array of hops. Each hop includes the elapsed time and its IP address.