diff --git a/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt b/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt index c60de21237..7f10de2d59 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt @@ -50,7 +50,6 @@ import timber.log.Timber import java.io.File import java.io.IOException import java.net.URL -import java.net.UnknownHostException /** * This object uses WeakMap to simulate the effects of multi-inheritance. @@ -316,7 +315,6 @@ object BaseService { listOfNotNull(data.proxy, data.udpFallback).forEach { it.trafficMonitor?.persistStats(it.profile.id) } suspend fun preInit() { } - suspend fun resolver(host: String) = DnsResolverCompat.resolveOnActiveNetwork(host) suspend fun rawResolver(query: ByteArray) = DnsResolverCompat.resolveRawOnActiveNetwork(query) suspend fun openConnection(url: URL) = url.openConnection() @@ -355,8 +353,6 @@ object BaseService { try { Executable.killAll() // clean up old processes preInit() - proxy.init(this@Interface) - data.udpFallback?.init(this@Interface) if (profile.route == Acl.CUSTOM_RULES) try { withContext(Dispatchers.IO) { Acl.customRules.flatten(10, this@Interface::openConnection).also { @@ -379,8 +375,6 @@ object BaseService { data.changeState(State.Connected) } catch (_: CancellationException) { // if the job was cancelled, it is canceller's responsibility to call stopRunner - } catch (_: UnknownHostException) { - stopRunner(false, getString(R.string.invalid_server)) } catch (exc: Throwable) { if (exc is ExpectedException) Timber.d(exc) else Timber.w(exc) stopRunner(false, "${getString(R.string.service_failed)}: ${exc.readableMessage}") diff --git a/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt b/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt index 1079fa8207..705cf96abc 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt @@ -27,15 +27,12 @@ import com.github.shadowsocks.database.Profile import com.github.shadowsocks.plugin.PluginConfiguration import com.github.shadowsocks.plugin.PluginManager import com.github.shadowsocks.preference.DataStore -import com.github.shadowsocks.utils.parseNumericAddress import kotlinx.coroutines.CoroutineScope import org.json.JSONArray import org.json.JSONObject import java.io.File -import java.io.IOException import java.net.URI import java.net.URISyntaxException -import java.net.UnknownHostException /** * This class sets up environment for ss-local. @@ -51,17 +48,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro var trafficMonitor: TrafficMonitor? = null val plugin by lazy { PluginManager.init(PluginConfiguration(profile.plugin ?: "")) } - suspend fun init(service: BaseService.Interface) { - // it's hard to resolve DNS on a specific interface so we'll do it here - if (plugin != null && profile.host.parseNumericAddress() == null) { - profile.host = try { - service.resolver(profile.host).firstOrNull() - } catch (e: IOException) { - throw UnknownHostException().initCause(e) - }?.hostAddress ?: throw UnknownHostException() - } - } - /** * Sensitive shadowsocks configuration file requires extra protection. It may be stored in encrypted storage or * device storage, depending on which is currently available. diff --git a/core/src/main/java/com/github/shadowsocks/bg/VpnService.kt b/core/src/main/java/com/github/shadowsocks/bg/VpnService.kt index fa86f786eb..73341bcc75 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/VpnService.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/VpnService.kt @@ -146,7 +146,6 @@ class VpnService : BaseVpnService(), BaseService.Interface { } override suspend fun preInit() = DefaultNetworkListener.start(this) { underlyingNetwork = it } - override suspend fun resolver(host: String) = DnsResolverCompat.resolve(DefaultNetworkListener.get(), host) override suspend fun rawResolver(query: ByteArray) = // no need to listen for network here as this is only used for forwarding local DNS queries. // retries should be attempted by client. diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index a8b76fca30..04ed7d9d67 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -69,7 +69,6 @@ Proxy Service Transproxy Service Shadowsocks started. - Invalid server name Failed to connect the remote server Stop Shutting down… diff --git a/core/src/main/rust/shadowsocks-rust b/core/src/main/rust/shadowsocks-rust index 9977eb724e..7342501a73 160000 --- a/core/src/main/rust/shadowsocks-rust +++ b/core/src/main/rust/shadowsocks-rust @@ -1 +1 @@ -Subproject commit 9977eb724e6d257e6a570b788d91d70b432a49e0 +Subproject commit 7342501a737115c32c2f2eaa516a4e7b3a3385d9