8 Commits

Author SHA1 Message Date
xiu2
7212110dde 优化 IPv6 测速功能(支持 /128 子网掩码) 2021-09-23 19:16:08 +08:00
xiu2
d651fdeb54 新增 ipall.txt(完整版的 IPv4 数据文件,没有过滤不可用的 IP) 2021-08-29 09:07:42 +08:00
xiu2
d453124943 README.md 2021-08-27 09:41:30 +08:00
xiu2
e92badf8be 调低 [测速线程数量] 默认值为 200 2021-08-26 20:43:22 +08:00
xiu2
01dc5df491 README.md 2021-08-20 11:37:08 +08:00
xiu2
b428775cc5 README.md 2021-08-16 13:42:43 +08:00
xiu2
5202f73108 README.md 2021-08-11 11:52:39 +08:00
xiu2
1bb45af3f1 README.md 2021-08-11 11:03:03 +08:00
4 changed files with 43 additions and 17 deletions

View File

@@ -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})

View File

@@ -1,17 +1,18 @@
# XIU2/CloudflareSpeedTest
[![Go Version](https://img.shields.io/github/go-mod/go-version/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Go&color=00ADD8)](https://github.com/XIU2/CloudflareSpeedTest/blob/master/go.mod)
[![Release Version](https://img.shields.io/github/v/release/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Release&color=1784ff)](https://github.com/XIU2/CloudflareSpeedTest/releases/latest)
[![GitHub license](https://img.shields.io/github/license/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=License&color=f38020)](https://github.com/XIU2/CloudflareSpeedTest/blob/master/LICENSE)
[![GitHub Star](https://img.shields.io/github/stars/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Star&color=f38020)](https://github.com/XIU2/CloudflareSpeedTest/stargazers)
[![GitHub Fork](https://img.shields.io/github/forks/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Fork&color=f38020)](https://github.com/XIU2/CloudflareSpeedTest/network/members)
[![Go Version](https://img.shields.io/github/go-mod/go-version/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Go&color=00ADD8&logo=go)](https://github.com/XIU2/CloudflareSpeedTest/)
[![Release Version](https://img.shields.io/github/v/release/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Release&color=1784ff&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/releases/latest)
[![GitHub license](https://img.shields.io/github/license/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=License&color=f38020&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/)
[![GitHub Star](https://img.shields.io/github/stars/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Star&color=f38020&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/)
[![GitHub Fork](https://img.shields.io/github/forks/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Fork&color=f38020&logo=github)](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
View 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

View File

@@ -28,8 +28,8 @@ CloudflareSpeedTest ` + version + `
https://github.com/XIU2/CloudflareSpeedTest
参数:
-n 500
测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请适当调低(默认 500 最多 1000)
-n 200
测速线程数量;越多测速越快,性能弱的设备 (如路由器) 请勿太高(默认 200 最多 1000)
-t 4
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IPTCP协议(默认 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