tcping

package module
v0.0.0-...-d4e5331 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PacketEvent

type PacketEvent struct {
	IsTimeout bool
	From      string
	Seq       int
	Latency   time.Duration
}

type PacketStatistic

type PacketStatistic struct {
	SendCount     int           `json:"send_count"`
	ReceivedCount int           `json:"received_count"`
	LossedCount   int           `json:"lossed_count"`
	TimeTotal     time.Duration `json:"time_total"`
	TimeMax       time.Duration `json:"time_max"`
	TimeMin       time.Duration `json:"time_min"`
	TimeAvg       time.Duration `json:"time_avg"`
	TimeMdev      time.Duration `json:"time_mdev"`
}

type Pinger

type Pinger struct {
	Host     *net.IPAddr
	Interval time.Duration
	Timeout  time.Duration
	Count    int

	OnEvent func(*PacketEvent, error)
	// contains filtered or unexported fields
}

func New

func New(target string) (*Pinger, error)

func (*Pinger) GetStatistic

func (p *Pinger) GetStatistic() PacketStatistic

func (*Pinger) Start

func (p *Pinger) Start(ctx context.Context)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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