Files
tcping-go/README.md
2024-04-22 14:48:01 +08:00

51 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tcping GO
一个使用go写的小工具用于检测TCP端口是否开放
## 使用方法
你可以简单的测试一个地址的某个端口是否开放可以使用域名或者IP地址默认测试该地址的80端口
```shell
tcping www.baidu.com
使用 www.qq.com 的 A 记录: 175.27.8.138
[1] 来自 175.27.8.138:80 的响应: 时间=29.256ms
[2] 来自 175.27.8.138:80 的响应: 时间=29.086ms
[3] 来自 175.27.8.138:80 的响应: 时间=37.761ms
[4] 来自 175.27.8.138:80 的响应: 时间=30.259ms
测试完成,成功次数: 4/4
```
使用 `-p` 指定端口号,如下
```shell
tcping www.qq.com -p 443
使用 www.qq.com 的 A 记录: 175.27.8.138
[1] 来自 175.27.8.138:443 的响应: 时间=28.835ms
[2] 来自 175.27.8.138:443 的响应: 时间=27.419ms
[3] 来自 175.27.8.138:443 的响应: 时间=44.382ms
[4] 来自 175.27.8.138:443 的响应: 时间=28.356ms
测试完成,成功次数: 4/4
```
使用 `-6` 指定使用IPv6仅对域名有效
```shell
tcping www.qq.com -6
使用 www.qq.com 的 AAAA 记录: 240e:97c:2f:1::5c
[1] 来自 [240e:97c:2f:1::5c]:80 的响应: 时间=30.795ms
[2] 来自 [240e:97c:2f:1::5c]:80 的响应: 时间=30.247ms
[3] 来自 [240e:97c:2f:1::5c]:80 的响应: 时间=30.856ms
[4] 来自 [240e:97c:2f:1::5c]:80 的响应: 时间=30.275ms
测试完成,成功次数: 4/4
```
使用 `-c` 指定测试次数默认为4次
使用 `-t` 指定超时时间默认为2秒
使用 `-f` 来启用快速模式,降低两次成功测试之间的间隔时间