ping

package module
v0.0.0-...-5415d0f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ping provides a facility for pinging hosts that uses the installed ping command rather than Go's ICMP support, enabling basic pinging without needing administrator/root privileges.

Index

Constants

View Source
const (
	// DefaultCount is 1
	DefaultCount = 1

	// DefaultPayloadSize is 56 bytes
	DefaultPayloadSize = 56
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	// Count is the number of times to ping (defaults to 1)
	Count int

	// PayloadSize is the size of the data field in the ICMP packet, defaults to 1472 (for a 1500 byte total packet)
	PayloadSize int
}

Opts specifies options for pinging

type Stats

type Stats struct {
	// RTT Minimum milliseconds
	RTTMin float64
	// RTT Average milliseconds
	RTTAvg float64
	// RTT Maximum milliseconds
	RTTMax float64
	// Packet Loss Rate (ratio, not percent)
	PLR float64
}

Stats represents the statistics of pinging a host

func Run

func Run(host string, opts *Opts) (*Stats, error)

Run pings the specified host with the given options

func (*Stats) String

func (s *Stats) String() string

Directories

Path Synopsis
cmd
ping command

Jump to

Keyboard shortcuts

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