#ping #raw #platform

ping

Simle and naive ping implementation in rust

7 releases (4 breaking)

0.5.9 Oct 16, 2023
0.5.1 Nov 30, 2023
0.5.0 Oct 16, 2023
0.4.1 Mar 30, 2023
0.1.0 Sep 17, 2017

#178 in Operating systems

Download history 600/week @ 2023-10-20 539/week @ 2023-10-27 455/week @ 2023-11-03 4009/week @ 2023-11-10 4590/week @ 2023-11-17 4782/week @ 2023-11-24 4407/week @ 2023-12-01 4715/week @ 2023-12-08 3438/week @ 2023-12-15 1662/week @ 2023-12-22 1725/week @ 2023-12-29 3171/week @ 2024-01-05 3066/week @ 2024-01-12 3082/week @ 2024-01-19 3356/week @ 2024-01-26 2995/week @ 2024-02-02

13,200 downloads per month
Used in 5 crates

MIT license

12KB
272 lines

rust ping

Crates.io MIT licensed Docs

Ping function implemented in rust.

dgram sock and raw sock

Sending an ICMP package should create a socket with type 'raw' on most platforms. And most of these platforms require special privileges. Basically, it needs to run with sudo on Linux to create a 'raw' socket.

These requirements introduce security risks, so on modern platforms, 'unprivileged ping' has been introduced, with socket type 'dgram'. So there are two mods in this crate, rawsock and dgramsock, which have the same function ping. And the global ping function is just an alias to the rawsock::ping. You can pick the one which is suitable for your use case.

For Linux users, although modern kernels support dgram, in some distributions (like Arch), it's disabled by default. More details: https://wiki.archlinux.org/title/sysctl#Allow_unprivileged_users_to_create_IPPROTO_ICMP_sockets

License

This library contains codes from https://github.com/knsd/tokio-ping, which is licensed under either of

And other codes is licensed under

Dependencies

~0.8–1.5MB
~30K SLoC