Commit 608d0227 authored by Max Lv's avatar Max Lv

Enable shadowsocks-rust

parent fa116942
...@@ -57,14 +57,14 @@ cargo { ...@@ -57,14 +57,14 @@ cargo {
module = 'src/main/rust' module = 'src/main/rust'
libname = 'sslocal' libname = 'sslocal'
targets = ['arm', 'arm64', 'x86', 'x86_64'] targets = ['arm', 'arm64', 'x86', 'x86_64']
profile = 'release' profile = 'debug'
targetIncludes = ['libsslocal.so'] targetIncludes = ['libsslocal.so']
extraCargoBuildArguments = ['--bin', 'sslocal'] extraCargoBuildArguments = ['--bin', 'sslocal']
features { features {
noDefaultBut "sodium" noDefaultBut "sodium", "android"
} }
exec { spec, toolchain -> exec { spec, toolchain ->
spec.environment("RUSTFLAGS", "-C link-arg=-o -C link-arg=target/${toolchain.target}/release/libsslocal.so") spec.environment("RUSTFLAGS", "-C link-arg=-o -C link-arg=target/${toolchain.target}/${profile}/libsslocal.so")
} }
} }
......
...@@ -241,12 +241,12 @@ object BaseService { ...@@ -241,12 +241,12 @@ object BaseService {
data.proxy!!.start(this, data.proxy!!.start(this,
File(Core.deviceStorage.noBackupFilesDir, "stat_main"), File(Core.deviceStorage.noBackupFilesDir, "stat_main"),
File(configRoot, CONFIG_FILE), File(configRoot, CONFIG_FILE),
if (udpFallback == null) "-u" else null) if (udpFallback == null) "-U" else null)
check(udpFallback?.plugin == null) { "UDP fallback cannot have plugins" } check(udpFallback?.plugin == null) { "UDP fallback cannot have plugins" }
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")
} }
fun startRunner() { fun startRunner() {
......
...@@ -115,13 +115,14 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -115,13 +115,14 @@ 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()
plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString()) } plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString()) }
config.put("local_addr", DataStore.listenAddress) config.put("local_address", DataStore.listenAddress)
config.put("local_port", DataStore.portProxy) config.put("local_port", DataStore.portProxy)
configFile.writeText(config.toString()) configFile.writeText(config.toString())
val cmd = service.buildAdditionalArguments(arrayListOf( val cmd = service.buildAdditionalArguments(arrayListOf(
File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath, File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath,
"-S", stat.absolutePath, "--stat-path", stat.absolutePath,
"--protect-path", "protect_path",
"-c", configFile.absolutePath)) "-c", configFile.absolutePath))
if (extraFlag != null) cmd.add(extraFlag) if (extraFlag != null) cmd.add(extraFlag)
...@@ -130,10 +131,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -130,10 +131,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
cmd += Acl.getFile(route).absolutePath cmd += Acl.getFile(route).absolutePath
} }
// for UDP profile, it's only going to operate in UDP relay mode-only so this flag has no effect // if (DataStore.tcpFastOpen) cmd += "--fast-open"
if (profile.route == Acl.ALL) cmd += "-D"
if (DataStore.tcpFastOpen) cmd += "--fast-open"
service.data.processes!!.start(cmd) service.data.processes!!.start(cmd)
} }
......
...@@ -151,11 +151,6 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface { ...@@ -151,11 +151,6 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
sendFd(startVpn()) sendFd(startVpn())
} }
override fun buildAdditionalArguments(cmd: ArrayList<String>): ArrayList<String> {
cmd += "-V"
return cmd
}
private suspend fun startVpn(): FileDescriptor { private suspend fun startVpn(): FileDescriptor {
val profile = data.proxy!!.profile val profile = data.proxy!!.profile
val builder = Builder() val builder = Builder()
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string-array name="enc_method_entry" translatable="false"> <string-array name="enc_method_entry" translatable="false">
<item>RC4-MD5</item>
<item>AES-128-CFB</item>
<item>AES-192-CFB</item>
<item>AES-256-CFB</item>
<item>AES-128-CTR</item>
<item>AES-192-CTR</item>
<item>AES-256-CTR</item>
<item>BF-CFB</item>
<item>CAMELLIA-128-CFB</item>
<item>CAMELLIA-192-CFB</item>
<item>CAMELLIA-256-CFB</item>
<item>SALSA20</item>
<item>CHACHA20</item>
<item>CHACHA20-IETF</item>
<item>AES-128-GCM</item> <item>AES-128-GCM</item>
<item>AES-192-GCM</item> <item>AES-192-GCM</item>
<item>AES-256-GCM</item> <item>AES-256-GCM</item>
...@@ -23,20 +9,6 @@ ...@@ -23,20 +9,6 @@
</string-array> </string-array>
<string-array name="enc_method_value" translatable="false"> <string-array name="enc_method_value" translatable="false">
<item>rc4-md5</item>
<item>aes-128-cfb</item>
<item>aes-192-cfb</item>
<item>aes-256-cfb</item>
<item>aes-128-ctr</item>
<item>aes-192-ctr</item>
<item>aes-256-ctr</item>
<item>bf-cfb</item>
<item>camellia-128-cfb</item>
<item>camellia-192-cfb</item>
<item>camellia-256-cfb</item>
<item>salsa20</item>
<item>chacha20</item>
<item>chacha20-ietf</item>
<item>aes-128-gcm</item> <item>aes-128-gcm</item>
<item>aes-192-gcm</item> <item>aes-192-gcm</item>
<item>aes-256-gcm</item> <item>aes-256-gcm</item>
...@@ -212,4 +184,4 @@ ...@@ -212,4 +184,4 @@
<item>vpn</item> <item>vpn</item>
<item>transproxy</item> <item>transproxy</item>
</string-array> </string-array>
</resources> </resources>
\ No newline at end of file
Subproject commit a6bad0389f44dec993afc39c71f1ddfe02b65fa9 Subproject commit 71b29f66b06ec01e1f0747db0bb85676e0f1663c
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