优化 [延迟测速上限/下载速度下限] 支持小数 #51

This commit is contained in:
xiu2 2021-02-04 16:16:29 +08:00
parent faee85edb8
commit 3b957cb1a4
2 changed files with 23 additions and 4 deletions

View File

@ -51,7 +51,6 @@ chmod +x CloudflareST
```
> **注意**:如果是在**路由器**上运行(如 OpenWrt请先**关闭路由器内的代理**,否则测速结果会不准确。
</details>
****
@ -215,6 +214,26 @@ D:\ABC\CloudflareST\CloudflareST.exe -n 500 -t 4 -dn 20 -dt 5 -o " "
# 如果文件路径包含引号,则需要把启动参数放在引号外面,记得引号和 - 之间有空格。
"D:\Program Files\CloudflareST\CloudflareST.exe" -n 500 -t 4 -dn 20 -dt 5 -o " "
```
****
#### \# 单独测速 IP
如果要单独**对一个或多个 IP 进行测速**,只需要把这些 IP 按如下格式写入到任意文本文件中,例如:`1.txt`
```
1.1.1.1/32
2.2.2.2/32
```
然后运行 CloudflareST 时加上启动参数 `-f 1.txt` 即可。
``` bash
# 先进入 CloudflareST 所在目录,然后运行:
# Windows在 CMD 中运行)
CloudflareST.exe -f 1.txt
# Linux
./CloudflareST -f 1.txt
```
****
#### \# 自动更新 Hosts

View File

@ -41,9 +41,9 @@ https://github.com/XIU2/CloudflareSpeedTest
-url https://cf.xiu2.xyz/Github/CloudflareSpeedTest.png
下载测速地址用来下载测速的 Cloudflare CDN 文件地址如地址含有空格请加上引号
-tl 200
平均延迟上限只输出低于指定平均延迟的 IP与下载速度下限搭配使用(默认 9999 ms)
平均延迟上限只输出低于指定平均延迟的 IP与下载速度下限搭配使用(默认 9999.00 ms)
-sl 5
下载速度下限只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速(默认 0 MB/s)
下载速度下限只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速(默认 0.00 MB/s)
-p 20
显示结果数量测速后直接显示指定数量的结果 0 时不显示结果直接退出(默认 20)
-f ip.txt
@ -170,7 +170,7 @@ func main() {
} else if timeLimit > 0 || speedLimit >= 0 {
downloadTestCount_2 = len(data) // 如果指定了任意一个条件,则临时变量改为总数量
}
fmt.Println("开始下载测速(延迟时间上限:" + fmt.Sprintf("%f", timeLimit) + " ms下载速度下限" + fmt.Sprintf("%f", speedLimit) + " MB/s")
fmt.Println("开始下载测速(延迟时间上限:" + fmt.Sprintf("%.2f", timeLimit) + " ms下载速度下限" + fmt.Sprintf("%.2f", speedLimit) + " MB/s")
bar = pb.Simple.Start(downloadTestCount)
for i := 0; i < downloadTestCount_2; i++ {
_, speed := DownloadSpeedHandler(data[i].ip)