From c4532c979f76757908dec37f1ebb1bb59e887f76 Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Sun, 5 Jul 2026 22:10:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(ecs):=20=E5=85=AC=E7=BD=91IP=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=E5=8A=A0IPv4=E6=A0=A1=E9=AA=8C,=E6=96=B0=E5=A2=9Eoray?= =?UTF-8?q?=E6=BA=90,=E9=81=BF=E5=85=8D=E9=94=99=E8=AF=AF=E9=A1=B5?= =?UTF-8?q?=E4=BC=AA=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原轮询 [ -n "$ip" ] 只判非空,members.3322.org 被限流返回 429 HTML 错误页时也判为成功 return,后续更可靠的源不会被尝试。 - 每个响应用 grep -oE 提取合法 IPv4,提取失败(HTML/空)则继续下一个 - 新增 http://ddns.oray.com/checkip 放首位(响应含 'Current IP Address:' 前缀,grep 提取末尾 IPv4),比 3322 免费 DDNS 更稳定 - 移除 http://4.ipw.cn(部分运营商 DNS 解析失败) --- scripts/libs/get_ecsip.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/libs/get_ecsip.sh b/scripts/libs/get_ecsip.sh index fa0b68a5..ba8e10a2 100644 --- a/scripts/libs/get_ecsip.sh +++ b/scripts/libs/get_ecsip.sh @@ -6,8 +6,9 @@ get_ecs_address() { [ -n "$ip" ] && return done . "$CRASHDIR"/libs/web_get_lite.sh - for web in http://members.3322.org/dyndns/getip http://4.ipw.cn http://ipinfo.io/ip; do - ip=$(web_get_lite "$web" 0) + #轮询公网IP,提取并校验为合法IPv4才采用,否则继续尝试下一个 + for web in http://ddns.oray.com/checkip http://members.3322.org/dyndns/getip http://ipinfo.io/ip; do + ip=$(web_get_lite "$web" 0 | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | tail -1) [ -n "$ip" ] && return done }