mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-07-24 15:47:11 +00:00
Merge pull request #1301 from abcfy2/fix/ecs-dns-empty-client-subnet
修复 singbox 内核 ECS 获取失败导致启动 FATAL
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ prepare_clash_base_config() {
|
||||
if [ -n "$ecs_address" ];then
|
||||
dns_fallback=$(echo "$dns_fallback, " | sed "s|, |#ecs-override=true\&ecs=$ecs_address, |g" | sed 's|, $||')
|
||||
else
|
||||
logger "自动获取ecs网段失败!"
|
||||
logger "自动获取ecs网段失败!" 33
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,11 @@ prepare_dns_config() {
|
||||
#ecs优化
|
||||
[ "$ecs_subnet" = ON ] && {
|
||||
. "$CRASHDIR"/libs/get_ecsip.sh
|
||||
client_subnet='"client_subnet": "'"$ecs_address"'",'
|
||||
if [ -n "$ecs_address" ]; then
|
||||
client_subnet='"client_subnet": "'"$ecs_address"'",'
|
||||
else
|
||||
logger "自动获取ecs网段失败!" 33
|
||||
fi
|
||||
}
|
||||
#根据dns模式生成
|
||||
[ "$dns_mod" = "redir_host" ] && {
|
||||
|
||||
Reference in New Issue
Block a user