Registry / networking / sparrc-go-ping

sparrc-go-ping

JSON →
library1.2.0gogounverified

An ICMP ping library for Go that emulates the Unix ping command, sending and receiving ICMP packets.

go get github.com/sparrc/go-ping
INSTALL
IMPORT
SIG · SPARRC-GO-PING
S
sparrc-go-ping
networkinggov1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ping
github.com/sparrc/go-ping

Ping google.com 3 times and print each response.

package main import ( "fmt" "github.com/sparrc/go-ping" ) func main() { pinger, _ := ping.NewPinger("google.com") pinger.Count = 3 pinger.OnRecv = func(pkt *ping.Packet) { fmt.Printf("%d bytes from %s: icmp_seq=%d time=%v\n", pkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt) } pinger.Run() }
Debug
Known issues
gotchaRequires elevated privileges on some systems to create raw sockets.
fix
Run the program with sudo or set capabilities (e.g., setcap cap_net_raw+ep).
affects: all
Upgrade
Version history
1.2.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
sparrc-go-ping — go get sparrc-go-ping · libregistry