mtr

package
v0.0.0-...-fbf6923 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executer

type Executer interface {
	// io.Writer を渡す、もしくは io.Reader を返すのが良いのかも
	Execute(host netip.Addr, count int) ([]byte, error)
}

func NewExecuter

func NewExecuter() Executer

type ExecuterReal

type ExecuterReal struct{}

func (*ExecuterReal) Execute

func (e *ExecuterReal) Execute(host netip.Addr, count int) ([]byte, error)

type Mtr

type Mtr struct {
	// テスト時にモックするため
	Executer Executer
}

func New

func New(executer Executer) *Mtr

func (*Mtr) Run

func (m *Mtr) Run(targetIPAddr netip.Addr, count int) (Report, error)

type Report

type Report struct {
	Mtr  ReportMtr   `json:"mtr"`
	Hubs []ReportHub `json:"hubs"`
}

type ReportHub

type ReportHub struct {
	Count int     `json:"count"`
	Host  string  `json:"host"`
	Loss  float64 `json:"Loss%"`
	Snt   int     `json:"Snt"`
	Last  float64 `json:"Last"`
	Avg   float64 `json:"Avg"`
	Best  float64 `json:"Best"`
	Wrst  float64 `json:"Wrst"`
	StDev float64 `json:"StDev"`
}

type ReportJSON

type ReportJSON struct {
	Report Report `json:"report"`
}

--json オプションをつけたときに出力される JSON

type ReportMtr

type ReportMtr struct {
	Src        string       `json:"src"`
	Dst        string       `json:"dst"`
	Tos        reportMtrTos `json:"tos"`
	Tests      int          `json:"tests"`
	Psize      string       `json:"psize"`
	Bitpattern string       `json:"bitpattern"`
}

Jump to

Keyboard shortcuts

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