调整 文字格式细节

This commit is contained in:
xiu2
2021-11-14 15:16:32 +08:00
parent 445ca36877
commit e5bbd07aea
4 changed files with 19 additions and 19 deletions

View File

@@ -111,35 +111,35 @@ https://github.com/XIU2/CloudflareSpeedTest
参数: 参数:
-n 200 -n 200
测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请适当调低(默认 200 最多 1000 ) 测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请勿太高(默认 200 最多 1000)
-t 4 -t 4
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IPTCP协议(默认 4 ) 延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IPTCP协议(默认 4)
-tp 443 -tp 443
延迟测速端口;延迟测速 TCP 协议的端口;(默认 443 ) 延迟测速端口;延迟测速 TCP 协议的端口;(默认 443)
-dn 10 -dn 10
下载测速数量;延迟测速并排序后,从最低延迟起下载测速的数量;(默认 10 ) 下载测速数量;延迟测速并排序后,从最低延迟起下载测速的数量;(默认 10)
-dt 10 -dt 10
下载测速时间;单个 IP 下载测速最长时间,单位:秒;(默认 10 ) 下载测速时间;单个 IP 下载测速最长时间,单位:秒;(默认 10)
-url https://cf.xiu2.xyz/Github/CloudflareSpeedTest.png -url https://cf.xiu2.xyz/Github/CloudflareSpeedTest.png
下载测速地址;用来下载测速的 Cloudflare CDN 文件地址,如地址含有空格请加上引号; 下载测速地址;用来下载测速的 Cloudflare CDN 文件地址,如地址含有空格请加上引号;
-tl 200 -tl 200
平均延迟上限;只输出低于指定平均延迟的 IP可与其他上限/下限搭配;(默认 9999 ms) 平均延迟上限;只输出低于指定平均延迟的 IP可与其他上限/下限搭配;(默认 9999 ms)
-tll 40 -tll 40
平均延迟下限;只输出高于指定平均延迟的 IP可与其他上限/下限搭配过滤被假蔷的 IP(默认 0 ms) 平均延迟下限;只输出高于指定平均延迟的 IP可与其他上限/下限搭配过滤被假蔷的 IP(默认 0 ms)
-sl 5 -sl 5
下载速度下限;只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速;(默认 0.00 MB/s) 下载速度下限;只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速;(默认 0.00 MB/s)
-p 10 -p 10
显示结果数量;测速后直接显示指定数量的结果,为 0 时不显示结果直接退出;(默认 10 ) 显示结果数量;测速后直接显示指定数量的结果,为 0 时不显示结果直接退出;(默认 10)
-f ip.txt -f ip.txt
IP段数据文件如路径含有空格请加上引号支持其他 CDN IP段(默认 ip.txt ) IP段数据文件如路径含有空格请加上引号支持其他 CDN IP段(默认 ip.txt)
-o result.csv -o result.csv
写入结果文件;如路径含有空格请加上引号;值为空时不写入文件 [-o ""](默认 result.csv ) 写入结果文件;如路径含有空格请加上引号;值为空时不写入文件 [-o ""](默认 result.csv)
-dd -dd
禁用下载测速;禁用后测速结果会按延迟排序 (默认按下载速度排序)(默认 启用 ) 禁用下载测速;禁用后测速结果会按延迟排序 (默认按下载速度排序)(默认 启用)
-ipv6 -ipv6
IPv6测速模式确保 IP 段数据文件内只包含 IPv6 IP段软件不支持同时测速 IPv4+IPv6(默认 IPv4 ) IPv6测速模式确保 IP 段数据文件内只包含 IPv6 IP段软件不支持同时测速 IPv4+IPv6(默认 IPv4)
-allip -allip
测速全部的IP对 IP 段中的每个 IP (仅支持 IPv4) 进行测速;(默认 每个 IP 段随机测速一个 IP ) 测速全部的IP对 IP 段中的每个 IP (仅支持 IPv4) 进行测速;(默认 每个 IP 段随机测速一个 IP)
-v -v
打印程序版本+检查版本更新 打印程序版本+检查版本更新
-h -h

10
main.go
View File

@@ -40,7 +40,7 @@ https://github.com/XIU2/CloudflareSpeedTest
-tl 200 -tl 200
平均延迟上限;只输出低于指定平均延迟的 IP可与其他上限/下限搭配;(默认 9999 ms) 平均延迟上限;只输出低于指定平均延迟的 IP可与其他上限/下限搭配;(默认 9999 ms)
-tll 40 -tll 40
平均延迟下限;只输出高于指定平均延迟的 IP可与其他上限/下限搭配过滤被假蔷的 IP(默认 0 ms) 平均延迟下限;只输出高于指定平均延迟的 IP可与其他上限/下限搭配过滤被假蔷的 IP(默认 0 ms)
-sl 5 -sl 5
下载速度下限;只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速;(默认 0.00 MB/s) 下载速度下限;只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速;(默认 0.00 MB/s)
-p 10 -p 10
@@ -81,7 +81,7 @@ https://github.com/XIU2/CloudflareSpeedTest
flag.Parse() flag.Parse()
if task.MinSpeed > 0 && time.Duration(maxDelay)*time.Millisecond == utils.InputMaxDelay { if task.MinSpeed > 0 && time.Duration(maxDelay)*time.Millisecond == utils.InputMaxDelay {
fmt.Println("[警告] '-sl' 参数建议和 '-tl' 参数一起使用") fmt.Println("[小提示] 在使用 [-sl] 参数时,建议搭配 [-tl] 参数,以避免因凑不够 [-dn] 数量而一直测速...")
} }
utils.InputMaxDelay = time.Duration(maxDelay) * time.Millisecond utils.InputMaxDelay = time.Duration(maxDelay) * time.Millisecond
utils.InputMinDelay = time.Duration(minDelay) * time.Millisecond utils.InputMinDelay = time.Duration(minDelay) * time.Millisecond
@@ -92,7 +92,7 @@ https://github.com/XIU2/CloudflareSpeedTest
fmt.Println("检查版本更新中...") fmt.Println("检查版本更新中...")
checkUpdate() checkUpdate()
if versionNew != "" { if versionNew != "" {
fmt.Println("发现新版本 [" + versionNew + "]!请前往 [https://github.com/XIU2/CloudflareSpeedTest] 更新!") fmt.Printf("*** 发现新版本 [%s]!请前往 [https://github.com/XIU2/CloudflareSpeedTest] 更新! ***", versionNew)
} else { } else {
fmt.Println("当前为最新版本 [" + version + "]") fmt.Println("当前为最新版本 [" + version + "]")
} }
@@ -103,7 +103,7 @@ https://github.com/XIU2/CloudflareSpeedTest
func main() { func main() {
go checkUpdate() // 检查版本更新 go checkUpdate() // 检查版本更新
fmt.Printf("# XIU2/CloudflareSpeedTest %s \n", version) fmt.Printf("# XIU2/CloudflareSpeedTest %s \n\n", version)
// 开始延迟测速 // 开始延迟测速
pingData := task.NewPing().Run().FilterDelay() pingData := task.NewPing().Run().FilterDelay()
@@ -123,7 +123,7 @@ func endPrint() {
return return
} }
if runtime.GOOS == "windows" { // 如果是 Windows 系统,则需要按下 回车键 或 Ctrl+C 退出(避免通过双击运行时,测速完毕后直接关闭) if runtime.GOOS == "windows" { // 如果是 Windows 系统,则需要按下 回车键 或 Ctrl+C 退出(避免通过双击运行时,测速完毕后直接关闭)
fmt.Println("\n按下 回车键 或 Ctrl+C 退出。") fmt.Printf("\n按下 回车键 或 Ctrl+C 退出。")
var pause int var pause int
fmt.Scanln(&pause) fmt.Scanln(&pause)
} }

View File

@@ -66,7 +66,7 @@ func (p *Ping) Run() utils.PingDelaySet {
if IPv6 { // IPv6 模式判断 if IPv6 { // IPv6 模式判断
ipVersion = "IPv6" ipVersion = "IPv6"
} }
fmt.Printf("开始延迟测速模式TCP %s端口%d平均延迟上限%vms平均延迟下限%vms)\n", ipVersion, TCPPort, utils.InputMaxDelay.Milliseconds(), utils.InputMinDelay.Milliseconds()) fmt.Printf("开始延迟测速模式TCP %s端口%d平均延迟上限%v ms平均延迟下限%v ms)\n", ipVersion, TCPPort, utils.InputMaxDelay.Milliseconds(), utils.InputMinDelay.Milliseconds())
for _, ip := range p.ips { for _, ip := range p.ips {
p.wg.Add(1) p.wg.Add(1)
p.control <- false p.control <- false

View File

@@ -161,6 +161,6 @@ func (s DownloadSpeedSet) Print(ipv6 bool) {
fmt.Printf(dataFormat, dateString[i][0], dateString[i][1], dateString[i][2], dateString[i][3], dateString[i][4], dateString[i][5]) fmt.Printf(dataFormat, dateString[i][0], dateString[i][1], dateString[i][2], dateString[i][3], dateString[i][4], dateString[i][5])
} }
if !noOutput() { if !noOutput() {
fmt.Printf("\n完整测速结果已写入 %v 文件,使用记事本/表格软件查看。\n", Output) fmt.Printf("\n完整测速结果已写入 %v 文件,使用记事本/表格软件查看。", Output)
} }
} }