A simple ICMP Echo implementation, based on golang.org/x/net/icmp.
Some sample programs are provided in cmd/:
ping-testis a really simple ping clonemultipingprovides an interactive TUI to ping multiple hostsping-monitorpings multiple hosts in parallel, but just prints the summary every so oftenpingnetallows to ping every host in a CIDR range (e.g. 0.0.0.0/0 :-))
- IPv4 and IPv6 support
- Unicast and multicast support
- Privileged and unprivileged (UDP) support
- configurable retry amount and timeout duration
- configurable payload size (and content)
- round trip time measurement
For privileged ICMP (requires root or CAP_NET_RAW):
pinger, err := ping.New("0.0.0.0", "::")For unprivileged ICMP (works on Linux and Darwin if allowed):
pinger, err := ping.NewUDP("0.0.0.0", "::")On Linux, the process's group must be allowed by
net.ipv4.ping_group_range. For example, to allow all groups:
sudo sysctl -w 'net.ipv4.ping_group_range=0 2147483647'On Linux, unprivileged sockets use their own ICMP identifiers and ignore
Pinger.Id. Darwin uses Pinger.Id for both socket types.
On Linux, unprivileged sockets do not receive ICMP errors such as "destination unreachable". An unreachable target results in a timeout instead.
The tests use IPv4 and IPv6 loopback addresses. Set RUN_UNPRIVILEGED=1 to
require unprivileged sockets to be available, and RUN_PRIVILEGED=1 to enable
the tests that require root or CAP_NET_RAW.
Simply fork and create a pull-request. We'll try to respond in a timely fashion.
Please create a pull request to get your software listed.
MIT License, Copyright (c) 2018 Digineo GmbH