Documentation ¶
Overview ¶
Package traceroute provides functions for executing a tracroute to a remote host.
Index ¶
- Constants
- type TracerouteHop
- type TracerouteOptions
- func (options *TracerouteOptions) FirstHop() int
- func (options *TracerouteOptions) MaxHops() int
- func (options *TracerouteOptions) PacketSize() int
- func (options *TracerouteOptions) Port() int
- func (options *TracerouteOptions) Retries() int
- func (options *TracerouteOptions) SetFirstHop(firstHop int)
- func (options *TracerouteOptions) SetMaxHops(maxHops int)
- func (options *TracerouteOptions) SetPacketSize(packetSize int)
- func (options *TracerouteOptions) SetPort(port int)
- func (options *TracerouteOptions) SetRetries(retries int)
- func (options *TracerouteOptions) SetTimeoutMs(timeoutMs int)
- func (options *TracerouteOptions) TimeoutMs() int
- type TracerouteResult
Constants ¶
View Source
const DEFAULT_FIRST_HOP = 1
View Source
const DEFAULT_MAX_HOPS = 64
View Source
const DEFAULT_PACKET_SIZE = 52
View Source
const DEFAULT_PORT = 33434
View Source
const DEFAULT_RETRIES = 3
View Source
const DEFAULT_TIMEOUT_MS = 500
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TracerouteHop ¶
type TracerouteHop struct { Success bool Address [4]byte Host string N int ElapsedTime time.Duration TTL int }
TracerouteHop type
func (*TracerouteHop) AddressString ¶
func (hop *TracerouteHop) AddressString() string
func (*TracerouteHop) HostOrAddressString ¶
func (hop *TracerouteHop) HostOrAddressString() string
type TracerouteOptions ¶
type TracerouteOptions struct {
// contains filtered or unexported fields
}
TracrouteOptions type
func (*TracerouteOptions) FirstHop ¶
func (options *TracerouteOptions) FirstHop() int
func (*TracerouteOptions) MaxHops ¶
func (options *TracerouteOptions) MaxHops() int
func (*TracerouteOptions) PacketSize ¶
func (options *TracerouteOptions) PacketSize() int
func (*TracerouteOptions) Port ¶
func (options *TracerouteOptions) Port() int
func (*TracerouteOptions) Retries ¶
func (options *TracerouteOptions) Retries() int
func (*TracerouteOptions) SetFirstHop ¶
func (options *TracerouteOptions) SetFirstHop(firstHop int)
func (*TracerouteOptions) SetMaxHops ¶
func (options *TracerouteOptions) SetMaxHops(maxHops int)
func (*TracerouteOptions) SetPacketSize ¶
func (options *TracerouteOptions) SetPacketSize(packetSize int)
func (*TracerouteOptions) SetPort ¶
func (options *TracerouteOptions) SetPort(port int)
func (*TracerouteOptions) SetRetries ¶
func (options *TracerouteOptions) SetRetries(retries int)
func (*TracerouteOptions) SetTimeoutMs ¶
func (options *TracerouteOptions) SetTimeoutMs(timeoutMs int)
func (*TracerouteOptions) TimeoutMs ¶
func (options *TracerouteOptions) TimeoutMs() int
type TracerouteResult ¶
type TracerouteResult struct { DestinationAddress [4]byte Hops []TracerouteHop }
TracerouteResult type
func Traceroute ¶
func Traceroute(dest string, options *TracerouteOptions, c ...chan TracerouteHop) (result TracerouteResult, err error)
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 TracerouteResult which contains an array of hops. Each hop includes the elapsed time and its IP address.
Click to show internal directories.
Click to hide internal directories.