ping

package
v0.0.0-...-5385bce Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ICMPProtocol .
	ICMPProtocol = 1

	// ICMP6Protocol .
	ICMP6Protocol = 58
)

Variables

This section is empty.

Functions

func Room

func Room(ctx context.Context, roomID string, config Config, log *zap.SugaredLogger) (map[string]*Result, *nerr.E)

Room pings the room and returns the results

Types

type Config

type Config struct {
	Count int           // the number of pings to send
	Delay time.Duration // the delay after sending a ping before sending the next
}

Config .

type Host

type Host struct {
	ID   string
	Addr string
}

Host .

type Pinger

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

Pinger .

func NewPinger

func NewPinger() (*Pinger, error)

NewPinger .

func (*Pinger) Close

func (p *Pinger) Close()

Close .

func (*Pinger) Ping

func (p *Pinger) Ping(ctx context.Context, config Config, hosts ...Host) map[string]*Result

Ping .

type Result

type Result struct {
	Error string `json:"error,omitempty"`

	IP               net.IP `json:"ip,omitempty"`
	PacketsSent      int    `json:"packets-sent,omitempty"`
	PacketsReceived  int    `json:"packets-received,omitempty"`
	PacketsLost      int    `json:"packets-lost,omitempty"`
	AverageRoundTrip string `json:"average-round-trip,omitempty"`
}

Result .

Jump to

Keyboard shortcuts

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