ping

package
v0.0.0-...-6f44a9b Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIcmpError

func NewIcmpError(msg string) *icmpError

Types

type ICMPResponse

type ICMPResponse struct {
	// Rtt is the round-trip time it took to ping.
	ICMPRet ipv4.ICMPType
	Rtt     time.Duration
	Seq     int
	ID      int
	Code    int
	Body    []byte
	TTL     int    // time-to-live
	Src     net.IP // source address
	Dst     net.IP // destination address
	Timeout bool
}

type Ping

type Ping interface {
	SendIcmp(data []byte) error
	RecvIcmp() (*ICMPResponse, error)
	Close() error
}

func NewPingV4

func NewPingV4(laddr *net.IPAddr, raddr *net.IPAddr, timeout time.Duration, Identify int) (Ping, error)

func NewPingV6

func NewPingV6(raddr *net.IPAddr, timeout time.Duration) (Ping, error)

func NewUdpV4

func NewUdpV4(laddr *net.IPAddr, raddr *net.IPAddr, timeout time.Duration, Identify int) (Ping, error)

func NewUdpV6

func NewUdpV6(raddr *net.IPAddr, timeout time.Duration, Identify int) (Ping, error)

Jump to

Keyboard shortcuts

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