Commit 1ff8174e authored by Max Lv's avatar Max Lv

Refine command line interface

parent a3a70f0d
...@@ -13,7 +13,7 @@ jobs: ...@@ -13,7 +13,7 @@ jobs:
key: jars-{{ checksum "build.gradle" }} key: jars-{{ checksum "build.gradle" }}
- run: - run:
name: Run Build and Tests name: Run Build and Tests
command: ./gradlew cargoBuild && ./gradlew assembleDebug check command: ./gradlew assembleDebug check
- save_cache: - save_cache:
paths: paths:
- ~/.gradle - ~/.gradle
......
...@@ -232,7 +232,7 @@ object BaseService { ...@@ -232,7 +232,7 @@ object BaseService {
} }
} }
fun isVpnService(): Boolean = false val isVpnService get() = false
suspend fun startProcesses(hosts: HostsFile) { suspend fun startProcesses(hosts: HostsFile) {
val configRoot = (if (Build.VERSION.SDK_INT < 24 || app.getSystemService<UserManager>() val configRoot = (if (Build.VERSION.SDK_INT < 24 || app.getSystemService<UserManager>()
......
...@@ -114,7 +114,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -114,7 +114,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
this.configFile = configFile this.configFile = configFile
val config = profile.toJson() val config = profile.toJson()
val vpnFlags = if (service.isVpnService()) ";V" else "" val vpnFlags = if (service.isVpnService) ";V" else ""
plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString() + vpnFlags) } plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString() + vpnFlags) }
config.put("local_address", DataStore.listenAddress) config.put("local_address", DataStore.listenAddress)
config.put("local_port", DataStore.portProxy) config.put("local_port", DataStore.portProxy)
...@@ -122,9 +122,8 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -122,9 +122,8 @@ 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,
"-c", configFile.absolutePath) "-c", configFile.absolutePath)
if (service.isVpnService()) cmd += arrayListOf("--protect-path", "protect_path") if (service.isVpnService) cmd += arrayListOf("--vpn")
if (extraFlag != null) cmd.add(extraFlag) if (extraFlag != null) cmd.add(extraFlag)
if (route != Acl.ALL) { if (route != Acl.ALL) {
......
...@@ -187,7 +187,7 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface { ...@@ -187,7 +187,7 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
sendFd(startVpn()) sendFd(startVpn())
} }
override fun isVpnService(): Boolean = true override val isVpnService get() = true
private suspend fun startVpn(): FileDescriptor { private suspend fun startVpn(): FileDescriptor {
val profile = data.proxy!!.profile val profile = data.proxy!!.profile
......
Subproject commit 9a9cf76e892db52869bb4a90c7656571cbdfd5f4 Subproject commit ce05fb8ad50c69976b7e63b713c32d8ed164250d
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