Compare commits
6 Commits
c9fa405afa
...
8be88edba0
Author | SHA1 | Date |
---|---|---|
scientificworld | 8be88edba0 | |
xiu2 | 6d12e7bac9 | |
xiu2 | 9d9d71fa04 | |
scientificworld | 8e984033dd | |
scientificworld | a74d121d88 | |
scientificworld | ccfd1edb8c |
13
README.md
13
README.md
|
@ -42,11 +42,14 @@ mkdir CloudflareST
|
|||
cd CloudflareST
|
||||
|
||||
# 下载 CloudflareST 压缩包(自行根据需求替换 URL 中 [版本号] 和 [文件名])
|
||||
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.4/CloudflareST_linux_amd64.tar.gz
|
||||
# 如果你是在国内服务器上下载,那么请使用下面这几个镜像加速:
|
||||
# wget -N https://download.fgit.ml/XIU2/CloudflareSpeedTest/releases/download/v2.2.4/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://download.fgit.gq/XIU2/CloudflareSpeedTest/releases/download/v2.2.4/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://ghproxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.4/CloudflareST_linux_amd64.tar.gz
|
||||
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# 如果你是在国内网络环境中下载,那么请使用下面这几个镜像加速之一:
|
||||
# wget -N https://download.nuaa.cf/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://download.scholar.rr.nu/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://ghproxy.cc/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://ghproxy.net/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://gh-proxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# wget -N https://mirror.ghproxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
|
||||
# 如果下载失败的话,尝试删除 -N 参数(如果是为了更新,则记得提前删除旧压缩包 rm CloudflareST_linux_amd64.tar.gz )
|
||||
|
||||
# 解压(不需要删除旧文件,会直接覆盖,自行根据需求替换 文件名)
|
||||
|
|
2
main.go
2
main.go
|
@ -92,7 +92,7 @@ https://github.com/XIU2/CloudflareSpeedTest
|
|||
flag.Float64Var(&task.MinSpeed, "sl", 0, "下载速度下限")
|
||||
|
||||
flag.IntVar(&utils.PrintNum, "p", 10, "显示结果数量")
|
||||
flag.StringVar(&task.IPFile, "f", "ip.txt", "IP段数据文件")
|
||||
flag.StringVar(&task.IPFile, "f", "", "IP段数据文件")
|
||||
flag.StringVar(&task.IPText, "ip", "", "指定IP段数据")
|
||||
flag.StringVar(&utils.Output, "o", "result.csv", "输出结果文件")
|
||||
|
||||
|
|
21
task/ip.go
21
task/ip.go
|
@ -9,15 +9,28 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const defaultInputFile = "ip.txt"
|
||||
|
||||
func getDefaultInputFile() string {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
sym, err := filepath.EvalSymlinks(exe)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return filepath.Join(filepath.Dir(sym), defaultInputFile)
|
||||
}
|
||||
|
||||
var (
|
||||
// TestAll test all ip
|
||||
TestAll = false
|
||||
// IPFile is the filename of IP Rangs
|
||||
IPFile = defaultInputFile
|
||||
IPFile = getDefaultInputFile()
|
||||
IPText string
|
||||
)
|
||||
|
||||
|
@ -165,7 +178,11 @@ func loadIPRanges() []*net.IPAddr {
|
|||
}
|
||||
} else { // 从文件中获取 IP 段数据
|
||||
if IPFile == "" {
|
||||
IPFile = defaultInputFile
|
||||
if _, err := os.Stat(defaultInputFile); err != nil {
|
||||
IPFile = getDefaultInputFile()
|
||||
} else {
|
||||
IPFile = defaultInputFile
|
||||
}
|
||||
}
|
||||
file, err := os.Open(IPFile)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue