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: 0

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

Jump to

Keyboard shortcuts

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