更新 choose-cn.sh
This commit is contained in:
parent
0909c08b00
commit
5d2b5b7414
14
choose-cn.sh
14
choose-cn.sh
@ -19,9 +19,17 @@ do
|
||||
|
||||
# 如果延迟时间小于 150ms
|
||||
if (( $(echo "$ping_time < 150" | bc -l) )); then
|
||||
echo "Ping to $ip successful with a latency of $ping_time ms"
|
||||
# 将小于 150ms 的 IP 写入 ip_use.txt
|
||||
echo "$ip" >> ip_use.txt
|
||||
# 检查 IP 地址与 Cloudflare 的连通性
|
||||
status_code=$(curl --resolve cloudflare.com:443:$ip --insecure https://cloudflare.com/cdn-cgi/trace -o /dev/null -w '%{http_code}' -s)
|
||||
|
||||
# 如果 HTTP 状态码为 200
|
||||
if [ $status_code -eq 200 ]; then
|
||||
echo "Ping to $ip successful with a latency of $ping_time ms"
|
||||
# 将小于 150ms 的 IP 写入 ip_use.txt
|
||||
echo "$ip" >> ip_use.txt
|
||||
else
|
||||
echo "Ping to $ip discarded due to connectivity issues with Cloudflare"
|
||||
fi
|
||||
else
|
||||
echo "Ping to $ip discarded due to high latency of $ping_time ms"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user