klw-account2 d6dae3bab7 feature: 增加网络诊断服务 há 2 semanas atrás
..
pb d6dae3bab7 feature: 增加网络诊断服务 há 2 semanas atrás
NetworkDiagnosticServer.go d6dae3bab7 feature: 增加网络诊断服务 há 2 semanas atrás
ping_test.go d6dae3bab7 feature: 增加网络诊断服务 há 2 semanas atrás
readme.md d6dae3bab7 feature: 增加网络诊断服务 há 2 semanas atrás

readme.md

Supported Operating Systems

Linux

This library attempts to send an "unprivileged" ping via UDP. On Linux, this must be enabled with the following sysctl command:

sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"

If you do not wish to do this, you can call pinger.SetPrivileged(true) in your code and then use setcap on your binary to allow it to bind to raw sockets (or just run it as root):

setcap cap_net_raw=+ep /path/to/your/compiled/binary

See this blog and the Go x/net/icmp package for more details.

Windows

You must use pinger.SetPrivileged(true), otherwise you will receive the following error:

socket: The requested protocol has not been configured into the system, or no implementation for it exists.

Despite the method name, this should work without the need to elevate privileges and has been tested on Windows 10. Please note that accessing packet TTL values is not supported due to limitations in the Go x/net/ipv4 and x/net/ipv6 packages.

Plan 9 from Bell Labs

There is no support for Plan 9. This is because the entire x/net/ipv4 and x/net/ipv6 packages are not implemented by the Go programming language.