tcping/README.md

107 lines
1.9 KiB
Markdown
Raw Normal View History

2019-11-09 10:07:49 +08:00
# Introduction
2020-07-21 11:27:37 +08:00
Tcping is ping probe command line tool, supporting ICMP, TCP and HTTP protocols.
2019-11-09 10:07:49 +08:00
2020-07-21 11:27:37 +08:00
You can also use it to query IP information from [https://ifconfig.is](https://ifconfig.is).
2019-11-09 10:07:49 +08:00
# Features
- Support ICMP/TCP/HTTP protocols
- Query basic IP information
# Installation
2020-05-11 22:38:50 +08:00
1. Download latest [release](https://github.com/i3h/tcping/releases/latest) (recommend)
2019-11-09 10:07:49 +08:00
2. Use go get
```
2020-05-11 22:38:50 +08:00
go get -u github.com/i3h/tcping
2019-11-09 10:07:49 +08:00
```
3. Build on your own
```
2020-05-11 22:38:50 +08:00
git clone https://github.com/i3h/tcping.git
cd tcping
2019-11-09 10:07:49 +08:00
go build
```
# Usage
```
-h string
HTTP Ping
-i string
ICMP Ping
-m string
MTR Trace
-q string
Query ip information
-t string
TCP Ping
-v Version
```
# Examples
```
2020-05-11 22:38:50 +08:00
$ tcping -h https://www.google.com
2019-11-09 10:07:49 +08:00
Proxy : false
Scheme : https
Host : www.google.com
DNS Lookup: 2.05 ms
TCP : 2.41 ms
TLS : 68.92 ms
Process : 29.28 ms
Transfer : 0.19 ms
Total : 103.06 ms
```
```
2020-05-11 22:38:50 +08:00
$ tcping -i www.google.com
2019-11-09 10:07:49 +08:00
ICMP OPEN 74.125.200.147 2.2 ms
```
```
2020-05-11 22:38:50 +08:00
$ tcping -t www.google.com:443
2019-11-09 10:07:49 +08:00
TCP OPEN www.google.com:443
```
```
2020-05-11 22:38:50 +08:00
$ tcping -q www.google.com
2019-11-09 10:07:49 +08:00
IP : 172.217.194.103
City : Queenstown Estate
Country: Singapore
ISP : Google LLC
AS : AS15169 Google LLC
```
# Note
Root permission is required when running ICMP ping, since it needs to open raw socket.
2020-05-11 22:38:50 +08:00
You can either use sudo command, or set setuid bit for tcping.
2019-11-09 10:07:49 +08:00
```
// Use sudo for one-time ping
2020-05-11 22:38:50 +08:00
$ sudo tcping -i google.com
2019-11-09 10:07:49 +08:00
// Set setuid bit
2020-05-11 22:38:50 +08:00
$ sudo chown root:root tcping
$ sudo chmod u+s tcping
2019-11-09 10:07:49 +08:00
```
# License
2020-05-11 22:38:50 +08:00
See the [LICENSE](https://github.com/i3h/tcping/blob/master/LICENSE.md) file for license rights and limitations (MIT).
2019-11-09 10:07:49 +08:00
# Acknowledgements
[lmas/icmp_ping.go](https://gist.github.com/lmas/c13d1c9de3b2224f9c26435eb56e6ef3)
[sparrc/go-ping](https://github.com/sparrc/go-ping)
[davecheney/httpstat](https://github.com/davecheney/httpstat)