分享好用的Cloudflare测速文件

引言

有时候我们想测试一下自己的带宽,或者梯子的速度。又或者我们想看看我们服务器的速度到底有多快?那么就需要一个大文件来支撑我们进行这样的测试。

而这样的测速文件需要有两个特性:

  1. 不受速率限制,也就是说能把你的带宽拉到满。
  2. 稳定性强,这能保证你持续的下载而不会断点。

来源

Internet Speed Test - Measure Network Performance | Cloudflare

来自于cloudflare,稳定性毋庸置疑。

测速链接

从中进行提取下载链接,会发现如下规律

https://speed.cloudflare.com/__down?bytes={size}

其中size的单位为Bytes,比如 1MB = 1024KB = 1048576Bytes

常见的单位:
100MB = 104857600Bytes
200MB = 209715200Bytes
500MB = 524288000Bytes
1GB = 1073741824Byte

举例:

100MB测速链接:https://speed.cloudflare.com/__down?bytes=104857600

500MB测速链接:https://speed.cloudflare.com/__down?bytes=524288000

1GB测速链接:https://speed.cloudflare.com/__down?bytes=1073741824

结语

欢迎有疑惑在勿埋我心评论区留言。

来源:https://www.skyqian.com/archives/speedtest-cloudflare.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 以下是一个使用curl进行简单测速的shell脚本示例,该脚本需要安装curl和bc(用于计算浮点数): ```bash #!/bin/bash # 需要测试的IP地址和端口的文件路径 IP_FILE=$1 # 测速结果文件路径 RESULT_FILE=$2 # 测试的超时时间(单位:秒) TIMEOUT=5 # 循环读取IP文件中的每个IP地址,并使用curl进行测试 while read ip; do # 检查IP地址是否合法,不合法则跳过本次循环 if ! [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Invalid IP address: $ip" continue fi # 使用curl测试连接时间 speed=$(curl -o /dev/null -s -w "%{time_total}\n" --connect-timeout $TIMEOUT "http://$ip" 2>/dev/null) # 检查测速结果是否合法,不合法则跳过本次循环 if ! [[ $speed =~ ^[0-9]+\.[0-9]+$ ]]; then echo "Invalid speed: $speed" continue fi # 将测速结果写入结果文件 echo "$ip $speed" >> $RESULT_FILE done < $IP_FILE ``` 使用方法: 1. 将上面的脚本保存为文件(例如`speedtest.sh`)。 2. 给脚本添加执行权限(`chmod +x speedtest.sh`)。 3. 运行脚本,第一个参数为包含IP地址的文本文件路径,第二个参数为输出测速结果的文本文件路径。例如: ```bash ./speedtest.sh ips.txt results.txt ``` 其中`ips.txt`文件中包含要测试的IP地址列表,每行一个IP地址,例如: ``` 1.2.3.4 5.6.7.8 9.10.11.12 ``` 脚本会将每个IP地址的测速结果(单位:秒)写入`results.txt`文件中,每行格式为: ``` IP地址 测速时间 ``` 例如: ``` 1.2.3.4 0.345 5.6.7.8 0.678 9.10.11.12 1.234 ``` ### 回答2: 下面是一个使用测速链接对Cloudflare的反代IP批量测速的Shell脚本示例: ```shell #!/bin/bash input_file="$1" output_file="result.txt" # 检查输入参数是否为空 if [ -z "$input_file" ]; then echo "请提供用于输入IP地址的文本文件" exit 1 fi # 检查输入文件是否存在 if [ ! -f "$input_file" ]; then echo "输入文件不存在" exit 1 fi # 清空输出文件 > "$output_file" while IFS= read -r ip; do # 检查IP地址是否为空 if [ -z "$ip" ]; then continue fi # 使用curl获取测速结果 speed=$(curl --connect-timeout 10 -so /dev/null -w '%{speed_download}\n' "$ip") # 将结果写入输出文件 echo "$ip $speed" >> "$output_file" done < "$input_file" ``` 使用方法: 1. 将上述脚本保存到一个文件(例如:`test.sh`)。 2. 打开终端,并进入到保存文件的目录。 3. 运行以下命令使脚本可执行:`chmod +x test.sh`。 4. 运行脚本并提供用于输入IP地址的文本文件作为参数:`./test.sh input.txt`(假设输入文件为 `input.txt`)。 5. 程序将输出结果到 `result.txt` 文件中,每行包含一个测速结果(格式为 `IP speed`)。 ### 回答3: 以下是一个使用curl命令结合shell脚本实现cloudflare的反代IP批量测速的示例: ```shell #!/bin/bash # 从用户输入获取IP和端口的txt文件路径 echo "请输入包含IP和端口的txt文件路径:" read path # 读取txt文件中的每一行并进行测速 while IFS= read -r line; do ip=$(echo "$line" | awk '{print $1}') # 提取IP port=$(echo "$line" | awk '{print $2}') # 提取端口 # 使用curl命令进行测速,获取响应时间(单位为毫秒) speed=$(curl -o /dev/null -s -w %{time_total} --proxy "$ip:$port" https://www.cloudflare.com) # 输出测速结果到结果文件中(格式为IP speed) echo "$ip $speed" >> result.txt done < "$path" echo "测速结果已保存到result.txt文件中。" ``` 将以上脚本保存到一个名为`speed_test.sh`的文件中,并赋予执行权限(`chmod +x speed_test.sh`)。然后,在脚本运行后输入包含IP和端口的txt文件路径,脚本将逐行读取文件中的IP和端口,并使用curl命令进行测速测速结果将以IP和速度的形式保存到名为`result.txt`的文件中。 请确保txt文件中每行格式为`IP 端口`,并以换行符分隔。例如: ``` 192.168.0.1 8080 10.0.0.1 8888 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值