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 069abc2758..d590386d4f 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/BaseService.kt @@ -247,7 +247,7 @@ object BaseService { udpFallback?.start(this, File(Core.deviceStorage.noBackupFilesDir, "stat_udp"), File(configRoot, CONFIG_FILE_UDP), - "-u") + "-u", false) data.localDns = LocalDnsWorker(this::rawResolver).apply { start() } } 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 e93eef67b2..6d17ad09bb 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt @@ -110,7 +110,8 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro * Sensitive shadowsocks configuration file requires extra protection. It may be stored in encrypted storage or * device storage, depending on which is currently available. */ - fun start(service: BaseService.Interface, stat: File, configFile: File, extraFlag: String? = null) { + fun start(service: BaseService.Interface, stat: File, configFile: File, extraFlag: String? = null, + dnsRelay: Boolean = true) { trafficMonitor = TrafficMonitor(stat) this.configFile = configFile @@ -130,11 +131,12 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro val cmd = arrayListOf( File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath, "--stat-path", stat.absolutePath, - "--dns-relay", "${DataStore.listenAddress}:${DataStore.portLocalDns}", - "--remote-dns", "${dns.host}:${if (dns.port < 0) 53 else dns.port}", "-c", configFile.absolutePath) if (service.isVpnService) cmd += arrayListOf("--vpn") if (extraFlag != null) cmd.add(extraFlag) + if (dnsRelay) cmd += arrayListOf( + "--dns-relay", "${DataStore.listenAddress}:${DataStore.portLocalDns}", + "--remote-dns", "${dns.host}:${if (dns.port < 0) 53 else dns.port}") if (route != Acl.ALL) { cmd += "--acl" diff --git a/plugin/src/main/java/com/github/shadowsocks/plugin/AlertDialogFragment.kt b/plugin/src/main/java/com/github/shadowsocks/plugin/AlertDialogFragment.kt index fcf7a55807..67571adae2 100644 --- a/plugin/src/main/java/com/github/shadowsocks/plugin/AlertDialogFragment.kt +++ b/plugin/src/main/java/com/github/shadowsocks/plugin/AlertDialogFragment.kt @@ -41,7 +41,7 @@ abstract class AlertDialogFragment : } protected abstract fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener) - protected val arg by lazy { arguments!!.getParcelable(KEY_ARG)!! } + protected val arg by lazy { requireArguments().getParcelable(KEY_ARG)!! } protected open fun ret(which: Int): Ret? = null fun withArg(arg: Arg) = apply { arguments = Bundle().apply { putParcelable(KEY_ARG, arg) } }