给 mac 安装个更好的 tcping
source link: https://hellodk.cn/post/842
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
给 mac 安装个更好的 tcping
最近在局域网部署了透明代理/网关,想要测试一下局域网设备的 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
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)
至此,舒服了。
Recommend
-
13
NDK在mac上的安装 – ruquan.z – github技术博客,成长在于积累。 ruquan.z github技术博客,成长在于积累。
-
9
mac安装rugged失败 – ruquan.z – github技术博客,成长在于积累。 ruquan.z github技术博客,成长在于积累。
-
8
u盘安装mac – ruquan.z – github技术博客,成长在于积累。 ruquan.z github技术博客,成长在于积累。
-
17
今天下午一直在捣鼓如何用PhpStorm进行调试,查找了许多资料,零零碎碎的,所以自己弄篇文章记录一下步骤。 安装xdebug 使用brew安装xdebug,语法如下 brew install homebrew/php/php<version number>-xdebug
-
18
Jitwxs 搜索Mac 安装 brewJitwxs|发表于2020-09-26|更新于2020-12-19|
-
7
VMware 9 安装 Mac OS X 10.8 Mountain Lion 图文全程 2012-10-20 — Yanbin 本教程是在 VMware 9 下安装当前最新版的 Mac OS X Mountain Lion 苹果系统。曾在 VirtualBox/VMware 下安装过 Mac OS Lion 系统,但安装后是无法升级到 Mountain L...
-
8
Mac上的Homebrew安装和oh my zsh安装等相关问题全部评论0只看作者按时间倒序按时间正序推荐阅读...
-
5
Mac OS X下Maven的安装与配置Mac OS X 安装Maven: 下载 Maven, 并解压到某个目录。例如/Users/robbie/apache-maven-3.3.3 打开Terminal,输入以下命令,设...
-
5
这就是 Mac 比 PC 更好的原因MacW教程MacW每天为大家分享软件教程和技巧。我们...
-
18
M1 芯片 Mac 上更好的 Golang 使用方案2022年05月12日
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK