pingdata

package
v0.0.0-...-404304f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PingData

type PingData struct {
	// contains filtered or unexported fields
}

Ping data. Holds host information and ping statistics. Use Add, Get and Iterate functions. No internal logic will be exposed.

func NewPingData

func NewPingData() *PingData

func (*PingData) Add

func (pr *PingData) Add(hosts ...netip.Addr)

Add - adds some hosts to be pinged

func (*PingData) Append

func (pr *PingData) Append(data *PingData)

Append - merges 2 PingData into one

func (*PingData) Count

func (pr *PingData) Count() int

Returns count of configured host

func (*PingData) Del

func (pr *PingData) Del(hosts ...netip.Addr)

Del removes some hosts from ping list

func (*PingData) Dump

func (pr *PingData) Dump(w io.Writer, title ...string)

func (*PingData) Flush

func (pr *PingData) Flush()

Flush removes all configured hosts

func (*PingData) Get

func (pr *PingData) Get(ip netip.Addr) (*PingStats, bool)

Get searches for ping statistics of a host

func (*PingData) Iterate

func (pr *PingData) Iterate(callback func(ip netip.Addr, val *PingStats))

Iterate runs through all hosts and calls callback for stats processing

func (*PingData) Reset

func (pr *PingData) Reset()

Reset statistics. Host list remains unchainged.

type PingStats

type PingStats struct {
	// contains filtered or unexported fields
}

A single host ping statistics

func (*PingStats) Duplicate

func (s *PingStats) Duplicate() uint

func (*PingStats) Latency

func (s *PingStats) Latency() float32

Latency returns average latency in miliseconds

func (*PingStats) Loss

func (s *PingStats) Loss() float32

Loss returns calculated ping loss

func (*PingStats) Recv

func (s *PingStats) Recv(seq uint16, rtt time.Duration)

func (*PingStats) Reset

func (s *PingStats) Reset()

Reset statistics to zero values

func (*PingStats) Rtt

func (s *PingStats) Rtt() time.Duration

Rtt returns last packet rtt

func (*PingStats) Send

func (s *PingStats) Send(seq uint16)

func (*PingStats) String

func (s *PingStats) String() string

func (*PingStats) Valid

func (s *PingStats) Valid() bool

Jump to

Keyboard shortcuts

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