fix(ecs): 公网IP轮询加IPv4校验,新增oray源,避免错误页伪成功

原轮询 [ -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 解析失败)
This commit is contained in:
Feng Yu
2026-07-05 22:10:52 +08:00
parent d4e0ec8fb0
commit c4532c979f

View File

@@ -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
}