tcping

command module
v0.0.0-...-f91a516 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 10 Imported by: 0

README

tcping2

Go Report Card CI GitHub release (latest SemVer)

this is an enhanced and updated fork of i3h/tcping

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

You can also use it to query IP network 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/tommi2day/tcping
  1. Build on your own
git clone https://github.com/tommi2day/tcping.git
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:    Asia
Country  :    Singapore
City     :    Singapore (Queenstown Estate)
Latitude :    1.276230
Longitude:    103.800000
ASN      :    15169
ORG      :    Google LLC

Proxy     :    false
Scheme    :    https
Host      :    google.com
DNS Lookup:    1.66 ms
TCP       :    10.59 ms
TLS       :    18.10 ms
Process   :    66.63 ms
Transfer  :    0.00 ms
Total     :    96.98 ms


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

Proxy     :    false
Scheme    :    https
Host      :    google.com
DNS Lookup:    13.65 ms
TCP       :    9.74 ms
TLS       :    18.00 ms
Process   :    63.95 ms
Transfer  :    0.95 ms
Total     :    106.63 ms

# ICMP ping
$ tcping -i google.com

ICMP   OPEN      142.250.185.238    9.3 ms

# Query IP info
$ tcping -q google.com

Continent:    North America
Country  :    United States
City     :    Mountain View
Latitude :    37.422000
Longitude:    -122.084000
ASN      :    15169
ORG      :    Google LLC

# Test port
$ tcping -t google.com:443

TCP    OPEN      google.com:443

# MTR trace
$ tcping -m google.com
Waiting for MTR results...
Hop    1 192.168.0.22                                                 Loss:   0.00% Avg:  0.54
Hop    2 192.168.0.1                                                  Loss:   0.00% Avg:  1.19
Hop    3 ...                                                          Loss:   0.00% Avg:  1.66
Hop    4 ...                                                          Loss:   0.00% Avg:  5.61
Hop    5 ...                                                          Loss:   0.00% Avg:  9.66
Hop    6 ...                                                          Loss:   0.00% Avg:  9.53
Hop    7 209.85.142.109                                               Loss:   0.00% Avg: 12.30
Hop    8 172.253.66.139                                               Loss:   0.00% Avg:  9.81
Hop    9 fra02s19-in-f14.1e100.net                                    Loss:   0.00% Avg:  9.61

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

i3h/tcping

Documentation

Overview

Package main

Directories

Path Synopsis
Package cmd contains command implementations
Package cmd contains command implementations
pkg
httping
Package httping provides a simple way to measure the time it takes to connect to a web server.
Package httping provides a simple way to measure the time it takes to connect to a web server.
mtr
Package mtr This package is used to run MTR and parse the output to get the IP addresses of the hops.
Package mtr This package is used to run MTR and parse the output to get the IP addresses of the hops.
ping
Package ping This package is used to send an ICMP echo request to a given address and return the time it took to get a reply.
Package ping This package is used to send an ICMP echo request to a given address and return the time it took to get a reply.
tcping
Package tcping provides a simple TCP ping function
Package tcping provides a simple TCP ping function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL