# rusty-ping A replacement for [prettyping](https://github.com/denilsonsa/prettyping). A very simple ping utility that tries to be as visual as possible, does NOT use the ping command. ## Install ```shell $ git clone https://github.com/ache/git/rusty-ping.git $ cd rusty-ping $ cargo install --path . ``` ## Usage ```shell $ cargo run -- ``` or after installation: ```shell $ rusty-ping ``` ## Shell integration Rusty-ping doesn't use a config file to keep things as simple as possible. The goal is to type 'pp' to quickly do a ping, I will not call rusty-ping pp as it may conflict with other CLI. So the configuration step and alias to 'pp' is done with some shell integration. I use fish, so if something breaks with `bash` / `zsh`, just send me a e-mail. ### Fish I prefere to use fish abbreviation. `$HOME/.config/fish/function/pp.fish` ```fish abbr --add pp rusty-ping --stats --status --default-target 2606:4700:4700::1111 ``` But a function works too. ```fish function pp rusty-ping --stats --status --default-target 2606:4700:4700::1111 end ``` ### Bash / zsh You can just use a function : ```bash function pp { rusty-ping --stats --legende --status --default-target 2606:4700:4700::1111 } ``` ## "User Interface" Here is the full UI and the explainations : ```shell rusty-ping --stats --status --default-target git.ache.one --legende 0 ▁ 30 ▄ 50 ▆ 70 █ 90 ▂ 120 ▅ 150 █ 170 ▂ 190 ▄ 210 ▆ 240 ? <-- The legende (--legende) PING git.ache.one (145.239.86.0) <-- The status line (--status) ▄▄▄▄▄▄▄▄? <-- The ping line 0/9 (0.0%) | ⌊34⌋ ⌈35⌉ [35] [Δ0]ms <-- Statistics on every packet (--stats) 0/9 (0.0%) | ⌊34⌋ ⌈35⌉ [35] [Δ0]ms <-- Statistics on the lasts 30 packets (--stats) ``` The legende indicate which characters correspond to which RTT in the ping line. On the ping line, every characters correspond to a ICMP packet send. ? => Packet not yet received ! => Packet lost ### The statistics RTT is expressed in miliseconds. ```plain ┏━> Number of packets lost / Total send (Percentage of packets lost) │ ┏━> Just a separator 0/9 (0.0%) | ⌊36⌋ ⌈56⌉ [40] [Δ4]ms │ │ │ ┕━> The mean absolute difference │ │ │ to the average RTT │ │ ┕━> The average RTT │ ┕━> The maximal RTT ┕━> The minimal RTT ``` ## Technical Notes It does NOT use the `ping` command. It isn't tied to bash or any shell. ### Rust dependancies: - `clap` to parse args - `ping` crate to actually do the ping - `term_size` to pretty print the legende - `tokio` for `mpsc`, the default mpsc queue seems to be deprecated