Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage example to README #4

Open
pirate opened this issue Mar 3, 2021 · 2 comments
Open

Add usage example to README #4

pirate opened this issue Mar 3, 2021 · 2 comments

Comments

@pirate
Copy link
Contributor

pirate commented Mar 3, 2021

This looks very cool! I'm just curious how to use the CLI interface and Web interface. (and is the web UI required / or is the CLI the main interaction method?)

First I tried passing the ping target using --peers with a hostname

Host 1: macOS Catalina (Go 1.15)

git clone https://github.com/benjojo/sping && sping
go build
./sping --peers lemon.local
2021/03/02 23:26:37 Listening on[::]:9523

# no stats are printed to CLI or visible in web UI on http://127.0.0.1:9523

Host 2: Ubuntu 20.04 (Go 1.13

git clone https://github.com/benjojo/sping && sping
go build
./sping --peers lime.local
2021/03/02 23:26:40 Listening on[::]:9523

# but no stats are printed to CLI or visible in web UI on http://127.0.0.1:9523

Then I tried using IPs instead of hostnames with no luck

Host 1

# on Host 1
./sping --peers 192.168.1.177
2021/03/02 23:30:33 Listening on[::]:9523
2021/03/02 23:30:33 Cannot (TCP) handshake to 192.168.1.177: dial tcp 192.168.1.177:6924: connect: connection refused
2021/03/02 23:30:34 Cannot (TCP) handshake to 192.168.1.177: dial tcp 192.168.1.177:6924: connect: connection refused
...

Host 2

# on Host 2
./sping --peers 192.168.1.41
2021/03/02 23:32:22 Listening on[::]:9523
2021/03/02 23:32:22 Cannot (TCP) handshake to 192.168.1.41: dial tcp 192.168.1.41:6924: connect: connection refused
2021/03/02 23:32:23 Cannot (TCP) handshake to 192.168.1.41: dial tcp 192.168.1.41:6924: connect: connection refused
...

Question

How can I get the node1->node2 = ??ms and node2->node1 = ??ms latency average between two hosts using the ./sping CLI or Web UI?

@benjojo
Copy link
Owner

benjojo commented Mar 3, 2021

It's one - :)

Since the general intention was to have this run as a service, it does not print it's info out by default, however I can do some terminal auto detection to improve this, in the mean time use -debug.showstats

Example:

$ ./sping -peers 198.16.109.36 -debug.showstats
2021/03/03 19:04:10 Listening on[::]:9523
it is now: 2021-03-03 19:04:11.000241999 +0000 GMT m=+0.500559754
it is now: 2021-03-03 19:04:12.000174134 +0000 GMT m=+1.500491809
2021/03/03 19:04:12 [198.16.109.36] RX: 8.131386ms TX: 0s [Loss RX: 0/0 | Loss TX 0/0]
it is now: 2021-03-03 19:04:13.000262113 +0000 GMT m=+2.500579860
2021/03/03 19:04:13 [198.16.109.36] RX: 8.721114ms TX: 9.952331ms [Loss RX: 0/0 | Loss TX 0/0]
it is now: 2021-03-03 19:04:14.000221753 +0000 GMT m=+3.500539455
2021/03/03 19:04:14 [198.16.109.36] RX: 8.76663ms TX: 9.729724ms [Loss RX: 0/0 | Loss TX 0/0]
it is now: 2021-03-03 19:04:15.00023491 +0000 GMT m=+4.500552661
2021/03/03 19:04:15 [198.16.109.36] RX: 7.946334ms TX: 10.087415ms [Loss RX: 0/0 | Loss TX 0/0]
it is now: 2021-03-03 19:04:16.000171033 +0000 GMT m=+5.500488772
2021/03/03 19:04:16 [198.16.109.36] RX: 7.820656ms TX: 9.761386ms [Loss RX: 0/0 | Loss TX 0/0]
it is now: 2021-03-03 19:04:17.000168161 +0000 GMT m=+6.500485862

@pirate
Copy link
Contributor Author

pirate commented Mar 3, 2021

Ah, makes sense, I didn't see any error message about the args so I assumed you were using an argparsing library that could handle both -flag and --flag.

Added your example here: #5

I don't know why but the -flag form gives me the heebie jeebies, I always do --flag if the flag is more than a single character like -f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants