mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-07-24 15:47:11 +00:00
fix(ecs): singbox 分支补齐 ecs_address 判空,失败时终端告警
singbox_modify.sh 之前 ecs_address 为空时仍写入 client_subnet:"",
导致 sing-box 启动时 netip.ParsePrefix("") 报 'no /' FATAL,
服务无法启动。根因是 get_ecsip.sh 在部分环境(如梅林 resolv.conf
无 # Interface wan 标记、members.3322.org 被限流)下拿不到公网 IP。
- singbox_modify.sh: 与 mihomo 分支对齐,加 [ -n ecs_address ] 判空,
失败时不写字段并 logger 告警
- clash_modify.sh: logger 补颜色码 33(黄色),使告警同样打印到终端,
原来无颜色码只写日志文件用户无感知
This commit is contained in:
@@ -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