ping

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Address    string
	ResolvedIP string // The resolved IPv4 address (may be same as Address if IP was provided)
	Success    bool
	Attempts   int
	BytesRecv  int
	Error      error
	Duration   time.Duration
}

Result holds the ping result

func Run

func Run(address string, maxAttempts int, timeout time.Duration) Result

Run performs an ICMP ping to the specified address. address can be an IP address or a hostname. maxAttempts specifies the maximum number of ping attempts. timeout specifies the maximum duration to wait for a response. Returns a Result struct containing the results of the ping operation.

Jump to

Keyboard shortcuts

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