Go to file
i3h 6f55d63cd7 Update README 2020-07-21 16:09:41 +08:00
.github/workflows Update workflow 2020-07-21 11:22:45 +08:00
cmd/tcping Update workflow 2020-07-21 11:22:45 +08:00
pkg Reorganize folder structure 2020-07-21 10:39:02 +08:00
.gitignore Reorganize folder structure 2020-07-21 10:39:02 +08:00
LICENSE.md first release 2020-05-11 22:18:16 +08:00
README.md Update README 2020-07-21 16:09:41 +08:00
go.mod change repo name 2020-05-11 22:38:50 +08:00
go.sum change repo name 2020-05-11 22:38:50 +08:00

README.md

Introduction

Tcping is ping probe command line tool, supporting ICMP, TCP and HTTP protocols.

You can also use it to query IP information from https://ifconfig.is.

Features

  • Support ICMP/TCP/HTTP protocols
  • Query basic IP information

Installation

  1. Download latest release (recommend)

  2. Use go get

go get -u github.com/i3h/tcping/cmd/tcping
  1. Build on your own
git clone https://github.com/i3h/tcping.git
cd tcping/cmd/tcping
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

# 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

Proxy     :    false
Scheme    :    https
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

# HTTP ping
$ tcping -h https://google.com

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

# 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

Note

Root permission is required when running ICMP ping, since it needs to open raw socket.

You can either use sudo command, or set setuid bit for tcping.

# Use sudo for one-time ping
$ sudo tcping -i google.com

# Set setuid bit
$ sudo chown root:root tcping
$ sudo chmod u+s tcping

License

See the LICENSE file for license rights and limitations (MIT).

Acknowledgements

lmas/icmp_ping.go

sparrc/go-ping

davecheney/httpstat