traceroute

package module
v0.0.0-...-14f74dc Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 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           `json:"try_numberomitempty"`
	TTL       int           `json:"ttl,omitempty"`
	AddrIP    net.IP        `json:"addr_ip,omitempty"`
	AddrDNS   []string      `json:"addr_dns,omitempty"` //net.IPAddr
	Latency   time.Duration `json:"latency,omitempty"`
	Err       error         `json:"err,omitempty"`
}

Hop represents a path between a source and a destination.

type TraceData

type TraceData struct {
	Hops    [][]Hop       `json:"hops,omitempty"`
	Dest    net.IP        `json:"dest,omitempty"`
	Timeout time.Duration `json:"timeout,omitempty"`
	Tries   int           `json:"tries,omitempty"`
	MaxTTL  int           `json:"max_ttl,omitempty"`
	Port    int           `json:"port,omitempty"`
	Proto   string        `json:"proto,omitempty"`
	IPv     string        `json:"i_pv,omitempty"`
}

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