traceroute

package module
v0.0.0-...-6af9cf9 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: MIT Imports: 8 Imported by: 1

README

go-traceroute

Go Report Card

Installation

Please be aware that macOS doesn't support the setcap command.

go get github.com/vaegt/go-traceroute
cd $GOPATH/src/github.com/vaegt/go-traceroute/cmd
go build -o go-traceroute
sudo setcap 'cap_net_raw+p' ./go-traceroute

or

download the latest release

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hop

type Hop struct {
	TryNumber int
	TTL       int
	AddrIP    net.IP
	AddrDNS   []string //net.IPAddr
	Latency   time.Duration
	Err       error
}

Hop represents a path between a source and a destination.

type TraceData

type TraceData struct {
	Hops    [][]Hop
	Dest    net.IP
	Timeout time.Duration
	Tries   int
	MaxTTL  int
	Port    int
	Proto   string
	IPv     string
}

TraceData represents data received by executing traceroute.

func Exec

func Exec(dest net.IP, timeout time.Duration, tries int, maxTTL int, proto string, port int) (data TraceData)

Exec returns TraceData with initialized Hops and inserts the IP version into the protocol

func (*TraceData) All

func (data *TraceData) All() (err error)

All executes all doHops for all tries.

func (*TraceData) Next

func (data *TraceData) Next() (err error)

Next executes the doHop method for every try.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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