Skip to content

Ping TCP ports. Inspired by Linux's ping utility. Written in Go

License

Notifications You must be signed in to change notification settings

vrichv/tcping

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tcping

TCPING

Go Report Card CodeFactor Go Docker container build GitHub go.mod Go version Go project version Download Docker Pulls

A cross-platform ping program for TCP ports inspired by the Linux's ping utility. This program will send TCP probes to an IP address or a hostname specified by you and prints the result. It works with both IPv4 and IPv6.

TCPING uses different TCP sequence numbering for successful and unsuccessful probes, so that when you look at the results and spot a failed probe, understanding the total packet drops to that point would be illustrative enough.

  • Monitor your network connection.
  • Determine packet loss.
  • Analyze the network's latency.
  • Show min/avg/max probes latency.
  • Use the -r flag to retry hostname resolution after a predetermined number of ping failures. If you want to test your DNS load balancing or Global Server Load Balancer (GSLB), you should utilize this option..
  • Print connection statistics on Enter key press.
  • Display the longest encountered downtime and uptime duration and time.
  • Monitor and audit your peers network.
  • Calculate the total uptime/downtime when conducting a maintenance.
  • An alternative to ping in environments that ICMP is blocked.

Table of Contents


Demos

Vanilla usage

tcping


Retry resolve (-r) flag

tcping


Download the executables

  • macOS - also available through brew

    brew install pouriyajamshidi/tap/tcping

When the download is complete, head to the usage section.

Alternatively, you can:

  • Install using go install:

    go install github.com/pouriyajamshidi/tcping@latest
  • Use the Docker images:

    docker pull pouriyajamshidi/tcping:latest

    Image is also available on GitHub container registry:

    docker pull ghcr.io/pouriyajamshidi/tcping:latest
  • Or compile the code yourself by running the make command in the tcping directory:

    make build

    This will give you a compressed file with executables for all the supported operating systems inside the executables folder.


Usage

If you have decided to download the executables using the aforementioned links, go to the folder containing the file and extract it. Then, depending on your operating system, follow the instructions below:

On Linux and macOS

Make the file executable:

chmod +x tcping

For easier use, copy the executable to your system PATH like /usr/bin/:

sudo cp tcping /usr/local/bin/

Then run it like, tcping <hostname/IP address> <port>. For instance:

tcping www.example.com 443
# OR
tcping 10.10.10.1 22

Specifying the -r option will cause a name resolution retry after a certain number of failures. For instance:

tcping www.example.com 443 -r 10
# OR
tcping -r 10 www.example.com 443

The -r 10 in the command above will result in a retry of name resolution after 10 probe failures.

On Windows

We recommend Windows Terminal for the best experience and proper colorization.

For easier use, copy tcping.exe to your system PATH like C:\Windows\System32 and run it like:

tcping www.example.com 443

# OR provide the -r flag to
# enable name resolution retries after a certain number of failures:
tcping www.example.com 443 -r 10

If you prefer not to add the executable to your PATH, go to the folder that contains the tcping.exe open up the terminal and run the following command:

.\tcping.exe 10.10.10.1 22

Please note, if you copy the program to your system PATH, you don't need to specify .\ and the .exe extension to run the program anymore.

Using Docker

The Docker image can be used like:

# Using Docker Hub
docker run -it pouriyajamshidi/tcping:latest example.com 443

# Using GitHub container registry:
docker run -it ghcr.io/pouriyajamshidi/tcping:latest example.com 443

Flags

The following flags are available to control the behavior of application:

Flag Description
-r Retry resolving a hostname after <n> number of failures
-j Output in JSON format
-u Check for updates
-v Print version

Tips

  • Press the Enter key while the program is running to examine the summary of all probes without shutting it down, as shown in the demos section.

Notes

TCPING is constantly being improved, adding numerous new features and fixing bugs. Be sure to look for updated versions..

tcping -u

Contributing

Pull requests are welcome to solve bugs, add new features and also to help me with the open issues that can be found here GitHub issues.

  1. Pick any issue that you feel comfortable with.
  2. Fork the repository.
  3. Create a branch.
  4. Commit your work.
  5. Add tests if possible.
  6. Run the tests go test or make test.
  7. Create a pull request

Please make sure that your pull request only works on one specific issue and doesn't handle two or more tickets. This makes it simpler for us to examine your pull request and helps keep the git history clean.

Tested on

Windows, Linux and macOS.

Sponsor us

"Buy Me A Coffee"
sponsor
GitHub Sponsor

Contact me

LinkedIn

License

License: MIT

About

Ping TCP ports. Inspired by Linux's ping utility. Written in Go

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 93.2%
  • Makefile 6.6%
  • Dockerfile 0.2%