Commit 616603a2 authored by Max Lv's avatar Max Lv

Fix the plugin issue

parent d46b3b3c
......@@ -232,7 +232,7 @@ object BaseService {
}
}
fun buildAdditionalArguments(cmd: ArrayList<String>): ArrayList<String> = cmd
fun isVpnService(): Boolean = false
suspend fun startProcesses(hosts: HostsFile) {
val configRoot = (if (Build.VERSION.SDK_INT < 24 || app.getSystemService<UserManager>()
......
......@@ -114,16 +114,17 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
this.configFile = configFile
val config = profile.toJson()
plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString()) }
val vpnFlags = if (service.isVpnService()) ";V" else ""
plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString() + vpnFlags) }
config.put("local_address", DataStore.listenAddress)
config.put("local_port", DataStore.portProxy)
configFile.writeText(config.toString())
val cmd = service.buildAdditionalArguments(arrayListOf(
val cmd = (arrayListOf(
File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath,
"--stat-path", stat.absolutePath,
"--protect-path", "protect_path",
"-c", configFile.absolutePath))
if (service.isVpnService()) cmd += arrayListOf("--protect-path", "protect_path")
if (extraFlag != null) cmd.add(extraFlag)
if (route != Acl.ALL) {
......
......@@ -151,6 +151,8 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
sendFd(startVpn())
}
override fun isVpnService(): Boolean = true
private suspend fun startVpn(): FileDescriptor {
val profile = data.proxy!!.profile
val builder = Builder()
......
Subproject commit 8db01506d6c7b221abe6837417d8be87db1e7d7e
Subproject commit f39954ac74d6e7a5343a07610c1dd156c0d60fab
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