Commit 9f26ec8f authored by Mygod's avatar Mygod

Fix double flattening with UDP fallback

parent 5214865a
...@@ -32,6 +32,7 @@ import com.crashlytics.android.Crashlytics ...@@ -32,6 +32,7 @@ import com.crashlytics.android.Crashlytics
import com.github.shadowsocks.BootReceiver import com.github.shadowsocks.BootReceiver
import com.github.shadowsocks.Core import com.github.shadowsocks.Core
import com.github.shadowsocks.Core.app import com.github.shadowsocks.Core.app
import com.github.shadowsocks.acl.Acl
import com.github.shadowsocks.aidl.IShadowsocksService import com.github.shadowsocks.aidl.IShadowsocksService
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback import com.github.shadowsocks.aidl.IShadowsocksServiceCallback
import com.github.shadowsocks.aidl.TrafficStats import com.github.shadowsocks.aidl.TrafficStats
...@@ -42,6 +43,7 @@ import com.github.shadowsocks.utils.* ...@@ -42,6 +43,7 @@ import com.github.shadowsocks.utils.*
import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.FirebaseAnalytics
import kotlinx.coroutines.* import kotlinx.coroutines.*
import java.io.File import java.io.File
import java.io.IOException
import java.net.URL import java.net.URL
import java.net.UnknownHostException import java.net.UnknownHostException
import java.util.* import java.util.*
...@@ -347,6 +349,13 @@ object BaseService { ...@@ -347,6 +349,13 @@ object BaseService {
val hosts = HostsFile(DataStore.publicStore.getString(Key.hosts) ?: "") val hosts = HostsFile(DataStore.publicStore.getString(Key.hosts) ?: "")
proxy.init(this@Interface, hosts) proxy.init(this@Interface, hosts)
data.udpFallback?.init(this@Interface, hosts) data.udpFallback?.init(this@Interface, hosts)
if (profile.route == Acl.CUSTOM_RULES) try {
withContext(Dispatchers.IO) {
Acl.save(Acl.CUSTOM_RULES, Acl.customRules.flatten(10, this@Interface::openConnection))
}
} catch (e: IOException) {
throw ExpectedExceptionWrapper(e)
}
data.processes = GuardedProcessPool { data.processes = GuardedProcessPool {
printLog(it) printLog(it)
......
...@@ -86,14 +86,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -86,14 +86,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
profile.method = proxy[3].trim() profile.method = proxy[3].trim()
} }
if (route == Acl.CUSTOM_RULES) try {
withContext(Dispatchers.IO) {
Acl.save(Acl.CUSTOM_RULES, Acl.customRules.flatten(10, service::openConnection))
}
} catch (e: IOException) {
throw BaseService.ExpectedExceptionWrapper(e)
}
// it's hard to resolve DNS on a specific interface so we'll do it here // it's hard to resolve DNS on a specific interface so we'll do it here
if (profile.host.parseNumericAddress() == null) { if (profile.host.parseNumericAddress() == null) {
// if fails/null, use IPv4 only, otherwise pick a random IPv4/IPv6 address // if fails/null, use IPv4 only, otherwise pick a random IPv4/IPv6 address
......
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