traceroute

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package traceroute implements tracerouting based on SCMP traceroute messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Dispatcher  reliable.Dispatcher
	Local       *snet.UDPAddr
	MTU         uint16
	PathEntry   snet.Path
	PayloadSize uint
	Remote      *snet.UDPAddr
	Timeout     time.Duration

	// ProbesPerHop indicates how many probes should be done per hop.
	ProbesPerHop int
	// ErrHandler is invoked for every error that does not cause tracerouting to
	// abort. Execution time must be small, as it is run synchronously.
	ErrHandler func(error)
	// Update handler is invoked for every hop. Execution time must be
	// small, as it is run synchronously.
	UpdateHandler func(Update)
}

Config configures the traceroute run.

type Stats

type Stats struct {
	Sent, Recv uint
}

Stats contains the amount of sent and received packets.

func Run

func Run(ctx context.Context, cfg Config) (Stats, error)

Run runs the traceroute.

type Update

type Update struct {
	// Index indicates the hop index in the path.
	Index int
	// Remote is the remote router.
	Remote *snet.UDPAddr
	// Interface is the interface ID of the remote router.
	Interface uint64
	// RTTs are the RTTs for this hop. To detect whether there was a timeout the
	// value of the RTT can be compared against the timeout value from the
	// configuration.
	RTTs []time.Duration
}

Update contains the information for a single hop.

Jump to

Keyboard shortcuts

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