Commit a252f19a authored by Mygod's avatar Mygod

Add hack to make UDP fallback work

parent a12d0b0a
...@@ -247,7 +247,7 @@ object BaseService { ...@@ -247,7 +247,7 @@ object BaseService {
udpFallback?.start(this, udpFallback?.start(this,
File(Core.deviceStorage.noBackupFilesDir, "stat_udp"), File(Core.deviceStorage.noBackupFilesDir, "stat_udp"),
File(configRoot, CONFIG_FILE_UDP), File(configRoot, CONFIG_FILE_UDP),
"-u") "-u", false)
data.localDns = LocalDnsWorker(this::rawResolver).apply { start() } data.localDns = LocalDnsWorker(this::rawResolver).apply { start() }
} }
......
...@@ -110,7 +110,8 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -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 * Sensitive shadowsocks configuration file requires extra protection. It may be stored in encrypted storage or
* device storage, depending on which is currently available. * 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) trafficMonitor = TrafficMonitor(stat)
this.configFile = configFile this.configFile = configFile
...@@ -130,11 +131,12 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -130,11 +131,12 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
val cmd = arrayListOf( val cmd = arrayListOf(
File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath, File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath,
"--stat-path", stat.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) "-c", configFile.absolutePath)
if (service.isVpnService) cmd += arrayListOf("--vpn") if (service.isVpnService) cmd += arrayListOf("--vpn")
if (extraFlag != null) cmd.add(extraFlag) 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) { if (route != Acl.ALL) {
cmd += "--acl" cmd += "--acl"
......
...@@ -41,7 +41,7 @@ abstract class AlertDialogFragment<Arg : Parcelable, Ret : Parcelable> : ...@@ -41,7 +41,7 @@ abstract class AlertDialogFragment<Arg : Parcelable, Ret : Parcelable> :
} }
protected abstract fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener) protected abstract fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener)
protected val arg by lazy { arguments!!.getParcelable<Arg>(KEY_ARG)!! } protected val arg by lazy { requireArguments().getParcelable<Arg>(KEY_ARG)!! }
protected open fun ret(which: Int): Ret? = null protected open fun ret(which: Int): Ret? = null
fun withArg(arg: Arg) = apply { arguments = Bundle().apply { putParcelable(KEY_ARG, arg) } } fun withArg(arg: Arg) = apply { arguments = Bundle().apply { putParcelable(KEY_ARG, arg) } }
......
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