惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
I
InfoQ
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
Recent Announcements
Recent Announcements
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
Docker
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
博客园 - Franky
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
WordPress大学
WordPress大学
MyScale Blog
MyScale Blog
月光博客
月光博客
罗磊的独立博客

Allen Hua 的网络博客

由于 Linux 桌面没有一个好用的天气程序就写了一个跨平台的CheckitoutWeather 给 caesium-image-compressor 图片压缩程序构建了 Linux AppImage v2.8.5 最新版 debian13(debian trixie)安装了nvidia闭源驱动后从x11切换到wayland的方法 山间摩旅追风,偶遇一场绚烂晚霞 最近使用debian系统的一些心得 机械革命无界14Pro笔记本debian forky成功驱动内置扬声器和麦克风 记录 typecho 1.2.0 升级到 1.3.0 过程 开发了一款openwrt插件:文本剪贴板 解决机械革命笔记本内屏高刷240Hz闪屏问题 使用 Java 写了一个局域网端口扫描器 - Allen Hua 的网络博客 openwrt使用外置根extroot机制扩展根分区大小 - Allen Hua 的网络博客 将机场ss节点批量转换成ss字符串链接批量添加到passwall - Allen Hua 的网络博客 给机械革命钛钽plus换屏:NY2换成NZ2 - Allen Hua 的网络博客 记录一次pve宿主机和上面的debian虚机无故down机事件 - Allen Hua 的网络博客 给图床部署cdn腾讯云的edgeone并排查Cache-Control max-age 3600的问题 - Allen Hua 的网络博客 从高山草甸到徽派古村:武功山反穿与皖浙赣自驾行记 - Allen Hua 的网络博客 增程器就是充电宝?别被忽悠了 - Allen Hua 的网络博客 浦口龙虎巷扫街,记录人间真实 博客图片压缩方案更新|AVIF|WebP|MozJPEG|标准JPEG Windows 电脑使用 Obs Studio 录制各个网站视频/桌面画面教程 为typecho博客添加latex支持 新能源汽车之纯电车使用交流慢充和直流快充的充电损耗对比 2025年3月更新全国5A景区名录 2025最新查看小米/红米手机电池健康度和循环次数方法 完美解决 seafile FILE_SERVER_ROOT 配置导致的内网外网不能同时访问和上传下载的问题 纯css实现typecho博客文章文字spoiler剧透效果 我对Typecho Facile主题的一些修改,图片懒加载优化,样式定制 2024年8月我的宜昌 - 重庆 - 川西小环线自驾旅行分享 2022年打卡南京市区人防工程纳凉点 2024年带着A7C2+腾龙28-200 再次来到红山森林动物园
给 mac 安装个更好的 tcping
Allen Hua · 2021-11-07 · via Allen Hua 的网络博客
阅读量:14731

warning: 这篇文章距离上次修改已过1661天,其中的内容可能已经有所变动。

最近在局域网部署了透明代理/网关,想要测试一下局域网设备的 terminal 是否能正常通过 tcp 无感连接到 Internet,于是安装 tcping 测试。

我的 mac 还是 intel mac,macOS version 还是 10.15.4

众所周知 brew 官方源(是官方源这种说法吗?)提供了 tcping 工具,大小也很小。

brew install tcping

使用上面的命令就可以安装,如果有网络问题建议在终端使用代理,比如

export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890

安装好的 tcping 位于 /usr/local/bin/tcping

但是这货实在是太“简洁”了(usage 如下),不是我们想要的基于 tcp 的 ping 功能,似乎只能检测端口是否有打开。

tcping --help
error: Usage: tcping [-q] [-t timeout_sec] [-u timeout_usec] <host> <port>

下面推荐一个开源项目,给你的 mac 安装个比 brew “自带的”更好的 tcping 工具吧。

paradiseduo/tcping ,喜欢的话可以给原作者一个 star ⭐️️

安装方式如作者所说。如果你事先有安装上面 brew 那个,先卸载之,使用命令 brew uninstall tcping,然后开始安装

wget https://github.com/paradiseduo/tcping/releases/download/3.5/tcping.zip
unzip tcping.zip
chmod +x tcping
mv tcping /usr/local/bin/
sudo xattr -rd com.apple.quarantine /usr/local/bin/tcping
tcping -c 4 www.baidu.com 80
www.baidu.com:80 has address: 112.80.248.75:80 - Connected - 31.581ms
www.baidu.com:80 has address: 112.80.248.75:80 - Connected - 11.17ms
www.baidu.com:80 has address: 112.80.248.75:80 - Connected - 11.643ms
www.baidu.com:80 has address: 112.80.248.75:80 - Connected - 5.061ms
Ping statistics www.baidu.com:80
    4 probes sent.
    4 successful, 0 failed.
Approximate trip times:
    Minimum = 5.061ms, Maximum = 31.581ms, Average = 14.864ms

tcping -c 4 www.google.com 443
www.google.com:443 has address: 157.240.17.41:443 - Connected - 11.16ms
www.google.com:443 has address: 157.240.17.41:443 - Connected - 4.656ms
www.google.com:443 has address: 157.240.17.41:443 - Connected - 11.117ms
www.google.com:443 has address: 157.240.17.41:443 - Connected - 11.06ms
Ping statistics www.google.com:443
    4 probes sent.
    4 successful, 0 failed.
Approximate trip times:
    Minimum = 4.656ms, Maximum = 11.16ms, Average = 9.498ms

经过测试局域网设备的 terminal 可以无感通过 tcp 连接到 Internet。但是 http_proxy 和 https_proxy 以及 socks5 proxy 需要手动 export

usage

tcping --help

      dP                     oo
      88
    d8888P .d8888b. 88d888b. dP 88d888b. .d8888b.    {Version: 3.5}
      88   88       88    88 88 88    88 88    88
      88   88.      88.  .88 88 88    88 88.  .88
      dP   `88888P  88Y888P  dP dP    dP `8888P88
                    88                        .88
                    dP                    d8888P

tcping is a ping over tcp connection.

Examples:
    1. ping over tcp with custom port 10 times
        > tcping www.baidu.com 80
    2. ping over tcp with custom port 5 times
        > tcping -c 5 www.baidu.com 443

USAGE: tcping [--count <count>] [--interval <interval>] <ip> <port>

ARGUMENTS:
    <ip>                        The IP or Domain to tcping.
    <port>                      The port to tcping.

OPTIONS:
    -c, --count <count>         The number of times to repeat 'tcping'. Default value is 10, Max value is 65535
    -i, --interval <interval>   The request interval(second). Default value is 1 second 
    -h, --help                  Show help information.

3.5 版本增加了选项 -i, --interval <interval> The request interval(second). Default value is 1 second (新增-i --interval参数,可以设置每次tcping的时间间隔,单位为秒,100毫秒可以传0.1)

至此,舒服了。