Remove dead ts-dns upstream, wire accept_routes to Tailscale config

- Remove ts-dns UDP upstream (100.100.100.100) — .ts.net DNS is handled
  by resolver.Exchange() via LookupTailscale, never reaches mini-dns.
- Write accept_routes into Tailscale outbound JSON config so the
  Settings toggle actually takes effect.
This commit is contained in:
Sing Dev
2026-04-02 05:49:34 +08:00
parent ed8503f77a
commit a5ba9ce4f6

View File

@@ -232,23 +232,10 @@ object SingConfig {
put("server", localDns)
put("server_port", 53)
})
if (tailscaleEnabled && tailscaleAuthKey.isNotEmpty()) {
// Use MagicDNS IP as UDP upstream — ts-dns type has "file already closed" bug in 1.13
put(JSONObject().apply {
put("tag", "ts-dns")
put("type", "udp")
put("server", "100.100.100.100")
put("server_port", 53)
})
}
// .ts.net DNS is handled by resolver.Exchange() via LookupTailscale(),
// no separate ts-dns upstream needed.
})
put("rules", JSONArray().apply {
if (tailscaleEnabled && tailscaleAuthKey.isNotEmpty()) {
put(JSONObject().apply {
put("domain_suffix", JSONArray().put(".ts.net").put(".local"))
put("server", "ts-dns")
})
}
// CN domains → local DNS (keywords are coarse-grained, sufficient for DNS server selection)
put(JSONObject().apply {
put("domain_suffix", JSONArray().put(".cn"))
@@ -306,6 +293,7 @@ object SingConfig {
put("auth_key", tailscaleAuthKey)
put("state_directory", tsStateDir)
if (tailscaleHostname.isNotEmpty()) put("hostname", tailscaleHostname)
if (tailscaleAcceptRoutes) put("accept_routes", true)
})
}
})