From 3b957cb1a43e1d03d22b56a7bf60e035353391d5 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 4 Feb 2021 16:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=E6=B5=8B=E9=80=9F=E4=B8=8A=E9=99=90/=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E4=B8=8B=E9=99=90]=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=B0=8F=E6=95=B0=20#51?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 ++++++++++++++++++++- main.go | 6 +++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d43c51e..2ce7e8f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,6 @@ chmod +x CloudflareST ``` > **注意**:如果是在**路由器**上运行(如 OpenWrt),请先**关闭路由器内的代理**,否则测速结果会不准确。 - **** @@ -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 diff --git a/main.go b/main.go index 000176f..032ff03 100644 --- a/main.go +++ b/main.go @@ -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)