Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate shadowsocks-rust #2454

Merged
merged 58 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ee28f97
Integrate shadowsocks-rust
madeye Feb 23, 2020
c84c8a4
Remove trust-dns feature
madeye Feb 23, 2020
302231a
Only build sslocal binary
madeye Feb 23, 2020
40915ff
Rename sslocal to libsslocal.so
madeye Feb 23, 2020
bdae242
Enable cargo build
madeye Feb 26, 2020
fa11694
Clean up
madeye Feb 26, 2020
608d022
Enable shadowsocks-rust
madeye Feb 27, 2020
c138232
Update docker image
madeye Feb 27, 2020
8cad12a
Update shadowsocks-rust
madeye Feb 27, 2020
d46b3b3
Remove aes-192-gcm
madeye Feb 27, 2020
616603a
Fix the plugin issue
madeye Feb 28, 2020
95ab2cd
Make Codacy happy
madeye Feb 28, 2020
ab6887d
Get openssl works now
madeye Feb 29, 2020
4afd71f
Fix rust not building by default
Mygod Mar 1, 2020
c80a24a
Use thin LTO
madeye Mar 1, 2020
9e0a863
Move the submodule
madeye Mar 1, 2020
ad868f5
Disable lto totally
madeye Mar 1, 2020
347d00f
Add draft impl for local_dns_path
Mygod Mar 1, 2020
2819359
Fix local_dns_path blocking
Mygod Mar 1, 2020
a3a70f0
Update shadowsocks-rust
madeye Mar 1, 2020
1ff8174
Refine command line interface
madeye Mar 1, 2020
5fed95f
Make lint happy
madeye Mar 1, 2020
be4d036
Fix traffic stat report
madeye Mar 3, 2020
2eb9adb
Integrate DNS relay
madeye Mar 13, 2020
58ec6eb
Update shadowsocks-rust
madeye Mar 13, 2020
e2adca9
Fix remote DNS using domain name
madeye Mar 14, 2020
97a71a5
Update shadowsocks-rust
madeye Mar 14, 2020
a8caa10
Fix bypass china mode
madeye Mar 14, 2020
12e8fd3
Update shadowsocks-rust
madeye Mar 14, 2020
d8ce2b8
Update shadowsocks-rust
madeye Mar 15, 2020
7c35f25
Use non-blocking UnixStream to send FDs
madeye Mar 16, 2020
e919a58
Update shadowsocks-rust
madeye Mar 17, 2020
253b4c7
Clean up
madeye Mar 22, 2020
1fc7f14
Update shadowsocks-rust
madeye Mar 22, 2020
07bddef
Make codacy happy
madeye Mar 22, 2020
2b4d045
Remove the unnecessary try-catch
madeye Mar 22, 2020
5ed588a
Merge branch 'master' into rust
madeye Apr 10, 2020
46a16dc
Add ndkVersion
madeye Apr 10, 2020
c8166c0
Update dependencies
Mygod Apr 18, 2020
b4b038a
Fix listening address
Mygod Apr 18, 2020
445461f
Enable hosts and local DNS settings always
Mygod Apr 18, 2020
91632d1
Move local dns handler to BaseService
Mygod Apr 18, 2020
fb8e18c
Clean up unused code
Mygod Apr 19, 2020
30ae0d7
Remove more unused code
Mygod Apr 19, 2020
b3b150a
Move DnsResolverCompat
Mygod Apr 19, 2020
0efeff0
Remove lintOptions
Mygod Apr 19, 2020
b630bf8
Remove hardcoded ndkVersion
Mygod Apr 19, 2020
871c83d
Fix lint
Mygod Apr 19, 2020
a12d0b0
Refine code style
Mygod Apr 19, 2020
a252f19
Add hack to make UDP fallback work
Mygod Apr 19, 2020
9ce5d9e
Use debug cargo profile in CI
madeye Apr 19, 2020
0a1536a
Remove outdated fix
Mygod Apr 19, 2020
3c7d045
Fix deprecation
Mygod Apr 19, 2020
fb0dbaf
Suppress local DNS resolve timeout exceptions
Mygod Apr 19, 2020
98aa935
Clean up unused jni files
Mygod Apr 20, 2020
8fd03bf
Fix the UDP relay
madeye Apr 20, 2020
cbbe3f0
Update shadowsocks-rust
madeye Apr 20, 2020
d7b8ef6
Update Licenses
madeye Apr 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-29-ndk
- image: shadowsocks/android-ndk-go:v1.0
environment:
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy="in-process"
steps:
Expand All @@ -13,7 +13,7 @@ jobs:
key: jars-{{ checksum "build.gradle" }}
- run:
name: Run Build and Tests
command: ./gradlew assembleDebug check
command: ./gradlew assembleDebug check -PCARGO_PROFILE=debug
- save_cache:
paths:
- ~/.gradle
Expand Down
22 changes: 3 additions & 19 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "core/src/main/jni/shadowsocks-libev"]
path = core/src/main/jni/shadowsocks-libev
url = https://github.com/shadowsocks/shadowsocks-libev
[submodule "core/src/main/jni/badvpn"]
path = core/src/main/jni/badvpn
url = https://github.com/shadowsocks/badvpn.git
Expand All @@ -17,19 +14,6 @@
path = core/src/main/jni/redsocks
url = https://github.com/shadowsocks/redsocks.git
branch = shadowsocks-android
[submodule "core/src/main/jni/mbedtls"]
path = core/src/main/jni/mbedtls
url = https://github.com/ARMmbed/mbedtls
[submodule "core/src/main/jni/pcre"]
path = core/src/main/jni/pcre
url = https://android.googlesource.com/platform/external/pcre
[submodule "core/src/main/jni/libsodium"]
path = core/src/main/jni/libsodium
url = https://github.com/jedisct1/libsodium.git
branch = stable
[submodule "core/src/main/jni/libev"]
path = core/src/main/jni/libev
url = https://git.lighttpd.net/libev.git
[submodule "core/src/main/jni/re2"]
path = core/src/main/jni/re2
url = https://github.com/google/re2.git
[submodule "core/src/main/rust/shadowsocks-rust"]
path = core/src/main/rust/shadowsocks-rust
url = https://github.com/madeye/shadowsocks-rust
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed to shadowsocks/shadowsocks-rust?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadowsocks/shadowsocks-rust#211 is not merged yet.

After that, we should change the submodule to upstream.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned I think that PR doesn't seem too important for this PR right now. 🤣

7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ If you are interested in contributing or getting involved with this project, ple

<ul>
<li>redsocks: <a href="https://github.com/shadowsocks/redsocks/blob/shadowsocks-android/README">APL 2.0</a></li>
<li>mbed TLS: <a href="https://github.com/ARMmbed/mbedtls/blob/development/LICENSE">APL 2.0</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/libevent/blob/master/LICENSE">BSD</a></li>
<li>tun2socks: <a href="https://github.com/shadowsocks/badvpn/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>pcre: <a href="https://android.googlesource.com/platform/external/pcre/+/master/dist2/LICENCE">BSD</a></li>
<li>libancillary: <a href="https://github.com/shadowsocks/libancillary/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>shadowsocks-libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE">GPLv3</a></li>
<li>libev: <a href="https://github.com/shadowsocks/libev/blob/master/LICENSE">GPLv2</a></li>
<li>shadowsocks-rust: <a href="https://github.com/shadowsocks/shadowsocks-rust/blob/master/LICENSE">MIT</a></li>
<li>libsodium: <a href="https://github.com/jedisct1/libsodium/blob/master/LICENSE">ISC</a></li>
<li>OpenSSL: <a href="https://www.openssl.org/source/license-openssl-ssleay.txt">OpenSSL License</a></li>
</ul>


Expand Down
16 changes: 10 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ apply plugin: 'com.github.ben-manes.versions'
buildscript {
ext {
javaVersion = JavaVersion.VERSION_1_8
kotlinVersion = '1.3.61'
kotlinVersion = '1.3.72'
minSdkVersion = 21
sdkVersion = 29
compileSdkVersion = 29
lifecycleVersion = '2.2.0'
desugarLibsVersion = '1.0.4'
desugarLibsVersion = '1.0.5'
junitVersion = '4.13'
androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0'
Expand All @@ -25,14 +25,18 @@ buildscript {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-alpha09'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath 'com.android.tools.build:gradle:4.0.0-beta04'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.28.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.11.1'
classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
Expand Down
35 changes: 26 additions & 9 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'

android {
compileSdkVersion rootProject.compileSdkVersion
Expand Down Expand Up @@ -50,27 +51,43 @@ androidExtensions {
experimental = true
}

def coroutinesVersion = '1.3.3'
def roomVersion = '2.2.3'
def workVersion = '2.3.1'
cargo {
module = 'src/main/rust/shadowsocks-rust'
libname = 'sslocal'
targets = ['arm', 'arm64', 'x86', 'x86_64']
profile = findProperty('CARGO_PROFILE') ?: 'release'
targetIncludes = ["lib${libname}.so"]
extraCargoBuildArguments = ['--bin', 'sslocal']
features {
noDefaultBut "sodium", "rc4", "aes-cfb", "aes-ctr", "camellia-cfb", "openssl-vendored", "local-flow-stat", "local-dns-relay"
}
exec { spec, toolchain ->
spec.environment("RUSTFLAGS", "-C lto=no -C link-arg=-o -C link-arg=target/${toolchain.target}/$profile/lib${libname}.so")
}
}

preBuild.dependsOn "cargoBuild"

def coroutinesVersion = '1.3.5'
def roomVersion = '2.2.5'
def workVersion = '2.3.4'
dependencies {
api project(':plugin')
api 'androidx.fragment:fragment-ktx:1.2.1'
api 'androidx.fragment:fragment-ktx:1.2.4'
api "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
api "androidx.lifecycle:lifecycle-livedata-core-ktx:$lifecycleVersion"
api 'androidx.preference:preference:1.1.0'
api 'androidx.preference:preference:1.1.1'
api "androidx.room:room-runtime:$roomVersion"
api "androidx.work:work-runtime-ktx:$workVersion"
api "androidx.work:work-gcm:$workVersion"
api 'com.crashlytics.sdk.android:crashlytics:2.10.1'
api 'com.google.android.gms:play-services-oss-licenses:17.0.0'
api 'com.google.code.gson:gson:2.8.6'
api 'com.google.firebase:firebase-analytics:17.2.2'
api 'com.google.firebase:firebase-config:19.1.1'
api 'dnsjava:dnsjava:2.1.9'
api 'com.google.firebase:firebase-analytics:17.3.0'
api 'com.google.firebase:firebase-config:19.1.3'
api 'dnsjava:dnsjava:3.0.2'
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion"
api 'org.connectbot.jsocks:jsocks:1.0.0'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugarLibsVersion"
kapt "androidx.room:room-compiler:$roomVersion"
testImplementation "junit:junit:$junitVersion"
Expand Down
5 changes: 0 additions & 5 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# https://issuetracker.google.com/issues/147972078#comment4
-keepclasseswithmembers class * extends androidx.lifecycle.ViewModel {
<init>();
}

This file was deleted.

1 change: 0 additions & 1 deletion core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<provider android:name="com.google.firebase.provider.FirebaseInitProvider"
tools:node="remove"/>
<service android:name="androidx.room.MultiInstanceInvalidationService"
android:directBootAware="true"
android:process=":bg"/>
<!-- https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/AndroidManifest.xml -->
<provider android:name="androidx.work.impl.WorkManagerInitializer"
Expand Down
101 changes: 0 additions & 101 deletions core/src/main/java/com/github/shadowsocks/acl/AclMatcher.kt

This file was deleted.

Loading