From 259fb246b8ee0797d6d535b6390fb41feddc4543 Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Fri, 19 Jun 2026 12:29:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor(shell):=20=E4=BB=A3=E7=90=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A4=B1=E8=B4=A5=E6=97=B6=E5=B0=9D=E8=AF=95=20Google?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/proxy.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shell/proxy.sh b/shell/proxy.sh index 5d06bc2..b7be038 100644 --- a/shell/proxy.sh +++ b/shell/proxy.sh @@ -79,7 +79,7 @@ function proxy_test() { return 1 fi - # 2. 通过代理访问 GitHub(翻墙连通性测试) + # 2. 通过代理访问 GitHub(翻墙连通性测试),不通则试 Google echo -n "代理访问 https://github.com: " code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 8 \ -x "${HTTP_PROXY_URL}" https://github.com 2>/dev/null) @@ -87,6 +87,14 @@ function proxy_test() { echo -e "\033[32m✓ HTTP ${code}\033[0m" else echo -e "\033[31m✗ 失败(${code:-N/A})\033[0m" + echo -n "代理访问 https://www.google.com: " + code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 8 \ + -x "${HTTP_PROXY_URL}" https://www.google.com 2>/dev/null) + if [ -n "$code" ] && [ "$code" -ge 200 ] && [ "$code" -lt 400 ]; then + echo -e "\033[32m✓ HTTP ${code}\033[0m" + else + echo -e "\033[31m✗ 失败(${code:-N/A})\033[0m" + fi fi # 3. 显示当前出口 IP(直连,便于与走代理后的 IP 对比)