Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mehrdadrad/gping
ping from remote host through gRPC
https://github.com/mehrdadrad/gping
golang grpc mtls ping
Last synced: 3 months ago
JSON representation
ping from remote host through gRPC
- Host: GitHub
- URL: https://github.com/mehrdadrad/gping
- Owner: mehrdadrad
- License: mit
- Created: 2020-05-09T20:53:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-23T17:56:02.000Z (over 4 years ago)
- Last Synced: 2024-06-20T08:09:51.858Z (8 months ago)
- Topics: golang, grpc, mtls, ping
- Language: Go
- Homepage:
- Size: 119 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gping
[![Go Report Card](https://goreportcard.com/badge/github.com/mehrdadrad/gping)](https://goreportcard.com/report/github.com/mehrdadrad/gping)gping is a network tool to ping a target from a remote host. it works as client-server arch through gRPC protocol. it doesn't execute the ping shell command at the remote host instead it runs ping through [Golang ping library](https://github.com/mehrdadrad/ping). use cases can be measurement full mesh network latency between nodes / data center or ping targets from different data center without SSH access to remote host.
## Features
- ping from remote host through gRPC
- ICMP raw socket and UDP
- ping multiple hosts
- IPv4 and IPv6
- [mutual TLS authentication](https://github.com/mehrdadrad/gping/wiki/Set-Up-Mutual-TLS-Authentication)![gping](/gping.png?raw=true "gping")
## Server side
```
#gping -server
```## Single host
```
#gping -c 5 -r 192.168.10.15:3055 googl.com
64 bytes from 172.217.14.78: icmp_seq=0 ttl=54 time=4.129 ms
64 bytes from 172.217.14.78: icmp_seq=1 ttl=54 time=2.134 ms
64 bytes from 172.217.14.78: icmp_seq=2 ttl=54 time=2.220 ms
64 bytes from 172.217.14.78: icmp_seq=3 ttl=54 time=2.194 ms
64 bytes from 172.217.14.78: icmp_seq=4 ttl=54 time=5.920 ms5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 2.134/4.177/5.920 ms
```
## Multiple hosts
```
gping -c 5 -r 192.168.10.15:3055 yahoo.com google.com juniper.com
```
```json
[
{
"host": "google.com",
"min_rtt": 2.531,
"avg_rtt": 3.859,
"max_rtt": 4.859
},
{
"host": "yahoo.com",
"min_rtt": 2.337,
"avg_rtt": 3.615,
"max_rtt": 4.431
},
{
"host": "juniper.com",
"packet_loss": 100,
"err": "request timeout"
}
]
```## Single host JSON format
```
gping -c 5 -json -r 192.168.10.15:3055 yahoo.com
```
```json
{"min_rtt":2.444,"avg_rtt":3.855,"max_rtt":4.625}
```## Quick Help
```
usage:
gping [options] host(s)
options:
--count value, -c value sets ping count (default: 4) [$GPING_COUNT]
--ttl value, -t value sets the IP Time to Live (default: 64) [$GPING_TTL]
--tos value, -q value sets quality of service in ICMP datagram (default: 0) [$GPING_TOS]
--size value sets the number of data bytes to be sent (data + ICMP header) (default: 64) [$GPING_SIZE]
--interval value, -i value sets wait between sending each packet in format ns,us,ms,s (default: "1s") [$GPING_INTERVAL]
--timeout value, -W value sets time to wait for an ICMP reply in format ns,us,ms,s (default: "2s") [$GPING_TIMEOUT]
--remote value, -r value sets remote server IP_ADDR:PORT [$GPING_REMOTE]
--json prints statistics in json format (default: false) [$GPING_JSON]
--silent prints just statistics (default: false) [$GPING_SILENT]
--server, -s runs server (default: false) [$GPING_SERVER]
--cert value TLS certificate file name [$GPING_CERT]
--key value private key file name [$GPING_KEY]
--clients-cert value TLS clients certificate file name [$GPING_CLIENTS_CERT]
--ca-cert value certificate file to verify the server [$GPING_CA_CERT]
--bind value, -b value sets bind IP_ADDR:PORT [server] (default: "0.0.0.0:3055") [$GPING_BIND]
--privileged, -p enables ICMP privileged mode [server] (default: false) [$GPING_PRIVILEGED]
--logs enables logging [server] (default: false) [$GPING_LOGS]
--help, -h show help (default: false)
--version, -v print the version (default: false)
```note: server side supports unprivileged ICMP / UDP (default) and privileged ICMP / raw socket
If you use gping server in unprivileged mode, you need to run the below command on Linux:
```
sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"
```
in case of privileged ICMP (it enables w/ -p or -privileged) you should give the raw socket permission by the below or just run by superuser.
```
sudo setcap cap_net_raw+ep ./gping
```
for more information about setcap cap_net_raw+ep: https://wiki.archlinux.org/index.php/Capabilities## Supported platform
| | Client | Server |
|--------------------| -------|--------|
|Linux | ✓| ✓|
|macOS | ✓| ✓|
|FreeBSD | ✓| ✓|
|Windows | ✓| |## Download gping v0.3.0
In case you don't want to compile, the below binaries are available (compiled by Go 1.14.3)
- [Linux](https://github.com/mehrdadrad/gping/releases/download/v0.3.0/gping-linux)
- [macOS](https://github.com/mehrdadrad/gping/releases/download/v0.3.0/gping-macos)
- [FreeBSD](https://github.com/mehrdadrad/gping/releases/download/v0.3.0/gping-freebsd)
- [Windows](https://github.com/mehrdadrad/gping/releases/download/v0.3.0/gping.exe)## License
This project is licensed under MIT license. Please read the LICENSE file.## Contribute
Welcomes any kind of contribution, please follow the next steps:- Fork the project on github.com.
- Create a new branch.
- Commit changes to the new branch.
- Send a pull request.