mirror of
https://github.com/XIU2/CloudflareSpeedTest.git
synced 2026-04-18 20:26:09 +08:00
v1.2.2 新增自定义输出结果文件功能等
This commit is contained in:
16
main.go
16
main.go
@@ -14,6 +14,7 @@ import (
|
||||
var version string
|
||||
var disableDownload bool
|
||||
var ipFile string
|
||||
var outputFile string
|
||||
|
||||
func init() {
|
||||
var downloadSecond int64
|
||||
@@ -33,7 +34,9 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
-dt 10
|
||||
下载测速时间;单个 IP 测速最长时间,单位:秒;(默认 10)
|
||||
-f ip.txt
|
||||
IP 数据文件;支持相对路径和绝对路径,如果包含空格请前后加上引号;(默认 ip.txt)
|
||||
IP 数据文件;相对/绝对路径,如包含空格请加上引号;支持其他 CDN IP段,记得禁用下载测试;(默认 ip.txt)
|
||||
-o result.csv
|
||||
输出结果文件;相对/绝对路径,如包含空格请加上引号;允许 .txt 等后缀;(默认 result.csv)
|
||||
-dd
|
||||
禁用下载测速;如果带上该参数就是禁用下载测速;(默认 启用)
|
||||
-v
|
||||
@@ -42,8 +45,9 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
打印帮助说明
|
||||
|
||||
示例:
|
||||
CloudflareST.exe -n 500 -t 4 -dn 20 -dt 10
|
||||
CloudflareST.exe -n 500 -t 4 -dn 20 -dt 10 -f "C:\abc\ip.txt" -dd`
|
||||
CloudflareST.exe -n 500 -t 4 -dn 20 -dt 10
|
||||
CloudflareST.exe -n 500 -t 4 -dn 20 -dt 10 -f "ip.txt" -o "result.csv" -dd
|
||||
CloudflareST.exe -n 500 -t 4 -dn 20 -dt 10 -f "C:\abc\ip.txt" -o "C:\abc\result.csv" -dd`
|
||||
|
||||
flag.IntVar(&pingRoutine, "n", 500, "测速线程数量")
|
||||
flag.IntVar(&pingTime, "t", 4, "延迟测速次数")
|
||||
@@ -51,6 +55,7 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
flag.Int64Var(&downloadSecond, "dt", 10, "下载测速时间")
|
||||
flag.BoolVar(&disableDownload, "dd", false, "禁用下载测速")
|
||||
flag.StringVar(&ipFile, "f", "ip.txt", "IP 数据文件")
|
||||
flag.StringVar(&outputFile, "o", "result.csv", "输出结果文件")
|
||||
flag.BoolVar(&printVersion, "v", false, "打印程序版本")
|
||||
|
||||
downloadTestTime = time.Duration(downloadSecond) * time.Second
|
||||
@@ -76,6 +81,9 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
if ipFile == "" {
|
||||
ipFile = "ip.txt"
|
||||
}
|
||||
if outputFile == "" {
|
||||
outputFile = "result.csv"
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -118,5 +126,5 @@ func main() {
|
||||
fmt.Println("\n[信息] IP数量为 0,跳过下载测速。")
|
||||
}
|
||||
}
|
||||
ExportCsv("./result.csv", data) // 输出结果
|
||||
ExportCsv(outputFile, data) // 输出结果
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user