~增加tailscale设置

This commit is contained in:
juewuy
2025-12-12 21:46:14 +08:00
parent c387fd4e76
commit 7bdd32459f
3 changed files with 53 additions and 30 deletions

View File

@@ -625,6 +625,11 @@ modify_json() { #修饰singbox1.13配置文件
cat "$TMPDIR"/format.json | sed -n '/^ "providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json
}
cat "$TMPDIR"/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p' | sed '$d' >>"$TMPDIR"/jsons/route.json
#加载端点配置文件并生成
[ "ts_service" = ON ] || [ "wg_service" = ON ] && {
. "$CRASHDIR"/configs/gateway.cfg
. "$CRASHDIR"/components/endpoints.sh
}
#生成log.json
cat >"$TMPDIR"/jsons/log.json <<EOF
{ "log": { "level": "info", "timestamp": true } }
@@ -772,6 +777,7 @@ EOF
#生成add_route.json
#域名嗅探配置
[ "$sniffer" = "已启用" ] && sniffer_set='{ "inbound": [ "redirect-in", "tproxy-in", "tun-in" ], "action": "sniff", "timeout": "500ms" },'
[ "advertise_exit_node" = true ] && tailscale_set='{ "inbound": [ "ts-ep" ], "port": 53, "action": "hijack-dns" },'
cat >"$TMPDIR"/jsons/add_route.json <<EOF
{
"route": {
@@ -779,6 +785,7 @@ EOF
"default_mark": $routing_mark,
"rules": [
{ "inbound": [ "dns-in" ], "action": "hijack-dns" },
$tailscale_set
$sniffer_set
{ "protocol": "dns", "action": "hijack-dns" },
{ "clash_mode": "Direct" , "outbound": "DIRECT" },