From 2e241fbd2c4ef001f872a72b6acb79e9c5753ba2 Mon Sep 17 00:00:00 2001 From: chunzhi Date: Mon, 22 Jan 2024 22:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20choose-cn.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- choose-cn.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/choose-cn.sh b/choose-cn.sh index 565d7e2..ecfebc9 100644 --- a/choose-cn.sh +++ b/choose-cn.sh @@ -36,7 +36,7 @@ do echo "Starting download test for $ip" # 使用 curl 命令进行下载测试 start_time=$(date +%s.%N) - curl -s --resolve speed.cloudflare.com:443:"$ip" https://speed.cloudflare.com/__down?bytes=10000000 -o /dev/null --connect-timeout 5 + curl -s --resolve speed.cloudflare.com:443:"$ip" https://speed.cloudflare.com/__down?bytes=10000000 -o /dev/null --connect-timeout 5 --max-time 10 curl_status=$? end_time=$(date +%s.%N) elapsed_time=$(echo "$end_time - $start_time" | bc) @@ -55,6 +55,8 @@ do fi else echo "Download test for $ip failed with status $curl_status" + # 从 ip_use.txt 删除下载测试失败的 IP + sed -i "/$ip/d" ip_use.txt fi echo "Finished download test for $ip" -done < ip_use.txt \ No newline at end of file +done < ip_use.txt