traceroute

package module
v0.0.0-...-9ec179a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 5 Imported by: 0

README

traceroute

Documentation

Overview

Package traceroute provides functions for executing a tracroute to a remote host.

Index

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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