4 Commits

Author SHA1 Message Date
xiu2
8264138dd8 README.md 2021-11-27 23:24:42 +08:00
xiu2
6cb94db59e 新增 下载测速也会使用 -tp 参数指定的端口; 调整 下载测速进度条数字 2021-11-27 23:21:02 +08:00
xiu2
85923cf335 README.md 2021-11-27 21:57:14 +08:00
xiu2
60631a958f Update 2021-11-20 10:32:11 +08:00
4 changed files with 21 additions and 7 deletions

View File

@@ -115,7 +115,7 @@ https://github.com/XIU2/CloudflareSpeedTest
-t 4
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IPTCP协议(默认 4)
-tp 443
延迟测速端口;延迟测速 TCP 协议的端口;(默认 443)
指定测速端口;延迟测速/下载测速时使用的端口;(默认 443)
-dn 10
下载测速数量;延迟测速并排序后,从最低延迟起下载测速的数量;(默认 10)
-dt 10
@@ -175,7 +175,16 @@ CloudflareST.exe -f 2.txt -o "" -p 10 -dd
# 指定 IPv4 数据文件 及 输出结果到文件(相对路径,即当前目录下,如含空格请加上引号)
CloudflareST.exe -f 3.txt -o result.txt -dd
# 指定 IPv4 数据文件 及 输出结果到文件(相对路径,即当前目录内的 abc 文件夹下,如含空格请加上引号)
# LinuxCloudflareST 程序所在目录内的 abc 文件夹下)
./CloudflareST -f abc/3.txt -o abc/result.txt -dd
# Windows注意是反斜杠
CloudflareST.exe -f abc\3.txt -o abc\result.txt -dd
# 指定 IPv4 数据文件 及 输出结果到文件(绝对路径,即 C:\abc\ 目录下,如含空格请加上引号)
# Linux/abc/ 目录下)
./CloudflareST -f /abc/4.txt -o /abc/result.csv -dd
# Windows注意是反斜杠
CloudflareST.exe -f C:\abc\4.txt -o C:\abc\result.csv -dd
```
****
@@ -185,6 +194,9 @@ CloudflareST.exe -f C:\abc\4.txt -o C:\abc\result.csv -dd
# 地址要求:可以直接下载、文件大小超过 200MB、用的是 Cloudflare CDN
CloudflareST.exe -url https://cf.xiu2.xyz/Github/CloudflareSpeedTest.png
# 因为默认下载测速地址的文件大小只有 300MB如果你速度太快的话测速结果可能会低于实际速度。
# 注意:如果下载测速地址为 HTTP 协议,记得加上 -tp 80这个参数会影响 延迟测速/下载测速 时使用的端口)
CloudflareST.exe -tp 80 -url http://xxx/xxx
```
****
#### \# 自定义测速条件

1
ip.txt
View File

@@ -13,7 +13,6 @@
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
162.159.204.0/24
104.16.0.0/13
104.24.0.0/14
172.64.0.0/17

View File

@@ -30,7 +30,7 @@ https://github.com/XIU2/CloudflareSpeedTest
-t 4
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IPTCP协议(默认 4)
-tp 443
延迟测速端口;延迟测速 TCP 协议的端口;(默认 443)
指定测速端口;延迟测速/下载测速时使用的端口;(默认 443)
-dn 10
下载测速数量;延迟测速并排序后,从最低延迟起下载测速的数量;(默认 10)
-dt 10
@@ -63,7 +63,7 @@ https://github.com/XIU2/CloudflareSpeedTest
var minDelay, maxDelay, downloadTime int
flag.IntVar(&task.Routines, "n", 200, "测速线程数量")
flag.IntVar(&task.PingTimes, "t", 4, "延迟测速次数")
flag.IntVar(&task.TCPPort, "tp", 443, "延迟测速端口")
flag.IntVar(&task.TCPPort, "tp", 443, "指定测速端口")
flag.IntVar(&maxDelay, "tl", 9999, "平均延迟上限")
flag.IntVar(&minDelay, "tll", 0, "平均延迟下限")
flag.IntVar(&downloadTime, "dt", 10, "下载测速时间")
@@ -134,7 +134,7 @@ func endPrint() {
func checkUpdate() {
timeout := 10 * time.Second
client := http.Client{Timeout: timeout}
res, err := client.Get("https://api.xiuer.pw/ver/cloudflarespeedtest.txt")
res, err := client.Get("https://api.xiu2.xyz/ver/cloudflarespeedtest.txt")
if err != nil {
return
}

View File

@@ -63,6 +63,9 @@ func TestDownloadSpeed(ipSet utils.PingDelaySet) (speedSet utils.DownloadSpeedSe
if len(ipSet) < TestCount || MinSpeed > 0 { // 如果IP数组长度(IP数量) 小于下载测速数量(-dn则次数修正为IP数
testNum = len(ipSet)
}
if testNum < TestCount {
TestCount = testNum
}
fmt.Printf("开始下载测速(下载速度下限:%.2f MB/s下载测速数量%d下载测速队列%d\n", MinSpeed, TestCount, testNum)
bar := utils.NewBar(TestCount)
@@ -88,9 +91,9 @@ func TestDownloadSpeed(ipSet utils.PingDelaySet) (speedSet utils.DownloadSpeedSe
}
func getDialContext(ip *net.IPAddr) func(ctx context.Context, network, address string) (net.Conn, error) {
fakeSourceAddr := ip.String() + ":443"
fakeSourceAddr := ip.String() + ":" + fmt.Sprintf("%d", TCPPort)
if IPv6 { // IPv6 需要加上 []
fakeSourceAddr = "[" + ip.String() + "]:443"
fakeSourceAddr = "[" + ip.String() + "]:" + fmt.Sprintf("%d", TCPPort)
}
return func(ctx context.Context, network, address string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, network, fakeSourceAddr)