{"id":17870143,"url":"https://github.com/pouriyajamshidi/tcping","last_synced_at":"2025-05-15T02:05:55.764Z","repository":{"id":36972206,"uuid":"342373648","full_name":"pouriyajamshidi/tcping","owner":"pouriyajamshidi","description":"Ping TCP ports using tcping. Inspired by Linux's ping utility. Written in Go","archived":false,"fork":false,"pushed_at":"2025-05-12T15:04:58.000Z","size":9007,"stargazers_count":876,"open_issues_count":12,"forks_count":77,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-12T16:26:50.988Z","etag":null,"topics":["command-line-tool","golang","latency-monitor","linux","macos","networking","ping","tcp","tcping","windows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pouriyajamshidi.png","metadata":{"files":{"readme":"README.cn.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["pouriyajamshidi"]}},"created_at":"2021-02-25T20:42:42.000Z","updated_at":"2025-05-12T15:05:01.000Z","dependencies_parsed_at":"2023-02-15T11:46:09.568Z","dependency_job_id":"4303375e-dfb3-47b5-8c12-f5e146df8e9b","html_url":"https://github.com/pouriyajamshidi/tcping","commit_stats":{"total_commits":524,"total_committers":27,"mean_commits":19.40740740740741,"dds":0.4885496183206107,"last_synced_commit":"092ce4c8cbea9645c53e674fef01fb10bbce3ac8"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouriyajamshidi%2Ftcping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouriyajamshidi%2Ftcping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouriyajamshidi%2Ftcping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouriyajamshidi%2Ftcping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pouriyajamshidi","download_url":"https://codeload.github.com/pouriyajamshidi/tcping/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259370,"owners_count":22040819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","golang","latency-monitor","linux","macos","networking","ping","tcp","tcping","windows"],"created_at":"2024-10-28T10:12:23.976Z","updated_at":"2025-05-15T02:05:55.744Z","avatar_url":"https://github.com/pouriyajamshidi.png","language":"Go","funding_links":["https://github.com/sponsors/pouriyajamshidi","https://www.buymeacoffee.com/pouriyajamshidi"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" style=\"width: 100%;\"\u003e\n \u003cimg alt=\"tcping\" src=\"Artwork/tcping_logo3.jpeg\" style=\"width:70%;\"\u003e\n\u003c/div\u003e\n\n# TCPING\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/pouriyajamshidi/tcping)](https://goreportcard.com/report/github.com/pouriyajamshidi/tcping)\n[![CodeFactor](https://www.codefactor.io/repository/github/pouriyajamshidi/tcping/badge)](https://www.codefactor.io/repository/github/pouriyajamshidi/tcping)\n[![Go](https://github.com/pouriyajamshidi/tcping/actions/workflows/.github/workflows/codeql-analysis.yml/badge.svg)](https://github.com/pouriyajamshidi/tcping/actions/workflows/go.yml)\n[![Docker container build](https://github.com/pouriyajamshidi/tcping/actions/workflows/container-publish.yml/badge.svg)](https://github.com/pouriyajamshidi/tcping/actions/workflows/container-publish.yml)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/pouriyajamshidi/tcping)\n[![Go project version](https://badge.fury.io/go/github.com%2Fpouriyajamshidi%2Ftcping.svg)](https://badge.fury.io/go/github.com%2Fpouriyajamshidi%2Ftcping)\n![Download](https://img.shields.io/github/downloads/pouriyajamshidi/tcping/total.svg?label=DOWNLOADS\u0026logo=github)\n![Docker Pulls](https://img.shields.io/docker/pulls/pouriyajamshidi/tcping)\n\n这是一个跨平台的 `TCP` 端口 ping 程序，灵感来自 Linux 的 ping 工具。此程序将向您指定的 `IP 地址` 或 `主机名` 发送 `TCP` 探测，并打印结果。它支持 `IPv4` 和 `IPv6`。\n\n**TCPING** 对 _成功_ 和 _不成功_ 的探测使用不同的 `TCP 序列号`，因此当您查看结果并发现探测失败时，可以很容易地推断出到该点为止的总丢包数。\n\n以下是 **TCPING** 的一些功能：\n\n- 在 `ICMP` 被阻止的环境中替代 `ping`。\n- 监控您的网络连接。\n- 确定丢包率。\n- 分析网络延迟。\n- 计算网络探测的 `最小`、`平均` 和 `最大` 延迟。\n- 按下 `Enter` 键即可打印连接统计信息，而无需停止程序。\n- 使用 `-r` 标志在预定次数的探测失败后重试主机名解析。适用于测试您的 `DNS` 负载均衡或全局服务器负载均衡器 `(GSLB)`。\n- 强制使用 `IPv4` 或 `IPv6`。\n- 显示遇到的最长 `停机时间` 和 `正常运行时间` 持续时间和时间。\n- 监控和审计您的对等网络 (SLA)。\n- 在进行维护时计算网络的总正常运行时间或停机时间。\n- 提供彩色、纯文本、JSON、CSV 和 SQLite3 多种输出格式。\n\n---\n\n## 目录\n\n- [TCPING](#tcping)\n  - [目录](#目录)\n  - [演示](#演示)\n    - [基本用法](#基本用法)\n    - [重试主机名查找 (`-r`)](#重试主机名查找--r)\n    - [JSON 格式输出 (`-j --pretty`)](#json-格式输出--j---pretty)\n  - [下载](#下载)\n  - [用法](#用法)\n    - [Linux - Debian 和 Ubuntu](#linux---debian-和-ubuntu)\n    - [Linux、BSD 和 mac OS](#linuxbsd-和-mac-os)\n    - [Windows](#windows)\n    - [Docker](#docker)\n  - [标志](#标志)\n  - [提示](#提示)\n  - [检查更新](#检查更新)\n  - [贡献](#贡献)\n  - [功能请求和问题](#功能请求和问题)\n  - [测试平台](#测试平台)\n  - [帮助项目](#帮助项目)\n  - [许可证](#许可证)\n\n---\n\n## 演示\n\n### 基本用法\n\n![tcping](Images/gifs/tcping.gif)\n\n---\n\n### 重试主机名查找 (`-r`)\n\n![tcping resolve example](Images/gifs/tcping_resolve.gif)\n\n---\n\n### JSON 格式输出 (`-j --pretty`)\n\n![tcping json example](Images/gifs/tcping_json_pretty.gif)\n\n---\n\n## 下载\n\n- ### [Windows](https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_Windows.zip)\n\n- ### [Linux](https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_Linux.tar.gz) - 也可通过 `brew` 和 [.deb 软件包](#linux---debian-和-ubuntu) 获得\n\n- ### [macOS](https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_MacOS.tar.gz) - 也可通过 `brew` 获得\n\n- ### [macOS M1 - ARM](https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_MacOS_ARM.tar.gz) - 也可通过 `brew` 获得\n\n- ### [FreeBSD](https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_FreeBSD.tar.gz)\n\n下载完成后，请转到[用法](#用法)部分。\n\n**或者**，您可以：\n\n- 使用 `Docker` 镜像：\n\n  ```bash\n  docker pull pouriyajamshidi/tcping:latest\n  ```\n\n  \u003e 镜像也可以在 GitHub 容器注册表中找到：\n\n  ```bash\n  docker pull ghcr.io/pouriyajamshidi/tcping:latest\n  ```\n\n- 使用 `go install` 安装：\n\n  Go 版本最低要求为 `1.23.1`\n\n  ```bash\n  go install github.com/pouriyajamshidi/tcping/v2@latest\n  ```\n\n- 使用 `brew` 安装：\n\n  ```bash\n  brew install pouriyajamshidi/tap/tcping\n  ```\n\n- [x tcping](https://x-cmd.com/pkg/tcping)\n  \n   在 x-cmd 中，无需安装即可**直接使用 tcping 命令**：\n\n   ```bash\n   x tcping bing.com 80\n   ```\n\n   或者，你也可以选择将 tcping 安装到用户空间，不需 root 特权，亦不影响全局依赖：\n\n   ```bash\n   x env use tcping\n   tcping bing.com 80\n   ```\n\n\n- 或者通过在 `tcping` 目录中运行 `make` 命令来自行编译代码：\n\n  ```bash\n  make build\n  ```\n\n  这将在 `executables` 文件夹中为您提供一个压缩文件，其中包含所有受支持操作系统的可执行文件。\n\n---\n\n## 用法\n\n请按照您操作系统的说明进行操作：\n\n- [TCPING](#tcping)\n  - [目录](#目录)\n  - [演示](#演示)\n    - [基本用法](#基本用法)\n    - [重试主机名查找 (`-r`)](#重试主机名查找--r)\n    - [JSON 格式输出 (`-j --pretty`)](#json-格式输出--j---pretty)\n  - [下载](#下载)\n  - [用法](#用法)\n    - [Linux - Debian 和 Ubuntu](#linux---debian-和-ubuntu)\n    - [Linux、BSD 和 mac OS](#linuxbsd-和-mac-os)\n    - [Windows](#windows)\n    - [Docker](#docker)\n  - [标志](#标志)\n  - [提示](#提示)\n  - [检查更新](#检查更新)\n  - [贡献](#贡献)\n  - [功能请求和问题](#功能请求和问题)\n  - [测试平台](#测试平台)\n  - [帮助项目](#帮助项目)\n  - [许可证](#许可证)\n\n另请查看[此处提供的可用标志](#标志)。\n\n### Linux - Debian 和 Ubuntu\n\n在 **Debian** 及其衍生版本（如 **Ubuntu**）上，下载 `.deb` 软件包：\n\n```bash\nwget https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping_amd64.deb -O /tmp/tcping.deb\n```\n\n并安装它：\n\n```bash\nsudo apt install -y /tmp/tcping.deb\n```\n\n如果您使用的是其他 Linux 发行版，请继续阅读[本节](#linux-bsd-和-mac-os)。\n\n### Linux、BSD 和 mac OS\n\n解压缩文件：\n\n```bash\ntar -xvf tcping_Linux.tar.gz\n#\n# 或在 Mac OS 上\n#\ntar -xvf tcping_MacOS.tar.gz\n#\n# 在 Mac OS ARM 上\n#\ntar -xvf tcping_MacOS_ARM.tar.gz\n#\n# 在 BSD 上\n#\ntar -xvf tcping_FreeBSD.tar.gz\n```\n\n设置文件为可执行：\n\n```bash\nchmod +x tcping\n```\n\n将可执行文件复制到您的系统 `PATH` 中，例如 `/usr/local/bin/`：\n\n```bash\nsudo cp tcping /usr/local/bin/\n```\n\n运行：\n\n```bash\ntcping www.example.com 443\n# 或\ntcping 10.10.10.1 22\n```\n\n### Windows\n\n我们建议使用 [Windows 终端](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 以获得最佳体验和正确的颜色显示。\n\n将 `tcping.exe` 复制到您的系统 [PATH](https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/) 中，例如 `C:\\Windows\\System32`，然后像这样运行它：\n\n```powershell\ntcping www.example.com 443\n# 或提供 -r 标志以\n# 在一定次数的失败后启用名称解析重试：\ntcping www.example.com 443 -r 10\n```\n\n\u003e TCPING 可能会被 Windows Defender 或某些反恶意软件错误地标记。这在 Go 程序中很常见。请查看 Go 的官方文档 [此处](https://go.dev/doc/faq#virus)。\n\n### Docker\n\nDocker 镜像可以像这样使用：\n\n```bash\n# 使用 Docker Hub\ndocker run -it pouriyajamshidi/tcping:latest example.com 443\n\n# 使用 GitHub 容器注册表：\ndocker run -it ghcr.io/pouriyajamshidi/tcping:latest example.com 443\n```\n\n---\n\n## 标志\n\n以下标志可用于控制应用程序的行为：\n\n| 标志                   | 描述                                                                             |\n| ---------------------- | ------------------------------------------------------------------------------- |\n| `-h`                   | 显示帮助                                                                          |\n| `-4`                   | 仅使用 IPv4 地址                                                                  |\n| `-6`                   | 仅使用 IPv6 地址                                                                  |\n| `-r`                   | 在 `\u003cn\u003e` 次探测失败后重试解析目标主机名。例如，-r 10 表示在 10 次探测失败后重试            |\n| `-c`                   | 在 `\u003cn\u003e` 次探测后停止，无论结果如何。默认情况下，不应用限制                              |\n| `-t`                   | 等待响应的时间（以秒为单位）。允许使用实数。0 表示无限超时                                |\n| `-D`                   | 在探测输出中显示日期和时间。类似于 Linux 的 ping 工具，但更易于阅读                      |\n| `-i`                   | 发送探测之间的间隔                                                                 |\n| `-I`                   | 用于发送探测的接口名称                                                              |\n| `--no-color`           | 输出不带颜色                                                                      |\n| `--csv`                | 以 CSV 格式输出到指定的文件路径                                                     |\n| `-j`                   | 以 `JSON` 格式输出                                                                |\n| `--pretty`             | 美化 `JSON` 输出                                                                 |\n| `--db`                 | 用于存储 tcping 输出到 sqlite 数据库的路径和文件名。例如 `--db /tmp/tcping.db`         |\n| `-v`                   | 打印版本                                                                         |\n| `-u`                   | 检查更新                                                                         |\n| `--show-failures-only` | 仅显示探测失败，并省略打印探测成功消息                                                |\n| `--show-source-address` | 显示探测所用的来源IP地址及端口                                                      | \n\n\u003e 如果未指定 `-4` 和 `-6` 标志，tcping 将根据 DNS 查找随机选择一个 IP 地址。\n\n---\n\n## 提示\n\n- 在程序运行时按 `Enter` 键，可以在不终止程序的情况下查看所有探测的摘要，如[演示](#演示)部分所示。\n\n---\n\n## 检查更新\n\n`TCPING` 正在不断改进，添加了许多新功能并修复了错误。请务必查看更新的版本。\n\n```bash\ntcping -u\n```\n\n## 贡献\n\n欢迎提交拉取请求以解决错误、添加新功能以及帮助解决可以在[此处](https://github.com/pouriyajamshidi/tcping/issues)找到的未解决问题\n\n1. 选择您觉得可以处理的任何问题。\n1. Fork 存储库。\n1. 创建一个分支。\n1. 提交您的工作。\n1. 如果可能，请添加测试。\n1. 运行测试 `go test` 或 `make test` 并确保它们成功。\n1. 创建一个拉取请求\n\n当前未解决问题的数量：![GitHub issues](https://img.shields.io/github/issues/pouriyajamshidi/tcping.svg)。\n\n请确保您的拉取请求**仅涵盖一个特定的问题/功能**，并且不处理两个或多个问题。这使我们更容易检查您的拉取请求，并有助于保持干净的 git 历史记录。\n\n## 功能请求和问题\n\n如果您需要新功能或发现错误，请随时[打开拉取请求](#贡献)或提交问题。\n\n\u003e 对于较大的功能/贡献，请确保在开始工作之前先在 `issue` 上进行沟通。\n\n## 测试平台\n\nWindows、Linux 和 macOS。\n\n## 帮助项目\n\n如果 tcping 对您有用，请考虑给它一个 ⭐ 以扩大其影响力并帮助其他人也从中受益。\n\n此外，您可以使用以下链接支持该项目。\n\n请我喝杯咖啡：[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/pouriyajamshidi)\n\nGitHub 赞助：[![sponsor](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/pouriyajamshidi)\n\n赞助总数：![GitHub Sponsor](https://img.shields.io/github/sponsors/pouriyajamshidi?label=Sponsor\u0026logo=GitHub)\n\n## 许可证\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouriyajamshidi%2Ftcping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpouriyajamshidi%2Ftcping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouriyajamshidi%2Ftcping/lists"}