diff --git a/mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt b/mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt index 4b08bea0..65895f72 100644 --- a/mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt +++ b/mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt @@ -221,10 +221,10 @@ object BaseService { "-t", "600", "-c", "shadowsocks.json")) - val route = data.profile!!.route - if (route != Acl.ALL) { + val acl = getAclFile() + if (acl != null) { cmd += "--acl" - cmd += Acl.getFile(if (route == Acl.CUSTOM_RULES) Acl.CUSTOM_RULES_FLATTENED else route).absolutePath + cmd += acl.absolutePath } if (TcpFastOpen.sendEnabled) cmd += "--fast-open" @@ -232,6 +232,12 @@ object BaseService { data.sslocalProcess = GuardedProcess(cmd).start() } + fun getAclFile(): File? { + val route = data.profile!!.route + return if (route == Acl.ALL) null else + Acl.getFile(if (route == Acl.CUSTOM_RULES) Acl.CUSTOM_RULES_FLATTENED else route) + } + fun createNotification(): ServiceNotification fun startRunner() { diff --git a/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt b/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt index 1796495c..5de7aabc 100644 --- a/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt +++ b/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt @@ -89,7 +89,7 @@ object LocalDnsService { .put("PrimaryDNS", localDns) .put("AlternativeDNS", remoteDns) .put("IPNetworkFile", "china_ip_list.txt") - .put("DomainFile", app.filesDir.absolutePath + "/" + profile.route + ".acl") + .put("DomainFile", getAclFile()!!.absolutePath) Acl.CHINALIST -> config .put("PrimaryDNS", localDns) .put("AlternativeDNS", remoteDns)