Browse Source

Fix route

世界 4 years ago
parent
commit
81b444053b

+ 1 - 0
.github/workflows/debug.yml

@@ -164,6 +164,7 @@ jobs:
         run: |
           echo "sdk.dir=${ANDROID_HOME}" > local.properties
           echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
+          ./run init action naive
           ./run libs naive
           ./gradlew naive-plugin:assembleDebug
   shadowsocks:

+ 17 - 0
app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt

@@ -299,6 +299,14 @@ fun buildV2RayConfig(proxy: ProxyEntity): V2rayBuildResult {
                         outbounds.add(outbound)
                     }
 
+                    if (!bean.serverAddress.isIpAddress()) {
+                        routing.rules.add(RoutingObject.RuleObject().apply {
+                            type = "field"
+                            domain = listOf(bean.serverAddress)
+                            outboundTag = TAG_DIRECT
+                        })
+                    }
+
                     pastExternal = true
                     return@forEachIndexed
                 } else {
@@ -816,6 +824,15 @@ fun buildV2RayConfig(proxy: ProxyEntity): V2rayBuildResult {
                             bypassIP.addAll(bypassRule.ip.split("\n"))
                         }
                     }
+
+                    (proxies + extraProxies.values.flatten()).forEach {
+                        it.requireBean().apply {
+                            if (!serverAddress.isIpAddress()) {
+                                bypassDomain.add(serverAddress)
+                            }
+                        }
+                    }
+
                     if (bypassIP.isNotEmpty() || bypassDomain.isNotEmpty()) {
                         dns.servers.add(DnsObject.StringOrServerObject().apply {
                             valueY = DnsObject.ServerObject().apply {

+ 4 - 0
bin/init/action/naive.sh

@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+sudo apt install ninja-build pkg-config qemu-user ccache
+sudo apt remove libc6-i386 --autoremove