tun: Fix inconsistent DNS mode behavior without auto_route

This commit is contained in:
世界
2026-10-09 12:36:03 +08:00
parent 80c1171410
commit 194ebd18b6
4 changed files with 9 additions and 5 deletions
+3 -1
View File
@@ -255,7 +255,9 @@ How DNS is handled on the TUN interface.
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `disabled` | Do not configure native DNS and do not hijack DNS traffic. |
| `native` | Set the platform's native interface DNS where possible: per-interface DNS on Windows and Apple platforms, and `systemd-resolved` interface DNS on Linux. |
| `hijack` | Same as `native`, with additional port 53 hijacking described below. Used by default. |
| `hijack` | Same as `native`, with additional port 53 hijacking described below. |
`hijack` is used by default when [`auto_route`](#auto_route) is enabled, otherwise `disabled` is used by default.
`hijack` adds the following on top of `native`:
+3 -1
View File
@@ -259,7 +259,9 @@ TUN 接口上 DNS 的处理方式。
|------------|-------------------------------------------------------------------------------------------------------|
| `disabled` | 不设置原生 DNS,也不劫持 DNS 流量。 |
| `native` | 尽可能设置平台的原生接口 DNS:Windows 与 Apple 上的接口 DNS,Linux 上的 `systemd-resolved` 接口 DNS。 |
| `hijack` | 与 `native` 相同,并额外执行下文所述的 53 端口劫持。默认使用。 |
| `hijack` | 与 `native` 相同,并额外执行下文所述的 53 端口劫持。 |
启用 [`auto_route`](#auto_route) 时默认使用 `hijack`,否则默认使用 `disabled`。
`hijack` 在 `native` 之上额外执行:
+1 -1
View File
@@ -55,7 +55,7 @@ require (
github.com/sagernet/sing-shadowsocks2 v0.2.2-0.20260929152114-a69d1086332b
github.com/sagernet/sing-shadowtls v0.2.2-0.20260928201441-a9c0127d5c99
github.com/sagernet/sing-snell v0.0.0-20260904135315-bc5a12ac736f
github.com/sagernet/sing-tun v0.9.7-0.20260929152151-0bdadeb4c934
github.com/sagernet/sing-tun v0.9.7-0.20261007151649-0e9e4a586ece
github.com/sagernet/sing-usbip v0.0.0-20260817040617-28bd42667eca
github.com/sagernet/sing-vmess v0.2.9-0.20260929152519-9b95ab8c9478
github.com/sagernet/smux v1.5.50-sing-box-mod.1
+2 -2
View File
@@ -338,8 +338,8 @@ github.com/sagernet/sing-shadowtls v0.2.2-0.20260928201441-a9c0127d5c99 h1:l/tdZ
github.com/sagernet/sing-shadowtls v0.2.2-0.20260928201441-a9c0127d5c99/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
github.com/sagernet/sing-snell v0.0.0-20260904135315-bc5a12ac736f h1:tbTCI+iis5sTmua7a6Q7vebcSRURok/LGgnEafnQAsc=
github.com/sagernet/sing-snell v0.0.0-20260904135315-bc5a12ac736f/go.mod h1:et8Lws4f5QbOrY65DmjevHGup3mijJkhswkto6cwciM=
github.com/sagernet/sing-tun v0.9.7-0.20260929152151-0bdadeb4c934 h1:CC1NMvo1hpRY33IJCwXldUOSgCLjYh0T4vq9pX30+tM=
github.com/sagernet/sing-tun v0.9.7-0.20260929152151-0bdadeb4c934/go.mod h1:3EgPst7agntRO7D6GOsiZ1l9FoqdLeuWmKT5TnWkmf0=
github.com/sagernet/sing-tun v0.9.7-0.20261007151649-0e9e4a586ece h1://BO1bRUuh7JjQ2NFRvXt+A2VXd1mBbp5G2lhv5fCag=
github.com/sagernet/sing-tun v0.9.7-0.20261007151649-0e9e4a586ece/go.mod h1:3EgPst7agntRO7D6GOsiZ1l9FoqdLeuWmKT5TnWkmf0=
github.com/sagernet/sing-usbip v0.0.0-20260817040617-28bd42667eca h1:5wA+IE0Fq1CGVLOgSpm0gKKZ03HzugcJ2JyhmDqeX6A=
github.com/sagernet/sing-usbip v0.0.0-20260817040617-28bd42667eca/go.mod h1:ADAZZU85MnM91XNhd2TdZRTaIbA7RjTZuQ1KCHcUbNg=
github.com/sagernet/sing-vmess v0.2.9-0.20260929152519-9b95ab8c9478 h1:q2eQn4nq8oWGxRm9zXesXSlPr9GEgPrOGzf4iPtzG9A=