CloudflareSpeedTest/README.md

550 lines
25 KiB
Markdown
Raw Normal View History

# XIU2/CloudflareSpeedTest
2021-08-16 13:42:43 +08:00
[![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/)
2021-10-24 16:12:15 +08:00
[![Release Version](https://img.shields.io/github/v/release/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Release&color=00ADD8&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=00ADD8&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/)
[![GitHub Star](https://img.shields.io/github/stars/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Star&color=00ADD8&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/)
[![GitHub Fork](https://img.shields.io/github/forks/XIU2/CloudflareSpeedTest.svg?style=flat-square&label=Fork&color=00ADD8&logo=github)](https://github.com/XIU2/CloudflareSpeedTest/)
2023-01-31 20:43:09 +08:00
国外很多网站都在使用 Cloudflare CDN但分配给中国内地访客的 IP 并不友好(延迟高、丢包多、速度慢)。
虽然 Cloudflare 公开了所有 [IP 段](https://www.cloudflare.com/ips/) ,但想要在这么多 IP 中找到适合自己的,怕是要累死,于是就有了这个软件。
2023-01-31 20:43:09 +08:00
**「自选优选 IP」测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4+IPv6)**!好用的话**点个`⭐`鼓励一下叭~**
2023-01-31 20:43:09 +08:00
> _分享我其他开源项目[**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" />_
> _[**UserScript** - 🐵 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" />_
2021-01-02 21:10:42 +08:00
2023-01-03 12:33:43 +08:00
> 本项目也支持对**其他 CDN / 网站 IP** 延迟测速(如:[CloudFront](https://github.com/XIU2/CloudflareSpeedTest/issues/180)、[Gcore](https://github.com/XIU2/CloudflareSpeedTest/issues/267) CDN但下载测速需自行寻找地址
2022-12-01 12:09:16 +08:00
> 对于**代理套 Cloudflare CDN** 的用户,须知这应为**备用方案**,而不应该是**唯一方案**,请勿过度依赖 [#217](https://github.com/XIU2/CloudflareSpeedTest/issues/217) [#188](https://github.com/XIU2/CloudflareSpeedTest/issues/188)
2022-02-01 17:02:18 +08:00
****
2021-12-06 17:10:16 +08:00
## \# 快速使用
### 下载运行
2023-01-31 20:43:09 +08:00
1. 下载编译好的可执行文件 [蓝奏云](https://pan.lanzouv.com/b0742hkxe) / [Github](https://github.com/XIU2/CloudflareSpeedTest/releases) 并解压。
2. 双击运行 `CloudflareST.exe` 文件Windows 系统),等待测速完成...
2021-01-27 13:10:05 +08:00
<details>
2021-12-06 17:10:16 +08:00
<summary><code><strong>「 点击查看 Linux 系统下的使用示例 」</strong></code></summary>
2021-01-27 13:10:05 +08:00
****
以下命令仅为示例,版本号和文件名请前往 [**Releases**](https://github.com/XIU2/CloudflareSpeedTest/releases) 查看。
2022-02-05 21:19:45 +08:00
``` yaml
2022-11-10 19:50:42 +08:00
# 如果是第一次使用,则建议创建新文件夹(后续更新时,跳过该步骤)
2021-01-27 13:48:50 +08:00
mkdir CloudflareST
# 进入文件夹(后续更新,只需要从这里重复下面的下载、解压命令即可)
cd CloudflareST
2021-01-27 13:10:05 +08:00
2021-12-06 17:55:20 +08:00
# 下载 CloudflareST 压缩包(自行根据需求替换 URL 中 [版本号] 和 [文件名]
2023-02-01 13:32:24 +08:00
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.0/CloudflareST_linux_amd64.tar.gz
2022-11-10 19:59:24 +08:00
# 如果你是在国内服务器上下载,那么请使用下面这几个镜像加速:
2023-02-01 13:32:24 +08:00
# wget -N https://download.fastgit.org/XIU2/CloudflareSpeedTest/releases/download/v2.2.0/CloudflareST_linux_amd64.tar.gz
# wget -N https://ghproxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.0/CloudflareST_linux_amd64.tar.gz
2022-02-10 00:40:28 +08:00
# 如果下载失败的话,尝试删除 -N 参数(如果是为了更新,则记得提前删除旧压缩包 rm CloudflareST_linux_amd64.tar.gz
2021-01-27 13:10:05 +08:00
2021-01-27 13:48:50 +08:00
# 解压(不需要删除旧文件,会直接覆盖,自行根据需求替换 文件名)
tar -zxf CloudflareST_linux_amd64.tar.gz
2021-01-27 13:10:05 +08:00
2021-01-27 13:12:43 +08:00
# 赋予执行权限
2021-01-27 13:10:05 +08:00
chmod +x CloudflareST
2021-12-06 17:55:20 +08:00
# 运行(不带参数)
2021-01-27 13:10:05 +08:00
./CloudflareST
2021-12-06 17:55:20 +08:00
# 运行(带参数示例)
./CloudflareST -dd -tll 90
2021-01-27 13:10:05 +08:00
```
2023-01-31 20:43:09 +08:00
> 如果平**均延迟非常低**(如 0.xx则说明 CloudflareST **测速时走了代理**,请先关闭代理软件后再测速。
2022-11-23 10:35:16 +08:00
> 如果在**路由器**上运行,建议先关闭路由器内的代理(或将其排除),否则测速结果可能会**不准确/无法使用**。
2021-02-04 18:45:56 +08:00
2021-01-27 13:10:05 +08:00
</details>
****
2022-05-24 18:07:08 +08:00
> _在**手机**上独立运行 CloudflareST 测速的简单教程:**[Android](https://github.com/XIU2/CloudflareSpeedTest/discussions/61)、[Android APP](https://github.com/xianshenglu/cloudflare-ip-tester-app)、[IOS](https://github.com/XIU2/CloudflareSpeedTest/issues/151)**_
2020-12-14 10:36:40 +08:00
### 结果示例
2023-01-31 20:43:09 +08:00
测速完毕后,默认会显示**最快的 10 个 IP**,示例(我联通白天测速结果):
2021-02-04 18:45:56 +08:00
``` bash
IP 地址 已发送 已接收 丢包率 平均延迟 下载速度 (MB/s)
104.27.200.69 4 4 0.00 146.23 28.64
172.67.60.78 4 4 0.00 139.82 15.02
104.25.140.153 4 4 0.00 146.49 14.90
104.27.192.65 4 4 0.00 140.28 14.07
172.67.62.214 4 4 0.00 139.29 12.71
104.27.207.5 4 4 0.00 145.92 11.95
172.67.54.193 4 4 0.00 146.71 11.55
104.22.66.8 4 4 0.00 147.42 11.11
104.27.197.63 4 4 0.00 131.29 10.26
172.67.58.91 4 4 0.00 140.19 9.14
...
2021-02-04 18:45:56 +08:00
# 如果平均延迟非常低(如 0.xx则说明 CloudflareST 测速时走了代理,请先关闭代理软件后再测速。
2022-11-23 10:35:16 +08:00
# 如果在路由器上运行,请先关闭路由器内的代理(或将其排除),否则测速结果可能会不准确/无法使用。
2021-04-03 10:19:26 +08:00
2021-02-10 19:48:01 +08:00
# 因为每次测速都是在每个 IP 段中随机 IP所以每次的测速结果都不可能相同这是正常的
2021-04-03 10:19:26 +08:00
2022-11-23 10:35:16 +08:00
# 注意!我发现电脑开机后第一次测速延迟会明显偏高,后续测速都正常,建议大家开机后第一次随便测几个 IP 后再正式开始测速。
2021-02-10 19:48:01 +08:00
# 软件是先 延迟测速并按从低到高排序后,再从 最低延迟的 IP 开始下载测速的,所以:
```
2023-01-31 20:43:09 +08:00
测速结果第一行就是**既下载速度最快、又平均延迟最低的最快 IP**!至于拿来干嘛?取决于你~
2020-12-10 10:13:26 +08:00
2023-01-31 20:43:09 +08:00
完整结果保存在当前目录下的 `result.csv` 文件中,用**记事本/表格软件**打开,格式如下:
```
IP 地址, 已发送, 已接收, 丢包率, 平均延迟, 下载速度 (MB/s)
104.27.200.69, 4, 4, 0.00, 146.23, 28.64
```
2020-12-31 09:26:43 +08:00
> _大家可以按自己需求对完整结果**进一步筛选处理**,或者去看一看进阶使用**指定过滤条件**_
****
2021-12-06 17:10:16 +08:00
## \# 进阶使用
2023-01-31 20:43:09 +08:00
直接运行使用的是默认参数,如果想要测速结果更全面、更符合自己的要求,可以自定义参数。
``` cmd
C:\>CloudflareST.exe -h
CloudflareSpeedTest vX.X.X
2021-01-05 11:26:07 +08:00
测试 Cloudflare CDN 所有 IP 的延迟和速度,获取最快 IP (IPv4+IPv6)
https://github.com/XIU2/CloudflareSpeedTest
参数:
2021-10-26 09:32:44 +08:00
-n 200
2023-01-31 20:43:09 +08:00
延迟测速线程;越多延迟测速越快,性能弱的设备 (如路由器) 请勿太高;(默认 200 最多 1000)
-t 4
延迟测速次数;单个 IP 延迟测速次数,为 1 时将过滤丢包的IP(默认 4 次)
2021-11-13 16:49:47 +08:00
-dn 10
2021-12-14 22:39:04 +08:00
下载测速数量;延迟测速并排序后,从最低延迟起下载测速的数量;(默认 10 个)
2020-12-19 10:11:43 +08:00
-dt 10
2021-12-14 22:39:04 +08:00
下载测速时间;单个 IP 下载测速最长时间,不能太短;(默认 10 秒)
2023-01-31 20:43:09 +08:00
-tp 443
指定测速端口;延迟测速/下载测速时使用的端口;(默认 443 端口)
2022-02-09 21:00:47 +08:00
-url https://cf.xiu2.xyz/url
2023-01-31 20:43:09 +08:00
指定测速地址;延迟测速(HTTPing)/下载测速时使用的地址,默认地址不保证可用性,建议自建;
-httping
切换测速模式;延迟测速模式改为 HTTP 协议,所用测试地址为 [-url] 参数;(默认 TCPing)
-httping-code 200
有效状态代码HTTPing 延迟测速时网页返回的有效 HTTP 状态码,仅限一个;(默认 200 301 302)
-cfcolo HKG,KHH,NRT,LAX,SEA,SJC,FRA,MAD
匹配指定地区;地区名为当地机场三字码,英文逗号分隔,仅 HTTPing 模式可用;(默认 所有地区)
2022-11-24 11:51:08 +08:00
-tl 200
平均延迟上限;只输出低于指定平均延迟的 IP可与其他上限/下限搭配;(默认 9999 ms)
-tll 40
2022-11-20 00:58:59 +08:00
平均延迟下限;只输出高于指定平均延迟的 IP可与其他上限/下限搭配;(默认 0 ms)
-sl 5
下载速度下限;只输出高于指定下载速度的 IP凑够指定数量 [-dn] 才会停止测速;(默认 0.00 MB/s)
2022-11-24 11:51:08 +08:00
2021-11-13 16:49:47 +08:00
-p 10
2021-12-14 22:39:04 +08:00
显示结果数量;测速后直接显示指定数量的结果,为 0 时不显示结果直接退出;(默认 10 个)
-f ip.txt
2021-11-14 15:16:32 +08:00
IP段数据文件如路径含有空格请加上引号支持其他 CDN IP段(默认 ip.txt)
2023-01-31 20:43:09 +08:00
-ip 1.1.1.1,2.2.2.2/24,2606:4700::/32
指定IP段数据直接通过参数指定要测速的 IP 段数据,英文逗号分隔;(默认 空)
-o result.csv
2021-11-14 15:16:32 +08:00
写入结果文件;如路径含有空格请加上引号;值为空时不写入文件 [-o ""](默认 result.csv)
2022-11-24 11:51:08 +08:00
-dd
2021-11-14 15:16:32 +08:00
禁用下载测速;禁用后测速结果会按延迟排序 (默认按下载速度排序)(默认 启用)
-allip
2023-01-31 20:43:09 +08:00
测速全部的IP对 IP 段中的每个 IP (仅支持 IPv4) 进行测速;(默认 每个 /24 段随机测速一个 IP)
-v
打印程序版本 + 检查版本更新
-h
打印帮助说明
```
### 使用示例
2023-01-31 20:43:09 +08:00
Windows 要指定参数需要在 CMD 中运行,或者把参数添加到快捷方式目标中。
2023-01-31 20:43:09 +08:00
> **注意**:各参数均有**默认值**,使用默认值的参数是可以省略的(**按需选择**),参数**不分前后顺序**。
> **提示**Linux 系统只需要把下面命令中的 `CloudflareST.exe` 改为 `./CloudflareST` 即可。
2021-01-08 08:28:49 +08:00
2022-02-04 17:04:52 +08:00
****
2022-02-04 17:01:42 +08:00
#### \# CMD 带参数运行 CloudflareST
对命令行程序不熟悉的人,可能不知道该如何带参数运行,我就简单说一下。
2022-02-04 17:04:52 +08:00
2022-02-05 13:13:10 +08:00
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2022-02-04 17:04:52 +08:00
很多人打开 CMD 以**绝对路径**运行 CloudflareST 会报错,这是因为默认的 `-f ip.txt` 参数是相对路径,需要指定绝对路径的 ip.txt 才行,但这样毕竟太麻烦了,因此还是建议进入 CloudflareST 程序目录下,以**相对路径**方式运行:
2022-02-04 17:01:42 +08:00
2022-11-20 01:07:40 +08:00
**方式 一**
2022-02-04 17:01:42 +08:00
1. 打开 CloudflareST 程序所在目录
2022-02-04 17:07:18 +08:00
2. 空白处按下 <kbd>Shift + 鼠标右键</kbd> 显示右键菜单
3. 选择 **\[在此处打开命令窗口\]** 来打开 CMD 窗口,此时默认就位于当前目录下
4. 输入带参数的命令,如:`CloudflareST.exe -tll 50 -tl 200`即可运行
2022-02-04 17:01:42 +08:00
2022-11-20 01:07:40 +08:00
**方式 二**
1. 打开 CloudflareST 程序所在目录
2. 直接在文件夹地址栏中全选并输入 `cmd` 回车来打开 CMD 窗口,此时默认就位于当前目录下
4. 输入带参数的命令,如:`CloudflareST.exe -tll 50 -tl 200`即可运行
2022-02-04 17:07:18 +08:00
> 当然你也可以随便打开一个 CMD 窗口,然后输入如 `cd /d "D:\Program Files\CloudflareST"` 来进入程序目录
2022-02-04 17:01:42 +08:00
2022-02-05 13:13:10 +08:00
</details>
****
#### \# Windows 快捷方式带参数运行 CloudflareST
如果不经常修改运行参数(比如平时都是直接双击运行)的人,建议使用快捷方式,更方便点。
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
右键 `CloudflareST.exe` 文件 - **\[创建快捷方式\]**,然后右键该快捷方式 - **\[属性\]**,修改其**目标**
``` bash
# 如果要不输出结果文件,那么请加上 -o " ",引号里的是空格(没有空格会导致该参数被省略)。
D:\ABC\CloudflareST\CloudflareST.exe -n 500 -t 4 -dn 20 -dt 5 -o " "
# 如果文件路径包含引号,则需要把启动参数放在引号外面,记得引号和 - 之间有空格。
"D:\Program Files\CloudflareST\CloudflareST.exe" -n 500 -t 4 -dn 20 -dt 5 -o " "
# 注意!快捷方式 - 起始位置 不能是空的,否则就会因为绝对路径而找不到 ip.txt 文件
```
</details>
2022-02-04 17:01:42 +08:00
****
2022-02-04 17:04:52 +08:00
2021-01-11 10:25:32 +08:00
#### \# IPv4/IPv6
2022-02-06 11:25:08 +08:00
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2021-01-08 08:28:49 +08:00
``` bash
# 测速 IPv4 时,需要指定 IPv4 数据文件(-f 默认值就是 ip.txt所以该参数可省略
2021-01-11 10:25:32 +08:00
CloudflareST.exe -f ip.txt
2022-11-08 16:34:37 +08:00
# 测速 IPv6 时,需要指定 IPv6 数据文件v2.1.0 版本后支持 IPv4+IPv6 混合测速并移除了 -ipv6 参数)
CloudflareST.exe -f ipv6.txt
2023-01-31 20:43:09 +08:00
# 当然你也可以将 IPv4 IPv6 混合在一起测速,也可以直接通过参数指定要测速的 IP
2023-01-31 20:50:48 +08:00
CloudflareST.exe -ip 1.1.1.1,2606:4700::/32
2021-01-08 08:28:49 +08:00
```
2022-02-04 17:04:52 +08:00
2023-01-31 20:43:09 +08:00
> 测速 IPv6 时,可能会注意到每次测速数量都不一样,了解原因: [#120](https://github.com/XIU2/CloudflareSpeedTest/issues/120)
2022-12-04 17:38:03 +08:00
> 因为 IPv6 太多(以亿为单位),且绝大部分 IP 段压根未启用,所以我只扫了一部分可用的 IPv6 段写到 `ipv6.txt` 文件中有兴趣的可以自行扫描增删ASN 数据源来自:[bgp.he.net](https://bgp.he.net/AS13335#_prefixes6)
2022-05-24 18:07:08 +08:00
2022-02-06 11:25:08 +08:00
</details>
2021-01-08 08:28:49 +08:00
****
2022-02-04 17:04:52 +08:00
2023-01-31 20:43:09 +08:00
#### \# HTTPing
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
目前有两种延迟测速模式,分别为 **TCP 协议、HTTP 协议**
TCP 协议耗时更短、消耗资源更少,超时时间为 1 秒,该协议为默认模式。
HTTP 协议适用于快速测试某域名指向某 IP 时是否可以访问,超时时间为 2 秒。
``` bash
# 只需加上 -httping 参数即可切换到 HTTP 协议延迟测速模式
CloudflareST.exe -httping
# 软件会根据访问时网页返回的有效 HTTP 状态码来判断可用性(当然超时也算),默认对返回 200 301 302 这三个 HTTP 状态码的视为有效,可以手动指定认为有效的 HTTP 状态码,但只能指定一个(你需要提前确定测试地址正常情况下会返回哪个状态码)
CloudflareST.exe -httping -httping-code 200
# 通过 -url 参数来指定 HTTPing 测试地址(可以是任意网页 URL不局限于具体文件地址
CloudflareST.exe -httping -url https://cf.xiu2.xyz/url
# 注意:如果测速地址为 HTTP 协议,记得加上 -tp 80这个参数会影响 延迟测速/下载测速 时使用的端口)
CloudflareST.exe -httping -tp 80 -url http://xxx/xxx
```
</details>
****
#### \# 匹配指定地区(colo 机场三字码)
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
``` bash
2023-02-01 13:32:24 +08:00
# 指定地区名后,延迟测速后得到的结果就都是指定地区的 IP 了(也可以继续进行下载测速)
# 节点地区名为当地 机场三字码,指定多个时用英文逗号分隔
# 目前已知有ARN,BOM,DFW,EWR,FRA,GRU,HKG,IAD,LAX,MAD,MRS,MXP,NRT,SEA,SJC,WAW (其他的自行寻找吧~
2023-01-31 20:43:09 +08:00
# 注意,该参数只有在 HTTPing 延迟测速模式下才可用(因为要访问网页来获得)
CloudflareST.exe -cfcolo HKG,KHH,NRT,LAX,SEA,SJC,FRA,MAD
```
</details>
****
2021-01-11 10:25:32 +08:00
#### \# 文件相对/绝对路径
2021-12-14 22:39:04 +08:00
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2022-02-04 17:04:52 +08:00
2021-01-08 08:28:49 +08:00
``` bash
2021-01-11 10:25:32 +08:00
# 指定 IPv4 数据文件,不显示结果直接退出,输出结果到文件(-p 值为 0
2021-03-21 21:00:03 +08:00
CloudflareST.exe -f 1.txt -p 0 -dd
2021-01-11 10:25:32 +08:00
2021-07-24 13:45:11 +08:00
# 指定 IPv4 数据文件,不输出结果到文件,直接显示结果(-p 值为 10 条,-o 值为空但引号不能少)
CloudflareST.exe -f 2.txt -o "" -p 10 -dd
2020-12-23 11:01:37 +08:00
# 指定 IPv4 数据文件 及 输出结果到文件(相对路径,即当前目录下,如含空格请加上引号)
2021-03-21 21:00:03 +08:00
CloudflareST.exe -f 3.txt -o result.txt -dd
2021-12-06 17:10:16 +08:00
2021-11-27 21:57:14 +08:00
# 指定 IPv4 数据文件 及 输出结果到文件(相对路径,即当前目录内的 abc 文件夹下,如含空格请加上引号)
# LinuxCloudflareST 程序所在目录内的 abc 文件夹下)
./CloudflareST -f abc/3.txt -o abc/result.txt -dd
2021-12-06 17:10:16 +08:00
2021-11-27 21:57:14 +08:00
# Windows注意是反斜杠
CloudflareST.exe -f abc\3.txt -o abc\result.txt -dd
2021-12-06 17:10:16 +08:00
2020-12-23 11:01:37 +08:00
# 指定 IPv4 数据文件 及 输出结果到文件(绝对路径,即 C:\abc\ 目录下,如含空格请加上引号)
2021-11-27 21:57:14 +08:00
# Linux/abc/ 目录下)
./CloudflareST -f /abc/4.txt -o /abc/result.csv -dd
2021-12-06 17:10:16 +08:00
2021-11-27 21:57:14 +08:00
# Windows注意是反斜杠
2021-03-21 21:00:03 +08:00
CloudflareST.exe -f C:\abc\4.txt -o C:\abc\result.csv -dd
2022-02-06 11:18:23 +08:00
# 如果要以【绝对路径】运行 CloudflareST那么 -f / -o 参数中的文件名也必须是【绝对路径】,否则会报错找不到文件!
# Linux/abc/ 目录下)
/abc/CloudflareST -f /abc/4.txt -o /abc/result.csv -dd
# Windows注意是反斜杠
C:\abc\CloudflareST.exe -f C:\abc\4.txt -o C:\abc\result.csv -dd
2021-01-08 08:28:49 +08:00
```
2021-12-14 22:39:04 +08:00
</details>
2021-01-08 08:28:49 +08:00
****
2022-02-04 17:04:52 +08:00
2023-01-31 20:43:09 +08:00
#### \# 自定义测速地址
2022-02-06 11:25:08 +08:00
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2021-01-08 08:28:49 +08:00
``` bash
2023-01-31 20:43:09 +08:00
# 该参数适用于下载测速 及 HTTP 协议的延迟测速,对于后者该地址可以是任意网页 URL不局限于具体文件地址
2021-01-08 08:28:49 +08:00
# 地址要求:可以直接下载、文件大小超过 200MB、用的是 Cloudflare CDN
2022-02-09 21:06:23 +08:00
CloudflareST.exe -url https://cf.xiu2.xyz/url
2022-02-06 11:25:08 +08:00
2023-01-31 20:43:09 +08:00
# 注意:如果测速地址为 HTTP 协议,记得加上 -tp 80这个参数会影响 延迟测速/下载测速 时使用的端口)
2021-11-27 23:24:42 +08:00
CloudflareST.exe -tp 80 -url http://xxx/xxx
2021-01-08 08:28:49 +08:00
```
2022-02-04 17:04:52 +08:00
2022-02-06 11:25:08 +08:00
</details>
2021-01-08 08:28:49 +08:00
****
2022-02-04 17:04:52 +08:00
2022-11-20 00:58:59 +08:00
#### \# 自定义测速条件(指定 延迟/下载速度 的目标范围)
2021-03-21 21:00:03 +08:00
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2022-11-20 00:58:59 +08:00
- 指定 **[平均延迟下限]** 条件
``` bash
2021-08-11 11:03:03 +08:00
# 平均延迟下限40 ms (一般除了移动直连香港外,几乎不存在低于 100ms 的,自行测试适合的下限延迟)
# 平均延迟下限和其他的上下限参数一样,都可以单独使用、互相搭配使用!
CloudflareST.exe -tll 40
```
2021-03-21 21:00:03 +08:00
- 仅指定 **[平均延迟上限]** 条件
2021-01-08 08:28:49 +08:00
``` bash
2021-02-18 23:48:07 +08:00
# 平均延迟上限200 ms下载速度下限0 MB/s数量10 个(可选)
# 即找到平均延迟低于 200 ms 的 IP然后再按延迟从低到高进行 10 次下载测速
CloudflareST.exe -tl 200 -dn 10
```
2023-01-31 20:43:09 +08:00
> 如果没有一个 IP **平均延迟低于 200ms**,那么不会输出任何内容。
2021-02-18 23:39:37 +08:00
****
2021-03-21 21:00:03 +08:00
- 仅指定 **[平均延迟上限]** 条件,且**只延迟测速,不下载测速**
``` bash
2021-02-18 23:39:37 +08:00
# 平均延迟上限200 ms下载速度下限0 MB/s数量不知道多少 个
# 即只输出低于 200ms 的 IP且不再下载测速因为不再下载测速所以 -dn 参数就无效了)
CloudflareST.exe -tl 200 -dd
```
2021-02-18 23:39:37 +08:00
****
2021-03-21 21:00:03 +08:00
- 仅指定 **[下载速度下限]** 条件
``` bash
2021-02-18 23:48:07 +08:00
# 平均延迟上限9999 ms下载速度下限5 MB/s数量10 个(可选)
# 即需要找到 10 个平均延迟低于 9999 ms 且下载速度高于 5 MB/s 的 IP 才会停止测速
CloudflareST.exe -sl 5 -dn 10
2021-01-08 08:28:49 +08:00
```
2023-01-31 20:43:09 +08:00
> 没有指定平均延迟上限时,如果一直**凑不够**满足条件的 IP 数量,就会**一直测速**下去。
2021-02-18 23:47:11 +08:00
> 所以建议**同时指定 [下载速度下限] + [平均延迟上限]**,这样测速到指定延迟上限还没凑够数量,就会终止测速。
2020-12-23 11:01:37 +08:00
2021-02-18 23:39:37 +08:00
****
2021-03-21 21:00:03 +08:00
- 同时指定 **[平均延迟上限] + [下载速度下限]** 条件
2021-01-08 08:28:49 +08:00
``` bash
2021-02-04 17:32:14 +08:00
# 平均延迟上限、下载速度下限均支持小数(如 -sl 0.5
2021-02-18 23:48:07 +08:00
# 平均延迟上限200 ms下载速度下限5.6 MB/s数量10 个(可选)
# 即需要找到 10 个平均延迟低于 200 ms 且下载速度高于 5 .6MB/s 的 IP 才会停止测速
2021-02-04 17:32:14 +08:00
CloudflareST.exe -tl 200 -sl 5.6 -dn 10
2021-01-08 08:28:49 +08:00
```
2023-01-31 20:43:09 +08:00
> 如果没有一个 IP **平均延迟低于 200ms**,那么不会输出任何内容。
> 如果没有一个 IP **下载速度高于 5.6 MB/s**,那么就会**和不指定 [下载速度下限] 条件一样**输出结果。
2021-01-08 08:28:49 +08:00
> 所以建议先不指定条件测速一遍,看看平均延迟和下载速度大概在什么范围,避免指定条件**过低/过高**
2021-01-08 08:11:37 +08:00
2023-01-31 20:43:09 +08:00
> 因为Cloudflare 公开的 IP 段是**回源 IP+任播 IP**,而**回源 IP**是无法使用的,所以下载测速是 0.00。
2021-02-18 23:39:37 +08:00
> 运行时可以加上 `-sl 0.01`(下载速度下限),过滤掉**回源 IP**(下载测速低于 0.01MB/s 的结果)。
2021-01-08 08:28:49 +08:00
2021-03-21 21:00:03 +08:00
</details>
****
2022-02-04 17:04:52 +08:00
2021-03-21 21:00:03 +08:00
#### \# 单独对一个或多个 IP 测速
<details>
<summary><code><strong>「 点击展开 查看内容 」</strong></code></summary>
****
2023-01-31 20:43:09 +08:00
**方式 一**
直接通过参数指定要测速的 IP 段数据。
``` bash
# 先进入 CloudflareST 所在目录,然后运行:
# Windows 系统(在 CMD 中运行)
2023-01-31 20:50:48 +08:00
CloudflareST.exe -ip 1.1.1.1,2.2.2.2/24,2606:4700::/32
2023-01-31 20:43:09 +08:00
# Linux 系统
2023-01-31 20:50:48 +08:00
./CloudflareST -ip 1.1.1.1,2.2.2.2/24,2606:4700::/32
2023-01-31 20:43:09 +08:00
```
****
**方式 二**
或者把这些 IP 按如下格式写入到任意文本文件中,例如:`1.txt`
2021-11-15 17:29:10 +08:00
```
2021-03-21 21:00:03 +08:00
1.1.1.1
1.1.1.200
2021-02-17 11:38:01 +08:00
1.0.0.1/24
```
2023-01-31 20:43:09 +08:00
> 单个 IP 的话可以省略 `/32` 子网掩码了(即 `1.1.1.1`等同于 `1.1.1.1/32`)。
2021-02-18 23:51:05 +08:00
> 子网掩码 `/24` 指的是这个 IP 最后一段,即 `1.0.0.1~1.0.0.255`。
2023-01-31 20:43:09 +08:00
然后运行 CloudflareST 时加上启动参数 `-f 1.txt` 来指定 IP 段数据文件。
``` bash
# 先进入 CloudflareST 所在目录,然后运行:
2021-02-18 23:51:05 +08:00
# Windows 系统(在 CMD 中运行)
CloudflareST.exe -f 1.txt
2021-02-18 23:51:05 +08:00
# Linux 系统
./CloudflareST -f 1.txt
2021-02-17 11:38:01 +08:00
2021-11-15 17:29:10 +08:00
# 对于 1.0.0.1/24 这样的 IP 段只会随机最后一段1.0.0.1~255如果要测速该 IP 段中的所有 IP请加上 -allip 参数。
```
</details>
****
2022-02-04 17:04:52 +08:00
2021-03-13 09:34:22 +08:00
#### \# 一劳永逸加速所有使用 Cloudflare CDN 的网站(不需要再一个个添加域名到 Hosts 了)
2021-03-13 09:35:26 +08:00
我以前说过,开发该软件项目的目的就是为了通过**改 Hosts 的方式来加速访问使用 Cloudflare CDN 的网站**。
2021-03-13 09:34:22 +08:00
2021-03-21 21:00:03 +08:00
但就如 [**#8**](https://github.com/XIU2/CloudflareSpeedTest/issues/8) 所说,一个个添加域名到 Hosts 实在**太麻烦**了,于是我就找到了个**一劳永逸**的办法!
2021-03-13 09:34:22 +08:00
2023-01-31 20:43:09 +08:00
可以看这个 [**还在一个个添加 Hosts完美本地加速所有使用 Cloudflare CDN 的网站方法来了!**](https://github.com/XIU2/CloudflareSpeedTest/discussions/71) 和另一个[依靠本地 DNS 服务来修改域名解析 IP 为自选 IP](https://github.com/XIU2/CloudflareSpeedTest/issues/115) 的教程。
2021-03-13 09:34:22 +08:00
2021-01-28 12:19:49 +08:00
****
2022-02-04 17:04:52 +08:00
2021-01-28 12:19:49 +08:00
#### \# 自动更新 Hosts
考虑到很多人获得最快 Cloudflare CDN IP 后,需要替换 Hosts 文件中的 IP。
可以看这个 [**Issues**](https://github.com/XIU2/CloudflareSpeedTest/issues/42) 获取 **Windows/Linux 自动更新 Hosts 脚本**
2021-01-07 07:36:30 +08:00
****
2022-02-04 17:04:52 +08:00
2021-01-07 07:37:26 +08:00
## 问题反馈
2021-01-07 07:36:30 +08:00
2023-01-31 20:43:09 +08:00
如果你遇到什么问题,可以先去 [**Issues**](https://github.com/XIU2/CloudflareSpeedTest/issues) 里看看是否有别人问过了(记得去看下 [**Closed**](https://github.com/XIU2/CloudflareSpeedTest/issues?q=is%3Aissue+is%3Aclosed) 的)。
2021-01-27 09:54:32 +08:00
如果没找到类似问题,请新开个 [**Issues**](https://github.com/XIU2/CloudflareSpeedTest/issues/new) 来告诉我!
2021-01-07 07:36:30 +08:00
2022-03-28 10:05:41 +08:00
> _有问题请**大胆告诉我**,描述越详细越好(随时可远程协助),如果不说那我怎么去完善功能或~~修复 BUG~~ 呢_
****
2022-03-28 10:17:30 +08:00
## 赞赏支持
2022-03-28 10:05:41 +08:00
2022-05-17 13:51:55 +08:00
![微信赞赏](https://cdn.staticaly.com/gh/XIU2/XIU2/master/img/zs-01.png)![支付宝赞赏](https://cdn.staticaly.com/gh/XIU2/XIU2/master/img/zs-02.png)
2021-01-07 07:36:30 +08:00
****
2022-02-04 17:04:52 +08:00
2022-12-28 14:29:18 +08:00
## 衍生项目
2023-01-31 20:43:09 +08:00
- _https://github.com/xianshenglu/cloudflare-ip-tester-app_
2022-12-28 14:29:18 +08:00
_**CloudflareST 安卓版 APP [#202](https://github.com/XIU2/CloudflareSpeedTest/issues/202)**_
2023-01-31 20:43:09 +08:00
- _https://github.com/mingxiaoyu/luci-app-cloudflarespeedtest_
2022-12-28 14:29:18 +08:00
_**CloudflareST OpenWrt 路由器插件版 [#174](https://github.com/XIU2/CloudflareSpeedTest/issues/174)**_
2023-01-31 20:43:09 +08:00
- _https://github.com/immortalwrt-collections/openwrt-cdnspeedtest_
2022-12-28 14:29:18 +08:00
_**CloudflareST OpenWrt 原生编译版本 [#64](https://github.com/XIU2/CloudflareSpeedTest/discussions/64)**_
2023-01-31 20:43:09 +08:00
> _此处仅收集了在本项目 Issues 中宣传过的部分 CloudflareST 相关衍生项目,如果有遗漏可以告诉我~_
2022-12-28 14:29:18 +08:00
****
## 感谢项目
2021-01-07 07:36:30 +08:00
2022-12-28 14:29:18 +08:00
- _https://github.com/Spedoske/CloudflareScanner_
2023-01-31 20:43:09 +08:00
> _因为该项目已经很长时间没更新了而我又产生了很多功能需求所以我临时学了下 Go 语言就上手了(菜)..._
2021-01-06 09:35:03 +08:00
> _本软件基于该项目制作但**已添加大量功能及修复 BUG**,并根据大家的使用反馈积极添加、优化功能(闲)..._
2021-01-01 19:27:38 +08:00
****
2022-02-04 17:04:52 +08:00
2021-01-06 09:35:03 +08:00
## License
2022-03-28 10:17:30 +08:00
The GPL-3.0 License.