mirror of
https://github.com/XIU2/CloudflareSpeedTest.git
synced 2026-03-10 00:25:57 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7212110dde | ||
|
|
d651fdeb54 | ||
|
|
d453124943 | ||
|
|
e92badf8be | ||
|
|
01dc5df491 | ||
|
|
b428775cc5 | ||
|
|
5202f73108 | ||
|
|
1bb45af3f1 |
@@ -64,8 +64,12 @@ func loadFirstIPOfRangeFromFile(ipFile string) []net.IPAddr {
|
||||
scanner.Split(bufio.ScanLines)
|
||||
for scanner.Scan() {
|
||||
IPString := scanner.Text()
|
||||
if !strings.Contains(IPString, "/") { // 如果不含有 / 则代表不是 IP 段,而是一个单独的 IP,因此需要加上 /32 子网掩码
|
||||
IPString += "/32"
|
||||
if !strings.Contains(IPString, "/") { // 如果不含有 / 则代表不是 IP 段,而是一个单独的 IP,因此需要加上 /32 /128 子网掩码
|
||||
if ipv6Mode {
|
||||
IPString += "/128"
|
||||
} else {
|
||||
IPString += "/32"
|
||||
}
|
||||
}
|
||||
firstIP, IPRange, err := net.ParseCIDR(IPString)
|
||||
//fmt.Println(firstIP)
|
||||
@@ -104,8 +108,10 @@ func loadFirstIPOfRangeFromFile(ipFile string) []net.IPAddr {
|
||||
for IPRange.Contains(firstIP) {
|
||||
//fmt.Println(firstIP)
|
||||
//fmt.Println(firstIP[0], firstIP[1], firstIP[2], firstIP[3], firstIP[4], firstIP[5], firstIP[6], firstIP[7], firstIP[8], firstIP[9], firstIP[10], firstIP[11], firstIP[12], firstIP[13], firstIP[14], firstIP[15])
|
||||
firstIP[15] = randipEndWith(255) // 随机 IP 的最后一段
|
||||
firstIP[14] = randipEndWith(255) // 随机 IP 的最后一段
|
||||
if !strings.Contains(IPString, "/128") {
|
||||
firstIP[15] = randipEndWith(255) // 随机 IP 的最后一段
|
||||
firstIP[14] = randipEndWith(255) // 随机 IP 的最后一段
|
||||
}
|
||||
firstIPCopy := make([]byte, len(firstIP))
|
||||
copy(firstIPCopy, firstIP)
|
||||
firstIPs = append(firstIPs, net.IPAddr{IP: firstIPCopy})
|
||||
|
||||
19
README.md
19
README.md
@@ -1,17 +1,18 @@
|
||||
# XIU2/CloudflareSpeedTest
|
||||
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/blob/master/go.mod)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/releases/latest)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/blob/master/LICENSE)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/stargazers)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/network/members)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/releases/latest)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/)
|
||||
[](https://github.com/XIU2/CloudflareSpeedTest/)
|
||||
|
||||
[国外很多网站](https://github.com/XIU2/CloudflareSpeedTest/discussions/62)都在使用 Cloudflare CDN,但分配给中国访客的 IP 并不友好(高延迟/高丢包/速度慢等)。
|
||||
虽然 Cloudflare 公开了所有 [IP 段](https://www.cloudflare.com/ips/) ,但想要在这么多 IP 中找到适合自己的,怕是要累死,所以就有了这个软件。
|
||||
|
||||
**「自选 IP/优选 IP」测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4+IPv6)**!好用的话**点个⭐鼓励一下下~**
|
||||
**「自选 IP/优选 IP」测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4+IPv6)**!好用的话**点个⭐鼓励一下叭~**
|
||||
|
||||
> _我另一个开源项目: **[一个 \[油猴脚本\] 轻松解决「Github」文件下载速度慢的问题!+ 其他原创油猴脚本~](https://github.com/XIU2/UserScript)**_
|
||||
> _分享我的其他开源项目:[**TrackersList.com** - 全网热门 BT Tracker 列表!有效提高 BT 下载速度~](https://github.com/XIU2/TrackersListCollection) <img src="https://img.shields.io/github/stars/XIU2/TrackersListCollection.svg?style=flat-square&label=Star&color=4285dd&logo=github" height="16px" />_
|
||||
> _[一个 **\[油猴脚本\]** 轻松解决「Github」文件下载速度慢的问题!](https://github.com/XIU2/UserScript)(及十几个油猴脚本 <img src="https://img.shields.io/github/stars/XIU2/UserScript.svg?style=flat-square&label=Star&color=4285dd&logo=github" height="16px" />_
|
||||
|
||||
****
|
||||
## 快速使用
|
||||
@@ -36,7 +37,7 @@ mkdir CloudflareST
|
||||
cd CloudflareST
|
||||
|
||||
# 下载 CloudflareST 压缩包(自行根据需求替换 URL 中版本号和文件名)
|
||||
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v1.4.7/CloudflareST_linux_amd64.tar.gz
|
||||
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v1.5.0/CloudflareST_linux_amd64.tar.gz
|
||||
|
||||
# 解压(不需要删除旧文件,会直接覆盖,自行根据需求替换 文件名)
|
||||
tar -zxf CloudflareST_linux_amd64.tar.gz
|
||||
@@ -196,7 +197,7 @@ CloudflareST.exe -url https://cf.xiu2.xyz/Github/CloudflareSpeedTest.png
|
||||
- 指定 **[平均延迟下限]** 条件(用于过滤**被假蔷的 IP**,这类 IP 都被 TCP 劫持,因此延迟很低只有几十ms)
|
||||
|
||||
``` bash
|
||||
# 平均延迟下限:40 ms
|
||||
# 平均延迟下限:40 ms (一般除了移动直连香港外,几乎不存在低于 100ms 的,自行测试适合的下限延迟)
|
||||
# 平均延迟下限和其他的上下限参数一样,都可以单独使用、互相搭配使用!
|
||||
CloudflareST.exe -tll 40
|
||||
```
|
||||
|
||||
19
ipall.txt
Normal file
19
ipall.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
1.1.1.0/24
|
||||
1.0.0.0/24
|
||||
1.1.1.1/32
|
||||
1.0.0.1/32
|
||||
103.21.244.0/22
|
||||
103.22.200.0/22
|
||||
103.31.4.0/22
|
||||
104.16.0.0/13
|
||||
104.24.0.0/14
|
||||
108.162.192.0/18
|
||||
131.0.72.0/22
|
||||
141.101.64.0/18
|
||||
162.158.0.0/15
|
||||
172.64.0.0/13
|
||||
173.245.48.0/20
|
||||
188.114.96.0/20
|
||||
190.93.240.0/20
|
||||
197.234.240.0/22
|
||||
198.41.128.0/17
|
||||
8
main.go
8
main.go
@@ -28,8 +28,8 @@ CloudflareSpeedTest ` + version + `
|
||||
https://github.com/XIU2/CloudflareSpeedTest
|
||||
|
||||
参数:
|
||||
-n 500
|
||||
测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请适当调低;(默认 500 最多 1000)
|
||||
-n 200
|
||||
测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请勿太高;(默认 200 最多 1000)
|
||||
-t 4
|
||||
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IP,TCP协议;(默认 4)
|
||||
-tp 443
|
||||
@@ -64,7 +64,7 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
打印帮助说明
|
||||
`
|
||||
|
||||
flag.IntVar(&pingRoutine, "n", 500, "测速线程数量")
|
||||
flag.IntVar(&pingRoutine, "n", 200, "测速线程数量")
|
||||
flag.IntVar(&pingTime, "t", 4, "延迟测速次数")
|
||||
flag.IntVar(&tcpPort, "tp", 443, "延迟测速端口")
|
||||
flag.IntVar(&downloadTestCount, "dn", 20, "下载测速数量")
|
||||
@@ -95,7 +95,7 @@ https://github.com/XIU2/CloudflareSpeedTest
|
||||
os.Exit(0)
|
||||
}
|
||||
if pingRoutine <= 0 {
|
||||
pingRoutine = 500
|
||||
pingRoutine = 200
|
||||
}
|
||||
if pingTime <= 0 {
|
||||
pingTime = 4
|
||||
|
||||
Reference in New Issue
Block a user