pingrs
- 3 Devlogs
- 5 Total hours
The `ping` command written in Rust with a personal touch
The `ping` command written in Rust with a personal touch
After trying to create an ICMP socket, a UDP socket, I decided it was time to try other crates that offered cross platform ICMP sockets. One such crate was ping-rs. I included it in the project to send ping requests and receive the replies.
Then I wrote the logic for calculating the no. of packets that were sent, received and lost. Calculated the maximum, minimum and average RTT for the entire ping command.
Then formatted the output and added colour to it.
Wrote the README.md file.
Published the application to cargo. You can try it out by cargo install pingrs.
Created a GitHub release and ready to ship!!
Tried to implement UDP Sockets for Pinging the server with a Echo Request. By tracking the time needed for the response, I can find RTT. But issues in using UDP sockets from the server side. Also a problem arises when IPv6 is used instead of IPv4.
So, back to square 1. Searching for other possible options.
Created a Basic working of the ping command in Rust.
Started with writing my own ICMP socket with the socket2 crate, but the implementation was primarily for Linux and didn’t work on Windows.
For a more cross-platform option, I chose to use crates that could provide the functionality. One such crate was pinger. Used it to create the basic implementation that is shown in the picture.