tracer

package
v1.0.0-...-8cd2109 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	DestinationPort:      33434,
	MaxHops:              30,
	NumProbes:            3,
	ProbeMaxWaitDuration: 500 * time.Millisecond,
	PacketLength:         60,
}

Default options for the Tracer

Functions

This section is empty.

Types

type Options

type Options struct {
	// "Unlikely" destination port to use when tracing.
	DestinationPort uint16

	// Specifies the maximum number of hops (max time-to-live) the
	// Tracer will probe.
	MaxHops int

	// Specifies the number of probes to send per hop.
	NumProbes uint

	// Specifies how long to wait for a response to a probe.
	ProbeMaxWaitDuration time.Duration

	// PacketLength represents the size of the probe packets
	PacketLength int
}

Options provide configuration settings for the Tracer.

type Probe

type Probe struct {
	// Start time of the probe
	Start time.Time

	// End time of the probe
	End time.Time

	// IP of the discovered hop
	Hop net.IP

	// TTL of the probe
	TTL int

	// Error provides the error which may have occurred during
	// tracing
	Error error
}

Probe represents a trace probe

type SockExtendedErrorOrigin

type SockExtendedErrorOrigin uint8

See https://github.com/torvalds/linux/blob/master/include/uapi/linux/errqueue.h#L28

const (
	SockExtendedErrorOriginNone SockExtendedErrorOrigin = iota
	SockExtendedErrorOriginLocal
	SockExtendedErrorOriginICMP
	SockExtendedErrorOriginICMP6
	SockExtendedErrorOriginTxStatus
	SockExtendedErrorOriginZeroCopy
	SockExtendedErrorOriginTxTime
	SockExtendedErrorOriginTimestamp = SockExtendedErrorOriginTxStatus
)

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer implements the traditional, ancient method of tracerouting, which uses probes as UDP datagram packets and an "unlikely" destination port.

func New

func New(opts *Options) *Tracer

New creates a new Tracer with the given options.

func (*Tracer) Trace

func (t *Tracer) Trace(ctx context.Context, dest net.IP) <-chan Probe

Trace traces the hops between us and the destination.

Jump to

Keyboard shortcuts

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