ping

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(ctx context.Context, targets []*Target, s Socket, interval, timeout time.Duration, l *slog.Logger)

Types

type Socket

type Socket interface {
	Ping(net.IP, icmp.SequenceNumber, uint8, []byte) error
	Read(context.Context) (icmp.Response, error)
	Resolve(string) (net.IP, error)
	Serve(context.Context)
}

type Statistics added in v1.10.1

type Statistics struct {
	Sent     int
	Received int
	Latency  time.Duration
}

type Target

type Target struct {
	net.IP
	// contains filtered or unexported fields
}

func (*Target) Received

func (t *Target) Received(received bool, seq icmp.SequenceNumber)

func (*Target) ResetStatistics

func (t *Target) ResetStatistics()

func (*Target) Sent

func (t *Target) Sent(seq icmp.SequenceNumber)

func (*Target) Statistics

func (t *Target) Statistics() Statistics

Directories

Path Synopsis
Package icmp sends and receives icmp echo request/reply packets over a UDP socket.
Package icmp sends and receives icmp echo request/reply packets over a UDP socket.
internal

Jump to

Keyboard shortcuts

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