mtr

package module
v0.0.0-...-3a40e82 Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: MIT Imports: 7 Imported by: 4

README

go-mtr

A go wrapper on the mtr process. This package uses mtr --raw and parses the output. The results are slightly different than running mtr --report directly because mtr itself keeps a running total of the mean/standard deviation/interarrival jitter/etc. This package calculates these values over the entire package sequence.

mtr is required to use this package.

Documentation can be found on godoc.

Documentation

Overview

mtr is a package that processes and saves an `mtr --raw` call's output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	IP              net.IP  `json:"ip"`
	Name            string  `json:"hostname"`
	Hop             int     `json:"hop-number"`
	PacketMicrosecs []int   `json:"packet-times"`
	Sent            int     `json:"sent"`
	Received        int     `json:"received"`
	Dropped         int     `json:"dropped"`
	LostPercent     float64 `json:"lost-percent"`
	// All packet units are in microseconds
	Mean               float64 `json:"mean"`
	Best               int     `json:"best"`
	Worst              int     `json:"worst"`
	StandardDev        float64 `json:"standard-dev"`
	MeanJitter         float64 `json:"mean-jitter"`
	WorstJitter        int     `json:"worst-jitter"`
	InterarrivalJitter int     `json:"interarrival-jitter"` // calculated with rfc3550 A.8 shortcut
}

type MTR

type MTR struct {
	Done        chan struct{}
	OutputRaw   []byte
	Error       error
	PacketsSent int
	Hosts       []*Host `json:"hosts"`
}

func New

func New(reportCycles int, host string, args ...string) *MTR

New runs mtr --raw -c reportCycles hostname args... Thus, you can add more arguments to the default required hostname and report cycles. The MTR call is signified as done when the MTR.Done chan closes. First wait for this, then check the MTR.Error field before looking at the output. Other than that, the fields and json tags document what everything means.

Jump to

Keyboard shortcuts

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