Commit 497a7476 authored by Mygod's avatar Mygod

Refine #1489

parent a444d7cc
...@@ -221,10 +221,10 @@ object BaseService { ...@@ -221,10 +221,10 @@ object BaseService {
"-t", "600", "-t", "600",
"-c", "shadowsocks.json")) "-c", "shadowsocks.json"))
val route = data.profile!!.route val acl = getAclFile()
if (route != Acl.ALL) { if (acl != null) {
cmd += "--acl" 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" if (TcpFastOpen.sendEnabled) cmd += "--fast-open"
...@@ -232,6 +232,12 @@ object BaseService { ...@@ -232,6 +232,12 @@ object BaseService {
data.sslocalProcess = GuardedProcess(cmd).start() 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 createNotification(): ServiceNotification
fun startRunner() { fun startRunner() {
......
...@@ -89,7 +89,7 @@ object LocalDnsService { ...@@ -89,7 +89,7 @@ object LocalDnsService {
.put("PrimaryDNS", localDns) .put("PrimaryDNS", localDns)
.put("AlternativeDNS", remoteDns) .put("AlternativeDNS", remoteDns)
.put("IPNetworkFile", "china_ip_list.txt") .put("IPNetworkFile", "china_ip_list.txt")
.put("DomainFile", app.filesDir.absolutePath + "/" + profile.route + ".acl") .put("DomainFile", getAclFile()!!.absolutePath)
Acl.CHINALIST -> config Acl.CHINALIST -> config
.put("PrimaryDNS", localDns) .put("PrimaryDNS", localDns)
.put("AlternativeDNS", remoteDns) .put("AlternativeDNS", remoteDns)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment