go-ping icon indicating copy to clipboard operation
go-ping copied to clipboard

Pinger.New() can only create privileged icmp.PacketConn

Open realnedsanders opened this issue 6 years ago • 0 comments

Pinger.New() runs connectICMP() which runs icmp.ListenPacket(network, address) using static value "ip4:icmp" as network. Per icmp.ListenPacket() def, this only allows usage of privileged endpoints.

ListenPacket listens for incoming ICMP packets addressed to address. See net.Dial for the syntax of address.

For non-privileged datagram-oriented ICMP endpoints, network must be "udp4" or "udp6". The endpoint allows to read, write a few limited ICMP messages such as echo request and echo reply. Currently only Darwin and Linux support this.

realnedsanders avatar May 31 '19 23:05 realnedsanders