优化 sing-box 域名嗅探覆写和规则覆写

This commit is contained in:
DustinWin
2026-01-12 21:12:16 +08:00
parent ffce704f5e
commit 0cf5e798b3

View File

@@ -200,8 +200,9 @@ EOF
EOF
#生成add_route.json
#域名嗅探配置
[ "$sniffer" = ON ] && sniffer_set='{ "action": "sniff", "timeout": "500ms" },'
[ "$sniffer" = ON ] && ! grep -Eq '"action" *:[[:space:]]*"sniff"' "$CRASHDIR"/jsons/*.json && sniffer_set='{ "action": "sniff", "timeout": "500ms" },'
[ "$ts_service" = ON ] && tailscale_set='{ "inbound": [ "ts-ep" ], "port": 53, "action": "hijack-dns" },'
sed -i '/"clash_mode".*"outbound"/d' "$CRASHDIR"/jsons/*.json
cat >"$TMPDIR"/jsons/add_route.json <<EOF
{
"route": {
@@ -211,8 +212,8 @@ EOF
{ "inbound": [ "dns-in" ], "action": "hijack-dns" },
$tailscale_set
$sniffer_set
{ "clash_mode": "Direct" , "outbound": "DIRECT" },
{ "clash_mode": "Global" , "outbound": "GLOBAL" }
{ "clash_mode": [ "Direct" ] , "outbound": "DIRECT" },
{ "clash_mode": [ "Global" ], "outbound": "GLOBAL" }
]
}
}