瀏覽代碼

Refactor dns

世界 4 年之前
父節點
當前提交
f4c55bd1bc

+ 1 - 2
app/src/main/java/io/nekohasekai/sagernet/bg/VpnService.kt

@@ -89,7 +89,7 @@ class VpnService : BaseVpnService(),
 
     @Volatile
     private var underlyingNetwork: Network? = null
-        @RequiresApi(Build.VERSION_CODES.LOLLIPOP_MR1) set(value) {
+        set(value) {
             field = value
             if (active && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
                 setUnderlyingNetworks(underlyingNetworks)
@@ -260,7 +260,6 @@ class VpnService : BaseVpnService(),
             data.proxy!!.v2rayPoint,
             PRIVATE_VLAN4_ROUTER,
             DataStore.tunImplementation == TunImplementation.GVISOR,
-            true,
             DataStore.trafficSniffing,
             DataStore.destinationOverride,
             DataStore.enableFakeDns,

+ 13 - 6
app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt

@@ -809,7 +809,7 @@ fun buildV2RayConfig(
                                     }
                                 }
                             }
-                        }else if (bean is SSHBean) {
+                        } else if (bean is SSHBean) {
                             protocol = "ssh"
                             settings = LazyOutboundConfigurationObject(this,
                                 SSHOutbountConfigurationObject().apply {
@@ -1249,11 +1249,18 @@ fun buildV2RayConfig(
             })
         }
 
-        if (!forTest) routing.rules.add(0, RoutingObject.RuleObject().apply {
-            type = "field"
-            inboundTag = listOf(TAG_DNS_IN)
-            outboundTag = TAG_DNS_OUT
-        })
+        if (!forTest) {
+            routing.rules.add(0, RoutingObject.RuleObject().apply {
+                type = "field"
+                protocol = listOf("dns")
+                outboundTag = TAG_DNS_OUT
+            })
+            routing.rules.add(0, RoutingObject.RuleObject().apply {
+                type = "field"
+                inboundTag = listOf(TAG_DNS_IN)
+                outboundTag = TAG_DNS_OUT
+            })
+        }
 
         if (allowAccess) {
             // temp: fix crash

+ 1 - 1
external/v2ray-core

@@ -1 +1 @@
-Subproject commit 41cadb8706532835872b5a6184ecee7ebf30d27b
+Subproject commit 3bf9b052d8c24c2ab8a9153e05d10a71accc544d

+ 1 - 1
library/core

@@ -1 +1 @@
-Subproject commit 1e58012d7eddf048d6946e0521288f93fc53d1e6
+Subproject commit f7bd9a61a72cb3f955185b491386cfae9f3f56f7

+ 1 - 1
sager.properties

@@ -1,5 +1,5 @@
 PACKAGE_NAME=io.nekohasekai.sagernet
-VERSION_NAME=0.6-beta04
+VERSION_NAME=0.6-beta05
 VERSION_CODE=123
 
 NAIVE_VERSION_NAME=95.0.4638.54-3