tcping/README.md

139 lines
2.5 KiB
Markdown
Raw Permalink 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-07-21 16:09:41 +08:00
go get -u github.com/i3h/tcping/cmd/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
2020-07-21 16:09:41 +08:00
cd tcping/cmd/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-07-21 16:09:41 +08:00
```bash
# Test port
$ tcping google.com 443
TCP OPEN [2404:6800:4003:c03::71]:443
# Test with protocol
$ tcping https://google.com
Continent: North America
Country : United States
Latitude : 37.751000
Longitude: -97.822000
TimeZone : America/Chicago
IsEU : false
ASN : 15169
ORG : GOOGLE
2019-11-09 10:07:49 +08:00
Proxy : false
Scheme : https
2020-07-21 16:09:41 +08:00
Host : google.com
DNS Lookup: 0.85 ms
TCP : 1.62 ms
TLS : 3.11 ms
Process : 32.91 ms
Transfer : 0.15 ms
Total : 38.72 ms
2019-11-09 10:07:49 +08:00
2020-07-21 16:09:41 +08:00
# HTTP ping
$ tcping -h https://google.com
2019-11-09 10:07:49 +08:00
2020-07-21 16:09:41 +08:00
Proxy : false
Scheme : https
Host : google.com
DNS Lookup: 0.92 ms
TCP : 1.71 ms
TLS : 2.99 ms
Process : 32.24 ms
Transfer : 0.14 ms
Total : 38.10 ms
2019-11-09 10:07:49 +08:00
2020-07-21 16:09:41 +08:00
# ICMP ping
$ tcping -i google.com
ICMP OPEN 172.217.194.113 2.0 ms
# Query IP info
$ tcping -q google.com
Continent: North America
Country : United States
Latitude : 37.751000
Longitude: -97.822000
TimeZone : America/Chicago
IsEU : false
ASN : 15169
ORG : GOOGLE
# Test port
$ tcping -t google.com:443
TCP OPEN google.com:443
2019-11-09 10:07:49 +08:00
```
# 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
2020-07-21 16:09:41 +08:00
```bash
# 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
2020-07-21 16:09:41 +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)