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 }