Browse Source

Import shadowsocksr

世界 4 years ago
parent
commit
95814ac7a3

+ 2 - 1
.gitignore

@@ -14,4 +14,5 @@ build/
 .cxx
 local.properties
 /app/libs/
-/app/src/main/assets/*
+/app/src/main/assets/geofile/
+/app/src/main/assets/browserforwarder/

+ 18 - 0
.gitmodules

@@ -10,3 +10,21 @@
 [submodule "shadowsocks/src/main/rust/shadowsocks-rust"]
 	path = shadowsocks/src/main/rust/shadowsocks-rust
 	url = https://github.com/shadowsocks/shadowsocks-rust.git
+[submodule "shadowsocksr/src/main/jni/shadowsocks-libev"]
+	path = shadowsocksr/src/main/jni/shadowsocks-libev
+	url = https://github.com/shadowsocksRb/shadowsocksr-libev
+[submodule "shadowsocksr/src/main/jni/mbedtls"]
+	path = shadowsocksr/src/main/jni/mbedtls
+	url = https://github.com/ARMmbed/mbedtls
+[submodule "shadowsocksr/src/main/jni/libancillary"]
+	path = shadowsocksr/src/main/jni/libancillary
+	url = https://github.com/shadowsocks/libancillary
+[submodule "shadowsocksr/src/main/jni/pcre"]
+	path = shadowsocksr/src/main/jni/pcre
+	url = https://android.googlesource.com/platform/external/pcre
+[submodule "shadowsocksr/src/main/jni/libsodium"]
+	path = shadowsocksr/src/main/jni/libsodium
+	url = https://github.com/jedisct1/libsodium
+[submodule "shadowsocksr/src/main/jni/re2"]
+	path = shadowsocksr/src/main/jni/re2
+	url = https://github.com/google/re2

+ 1 - 0
.idea/gradle.xml

@@ -15,6 +15,7 @@
             <option value="$PROJECT_DIR$" />
             <option value="$PROJECT_DIR$/app" />
             <option value="$PROJECT_DIR$/shadowsocks" />
+            <option value="$PROJECT_DIR$/shadowsocksr" />
           </set>
         </option>
         <option name="resolveModulePerSourceSet" value="false" />

+ 17 - 1
app/src/main/AndroidManifest.xml

@@ -87,7 +87,6 @@
             android:screenOrientation="locked"
             android:theme="@style/Theme.SagerNet" />
 
-
         <service
             android:name="io.nekohasekai.sagernet.bg.ProxyService"
             android:directBootAware="true"
@@ -107,6 +106,23 @@
             </intent-filter>
         </service>
 
+        <service
+            android:name="io.nekohasekai.sagernet.bg.TileService"
+            android:directBootAware="true"
+            android:icon="@drawable/ic_service_active"
+            android:label="@string/quick_toggle"
+            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
+            android:process=":bg"
+            tools:targetApi="n">
+            <intent-filter>
+                <action android:name="android.service.quicksettings.action.QS_TILE" />
+            </intent-filter>
+            <meta-data
+                android:name="android.service.quicksettings.TOGGLEABLE_TILE"
+                android:value="true" />
+        </service>
+
+
         <receiver
             android:name="io.nekohasekai.sagernet.BootReceiver"
             android:directBootAware="true"

+ 806 - 0
app/src/main/assets/open_source_licenses.html

@@ -0,0 +1,806 @@
+<html>
+  <head>
+    <style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; display: inline-block }</style>
+    <title>Open source licenses</title>
+  </head>
+  <body>
+    <h3>Notice for packages:</h3>
+    <ul>
+      <li><a href="#1478331389">zxing-android-embedded (4.2.0)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Ralf Kistner</dt>
+        </dl>
+      </li>
+<a name="-578145560"></a>
+      <pre>Mulan Permissive Software License,Version 1
+<a href="https://license.coscl.org.cn/MulanPSL2">https://license.coscl.org.cn/MulanPSL2</a></pre>
+<br>
+      <hr>
+      <li><a href="#1934118923">Activity (1.2.2)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Activity (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Activity Kotlin Extensions (1.2.2)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android AppCompat Library v7 (1.2.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Arch-Common (2.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Arch-Runtime (2.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android ConstraintLayout (2.0.4)</a>
+        <dl>
+          <dt>Copyright &copy; 2007 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android ConstraintLayout Solver (2.0.4)</a>
+        <dl>
+          <dt>Copyright &copy; 2007 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android DB (2.0.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle Kotlin Extensions (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2019 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle LiveData (2.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle LiveData Core (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle Runtime (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle ViewModel (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle ViewModel Kotlin Extensions (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle ViewModel with SavedState (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Lifecycle-Common (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Common (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Common Kotlin Extensions (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Fragment (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Fragment Kotlin Extensions (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Runtime (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation Runtime Kotlin Extensions (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation UI (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Navigation UI Kotlin Extensions (2.3.5)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Preferences KTX (1.1.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Resources Library (1.2.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2019 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Room Kotlin Extensions (2.2.6)</a>
+        <dl>
+          <dt>Copyright &copy; 2019 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Room-Common (2.2.6)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Room-Runtime (2.2.6)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support AnimatedVectorDrawable (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2015 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support CardView v7 (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support DynamicAnimation (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Annotations (1.2.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2013 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Async Layout Inflater (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library collections (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library compat (1.6.0-alpha02)</a>
+        <dl>
+          <dt>Copyright &copy; 2015 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Coordinator Layout (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library core UI (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library core utils (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Cursor Adapter (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Custom View (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Custom View (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Document File (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Drawer Layout (1.1.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library fragment (1.3.2)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Interpolators (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library loader (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Local Broadcast Manager (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library media compat (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Print (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library Sliding Pane Layout (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library v4 (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2011 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support Library View Pager (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support RecyclerView v7 (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2014 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support SQLite - Framework Implementation (2.0.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Support VectorDrawable (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2015 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Tracing (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2020 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Android Transition Support Library (1.3.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2016 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">AndroidX Preference (1.1.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2015 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">AndroidX Widget ViewPager2 (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2017 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Collections Kotlin Extensions (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Core Kotlin Extensions (1.6.0-alpha02)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">error-prone annotations (2.5.1)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Experimental annotation (1.0.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2019 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">FindBugs-jsr305 (3.0.2)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Fragment Kotlin Extensions (1.3.2)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Gson (2.8.6)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Guava InternalFutureFailureAccess and InternalFutures (1.0.1)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Guava ListenableFuture only (9999.0-empty-to-avoid-conflict-with-guava)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Guava: Google Core Libraries for Java (30.1.1-android)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">IntelliJ IDEA Annotations (13.0)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx JetBrains Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">J2ObjC Annotations (1.3)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Kotlin Android Extensions Runtime (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Kotlin Stdlib (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Kotlin Stdlib Common (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Kotlin Stdlib Jdk7 (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Kotlin Stdlib Jdk8 (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">kotlinx-coroutines-android (1.4.3)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx JetBrains Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">kotlinx-coroutines-core (1.4.3)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx JetBrains Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">LiveData Core Kotlin Extensions (2.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Material Components for Android (1.3.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2015 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Objenesis (3.2)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">okhttp (5.0.0-alpha.2)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Square, Inc.</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Okio (2.9.0)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Square, Inc.</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Parcelize Runtime (1.4.32)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Kotlin Team</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">Preference X - SimpleMenuPreference (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Mygod</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">recyclerview-fastscroll (2.0.1)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Tim Malseed</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">SavedState Kotlin Extensions (1.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 2020 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">SnakeYAML (1.28)</a>
+        <dl>
+          <dt>Copyright &copy; 2008 Andrey Somov</dt>
+          <dt>Copyright &copy; 2008 Alexander Maslov</dt>
+          <dt>Copyright &copy; 2008 Jordan Angold</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">VersionedParcelable (1.1.1)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 The Android Open Source Project</dt>
+        </dl>
+      </li>
+      <li><a href="#1934118923">ZXing Core (3.4.1)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+<a name="1934118923"></a>
+      <pre>                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+</pre>
+<br>
+      <hr>
+      <li><a href="#2134416733">dexlib2 (2.5.2)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Ben Gruver</dt>
+        </dl>
+      </li>
+      <li><a href="#2134416733">Kryo (5.1.0)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx The original author or authors</dt>
+        </dl>
+      </li>
+      <li><a href="#2134416733">MinLog (1.3.1)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Nathan Sweet</dt>
+        </dl>
+      </li>
+      <li><a href="#2134416733">ReflectASM (1.11.9)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Nathan Sweet</dt>
+        </dl>
+      </li>
+<a name="2134416733"></a>
+      <pre>BSD 3-Clause License
+
+Copyright (c) [year], [fullname]
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+<br>
+      <hr>
+      <li><a href="#1109100048">Checker Qual (2.5.5)</a>
+        <dl>
+          <dt>Copyright &copy; 20xx Michael Ernst</dt>
+          <dt>Copyright &copy; 20xx Werner M. Dietl</dt>
+          <dt>Copyright &copy; 20xx Suzanne Millstein</dt>
+        </dl>
+      </li>
+<a name="1109100048"></a>
+      <pre>GNU General Public License, version 2 (GPL2), with the classpath exception
+<a href="http://www.gnu.org/software/classpath/license.html">http://www.gnu.org/software/classpath/license.html</a></pre>
+<br>
+      <pre>MIT License
+
+Copyright (c) [year] [fullname]
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+</pre>
+<br>
+      <hr>
+      <li><a href="#1783810846">MatrixDev/Roomigrant (0.3.4)</a>
+        <dl>
+          <dt>Copyright &copy; 2018 Rostyslav Lesovyi</dt>
+        </dl>
+      </li>
+<a name="1783810846"></a>
+      <pre>MIT License
+
+Copyright (c) [year] [fullname]
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+</pre>
+<br>
+      <hr>
+    </ul>
+  </body>
+</html>

+ 109 - 0
app/src/main/java/io/nekohasekai/sagernet/bg/TileService.kt

@@ -0,0 +1,109 @@
+/*******************************************************************************
+ *                                                                             *
+ *  Copyright (C) 2017 by Max Lv <[email protected]>                          *
+ *  Copyright (C) 2017 by Mygod Studio <[email protected]>  *
+ *                                                                             *
+ *  This program is free software: you can redistribute it and/or modify       *
+ *  it under the terms of the GNU General Public License as published by       *
+ *  the Free Software Foundation, either version 3 of the License, or          *
+ *  (at your option) any later version.                                        *
+ *                                                                             *
+ *  This program is distributed in the hope that it will be useful,            *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+ *  GNU General Public License for more details.                               *
+ *                                                                             *
+ *  You should have received a copy of the GNU General Public License          *
+ *  along with this program. If not, see <http://www.gnu.org/licenses/>.       *
+ *                                                                             *
+ *******************************************************************************/
+
+package io.nekohasekai.sagernet.bg
+
+import android.app.KeyguardManager
+import android.graphics.drawable.Icon
+import android.service.quicksettings.Tile
+import androidx.annotation.RequiresApi
+import androidx.core.content.getSystemService
+import io.nekohasekai.sagernet.R
+import io.nekohasekai.sagernet.SagerNet
+import io.nekohasekai.sagernet.aidl.IShadowsocksService
+import io.nekohasekai.sagernet.database.DataStore
+import android.service.quicksettings.TileService as BaseTileService
+
+@RequiresApi(24)
+class TileService : BaseTileService(), SagerConnection.Callback {
+    private val iconIdle by lazy { Icon.createWithResource(this, R.drawable.ic_service_idle) }
+    private val iconBusy by lazy { Icon.createWithResource(this, R.drawable.ic_service_busy) }
+    private val iconConnected by lazy {
+        Icon.createWithResource(this,
+            R.drawable.ic_service_active)
+    }
+    private val keyguard by lazy { getSystemService<KeyguardManager>()!! }
+    private var tapPending = false
+
+    private val connection = SagerConnection()
+    override fun stateChanged(state: BaseService.State, profileName: String?, msg: String?) =
+        updateTile(state) { profileName }
+
+    override fun onServiceConnected(service: IShadowsocksService) {
+        updateTile(BaseService.State.values()[service.state]) { service.profileName }
+        if (tapPending) {
+            tapPending = false
+            onClick()
+        }
+    }
+
+    override fun onStartListening() {
+        super.onStartListening()
+        connection.connect(this, this)
+    }
+
+    override fun onStopListening() {
+        connection.disconnect(this)
+        super.onStopListening()
+    }
+
+    override fun onClick() {
+        if (isLocked && !DataStore.canToggleLocked) unlockAndRun(this::toggle) else toggle()
+    }
+
+    private fun updateTile(serviceState: BaseService.State, profileName: () -> String?) {
+        qsTile?.apply {
+            label = null
+            when (serviceState) {
+                BaseService.State.Idle -> error("serviceState")
+                BaseService.State.Connecting -> {
+                    icon = iconBusy
+                    state = Tile.STATE_ACTIVE
+                }
+                BaseService.State.Connected -> {
+                    icon = iconConnected
+                    if (!keyguard.isDeviceLocked) label = profileName()
+                    state = Tile.STATE_ACTIVE
+                }
+                BaseService.State.Stopping -> {
+                    icon = iconBusy
+                    state = Tile.STATE_UNAVAILABLE
+                }
+                BaseService.State.Stopped -> {
+                    icon = iconIdle
+                    state = Tile.STATE_INACTIVE
+                }
+            }
+            label = label ?: getString(R.string.app_name)
+            updateTile()
+        }
+    }
+
+    private fun toggle() {
+        val service = connection.service
+        if (service == null) tapPending =
+            true else BaseService.State.values()[service.state].let { state ->
+            when {
+                state.canStop -> SagerNet.stopService()
+                state == BaseService.State.Stopped -> SagerNet.startService()
+            }
+        }
+    }
+}

+ 33 - 1
app/src/main/java/io/nekohasekai/sagernet/ui/AppManagerActivity.kt

@@ -41,6 +41,7 @@ import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.widget.SwitchCompat
 import androidx.appcompat.widget.Toolbar
+import androidx.core.util.contains
 import androidx.core.util.set
 import androidx.core.view.ViewCompat
 import androidx.core.widget.addTextChangedListener
@@ -292,6 +293,35 @@ class AppManagerActivity : AppCompatActivity() {
                 scanChinaApps()
                 return true
             }
+            R.id.action_invert_selections -> {
+                runOnDefaultDispatcher {
+                    for (app in apps) {
+                        if (proxiedUids.contains(app.uid)) {
+                            proxiedUids.delete(app.uid)
+                        } else {
+                            proxiedUids[app.uid] = true
+                        }
+                    }
+                    DataStore.individual =
+                        apps.filter { isProxiedApp(it) }.joinToString("\n") { it.packageName }
+                    apps = apps.sortedWith(compareBy({ !isProxiedApp(it) }, { it.name.toString() }))
+                    onMainDispatcher {
+                        appsAdapter.filter.filter(search.text?.toString() ?: "")
+                    }
+                }
+
+                return true
+            }
+            R.id.action_clear_selections -> {
+                runOnDefaultDispatcher {
+                    proxiedUids.clear()
+                    DataStore.individual = ""
+                    apps = apps.sortedWith(compareBy({ !isProxiedApp(it) }, { it.name.toString() }))
+                    onMainDispatcher {
+                        appsAdapter.filter.filter(search.text?.toString() ?: "")
+                    }
+                }
+            }
             R.id.action_export_clipboard -> {
                 val success =
                     SagerNet.trySetPrimaryClip("${DataStore.bypass}\n${DataStore.individual}")
@@ -428,8 +458,10 @@ class AppManagerActivity : AppCompatActivity() {
             DataStore.individual =
                 apps.filter { isProxiedApp(it) }.joinToString("\n") { it.packageName }
 
+            apps = apps.sortedWith(compareBy({ !isProxiedApp(it) }, { it.name.toString() }))
+
             onMainDispatcher {
-                appsAdapter.notifyDataSetChanged()
+                appsAdapter.filter.filter(search.text?.toString() ?: "")
 
                 dialog.dismiss()
             }

+ 2 - 1
app/src/main/java/io/nekohasekai/sagernet/ui/ConfigurationFragment.kt

@@ -59,6 +59,7 @@ import java.util.*
 import kotlin.collections.ArrayList
 import kotlin.collections.HashMap
 import kotlin.collections.HashSet
+import kotlin.properties.Delegates
 
 
 class ConfigurationFragment : ToolbarFragment(R.layout.layout_group_list),
@@ -150,7 +151,7 @@ class ConfigurationFragment : ToolbarFragment(R.layout.layout_group_list),
                         snackbar(getString(R.string.action_import_err)).show()
                     } else {
                         val selectedGroup = selectedGroup
-                        var targetIndex: Int = null!!
+                        var targetIndex by Delegates.notNull<Int>()
                         val targetId = if (!selectedGroup.isSubscription) {
                             selectedGroup.id
                         } else {

+ 6 - 2
app/src/main/res/menu/per_app_proxy_menu.xml

@@ -5,8 +5,12 @@
         android:title="@string/action_scan_china_apps"
         app:showAsAction="never" />
     <item
-        android:id="@+id/action_revert_selections"
-        android:title="@string/revert_selections"
+        android:id="@+id/action_invert_selections"
+        android:title="@string/invert_selections"
+        app:showAsAction="never" />
+    <item
+        android:id="@+id/action_clear_selections"
+        android:title="@string/clear_selections"
         app:showAsAction="never" />
     <item
         android:id="@+id/action_export_clipboard"

+ 2 - 1
app/src/main/res/values/strings.xml

@@ -100,7 +100,8 @@
     <string name="off">Off</string>
     <string name="search_apps">Search…</string>
     <string name="scanning">Scanning…</string>
-    <string name="revert_selections">Revert selections</string>
+    <string name="invert_selections">Invert selections</string>
+    <string name="clear_selections">Clear selections</string>
 
     <string name="proxied_apps_mode">Mode</string>
     <string name="bypass_apps">Bypass</string>

+ 9 - 0
bin/libs/shadowsocksr.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+source "bin/init/env.sh"
+
+git submodule update --init shadowsocksr/src/main/jni/*
+rm -rf shadowsocksr/build/outputs/aar
+./gradlew shadowsocksr:assembleRelease || exit 1
+mkdir -p app/libs
+cp shadowsocksr/build/outputs/aar/* app/libs

+ 1 - 0
bin/libs/v2ray/init.sh

@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 
 source "bin/init/env.sh"
+
 export GO111MOUDLE=on
 export PATH="$PATH:$(go env GOPATH)/bin"
 

+ 9 - 0
bin/update_assets.sh

@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+source "bin/init/env.sh"
+
+curl -L -o app/src/main/assets/geofile/geoip.dat "https://github.com/v2fly/geoip/raw/release/geoip.dat"
+curl -L -o app/src/main/assets/geofile/geosite.dat "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat"
+
+curl -L -o v2ray-extra.zip https://github.com/v2fly/v2ray-core/releases/download/v4.37.3/v2ray-extra.zip
+unzip -o v2ray-extra.zip -d app/src/main/assets
+rm v2ray-extra.zip

+ 0 - 4
bin/update_geofile.sh

@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-curl -L -o app/src/main/assets/geofile/geoip.dat "https://github.com/v2fly/geoip/raw/release/geoip.dat"
-curl -L -o app/src/main/assets/geofile/geosite.dat "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat"

+ 2 - 1
settings.gradle

@@ -1,4 +1,5 @@
 include ':app'
 rootProject.name = "SagerNet"
 
-include ':shadowsocks'
+include ':shadowsocks'
+include ':shadowsocksr'

+ 1 - 0
shadowsocksr/.gitignore

@@ -0,0 +1 @@
+/build

+ 29 - 0
shadowsocksr/build.gradle

@@ -0,0 +1,29 @@
+plugins {
+    id 'com.android.library'
+}
+
+android {
+    compileSdkVersion 30
+    buildToolsVersion '30.0.3'
+
+    defaultConfig {
+        minSdkVersion 16
+        targetSdkVersion 30
+        versionCode 1
+        versionName "1.0"
+
+        externalNativeBuild {
+            ndkBuild {
+                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+                arguments "NDK_APPLICATION_MK:=src/main/jni/Application.mk", "APP_PLATFORM:=android-21", "--jobs=${Runtime.getRuntime().availableProcessors()}"
+            }
+        }
+    }
+
+    externalNativeBuild {
+        ndkBuild {
+            path 'src/main/jni/Android.mk'
+        }
+    }
+
+}

+ 4 - 0
shadowsocksr/src/main/AndroidManifest.xml

@@ -0,0 +1,4 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="io.nekohasekai.ssr_libev">
+
+</manifest>

+ 293 - 0
shadowsocksr/src/main/jni/Android.mk

@@ -0,0 +1,293 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+LOCAL_PATH := $(call my-dir)
+ROOT_PATH := $(LOCAL_PATH)
+
+BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk
+
+########################################################
+## libsodium
+########################################################
+
+include $(CLEAR_VARS)
+
+SODIUM_SOURCE := \
+	crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c \
+	crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
+	crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
+	crypto_core/ed25519/ref10/ed25519_ref10.c \
+	crypto_core/hchacha20/core_hchacha20.c \
+	crypto_core/salsa/ref/core_salsa_ref.c \
+	crypto_generichash/blake2b/ref/blake2b-compress-ref.c \
+	crypto_generichash/blake2b/ref/blake2b-ref.c \
+	crypto_generichash/blake2b/ref/generichash_blake2b.c \
+	crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \
+	crypto_onetimeauth/poly1305/donna/poly1305_donna.c \
+	crypto_pwhash/crypto_pwhash.c \
+	crypto_pwhash/argon2/argon2-core.c \
+	crypto_pwhash/argon2/argon2.c \
+	crypto_pwhash/argon2/argon2-encoding.c \
+	crypto_pwhash/argon2/argon2-fill-block-ref.c \
+	crypto_pwhash/argon2/blake2b-long.c \
+	crypto_pwhash/argon2/pwhash_argon2i.c \
+	crypto_scalarmult/curve25519/scalarmult_curve25519.c \
+	crypto_scalarmult/curve25519/ref10/x25519_ref10.c \
+	crypto_stream/chacha20/stream_chacha20.c \
+	crypto_stream/chacha20/ref/chacha20_ref.c \
+	crypto_stream/salsa20/stream_salsa20.c \
+	crypto_stream/salsa20/ref/salsa20_ref.c \
+	crypto_verify/sodium/verify.c \
+	randombytes/randombytes.c \
+	randombytes/sysrandom/randombytes_sysrandom.c \
+	sodium/core.c \
+	sodium/runtime.c \
+	sodium/utils.c \
+	sodium/version.c
+
+LOCAL_MODULE := sodium
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/libsodium/src/libsodium/include \
+				-I$(LOCAL_PATH)/include \
+				-I$(LOCAL_PATH)/include/sodium \
+				-I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
+				-DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" \
+				-DPACKAGE_VERSION=\"1.0.15\" -DPACKAGE_STRING=\"libsodium-1.0.15\" \
+				-DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" \
+				-DPACKAGE_URL=\"https://github.com/jedisct1/libsodium\" \
+				-DPACKAGE=\"libsodium\" -DVERSION=\"1.0.15\" \
+				-DHAVE_PTHREAD=1                  \
+				-DSTDC_HEADERS=1                  \
+				-DHAVE_SYS_TYPES_H=1              \
+				-DHAVE_SYS_STAT_H=1               \
+				-DHAVE_STDLIB_H=1                 \
+				-DHAVE_STRING_H=1                 \
+				-DHAVE_MEMORY_H=1                 \
+				-DHAVE_STRINGS_H=1                \
+				-DHAVE_INTTYPES_H=1               \
+				-DHAVE_STDINT_H=1                 \
+				-DHAVE_UNISTD_H=1                 \
+				-D__EXTENSIONS__=1                \
+				-D_ALL_SOURCE=1                   \
+				-D_GNU_SOURCE=1                   \
+				-D_POSIX_PTHREAD_SEMANTICS=1      \
+				-D_TANDEM_SOURCE=1                \
+				-DHAVE_DLFCN_H=1                  \
+				-DLT_OBJDIR=\".libs/\"            \
+				-DHAVE_SYS_MMAN_H=1               \
+				-DNATIVE_LITTLE_ENDIAN=1          \
+				-DASM_HIDE_SYMBOL=.hidden         \
+				-DHAVE_WEAK_SYMBOLS=1             \
+				-DHAVE_ATOMIC_OPS=1               \
+				-DHAVE_ARC4RANDOM=1               \
+				-DHAVE_ARC4RANDOM_BUF=1           \
+				-DHAVE_MMAP=1                     \
+				-DHAVE_MLOCK=1                    \
+				-DHAVE_MADVISE=1                  \
+				-DHAVE_MPROTECT=1                 \
+				-DHAVE_NANOSLEEP=1                \
+				-DHAVE_POSIX_MEMALIGN=1           \
+				-DHAVE_GETPID=1                   \
+				-DCONFIGURED=1
+
+LOCAL_SRC_FILES := $(addprefix libsodium/src/libsodium/,$(SODIUM_SOURCE))
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## libancillary
+########################################################
+
+include $(CLEAR_VARS)
+
+ANCILLARY_SOURCE := fd_recv.c fd_send.c
+
+LOCAL_MODULE := libancillary
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/libancillary
+
+LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## libipset
+########################################################
+
+include $(CLEAR_VARS)
+
+bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
+		  		  bdd/reachable.c bdd/read.c bdd/write.c
+map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
+		  		  map/storage.c
+set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
+		  		  set/iterator.c set/storage.c
+
+IPSET_SOURCE := general.c $(bdd_src) $(map_src) $(set_src)
+
+LOCAL_MODULE := libipset
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
+				-I$(LOCAL_PATH)/shadowsocks-libev/libcork/include
+
+LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libipset/,$(IPSET_SOURCE))
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## libcork
+########################################################
+
+include $(CLEAR_VARS)
+
+cli_src := cli/commands.c
+core_src := core/allocator.c core/error.c core/gc.c \
+			core/hash.c core/ip-address.c core/mempool.c \
+			core/timestamp.c core/u128.c
+ds_src := ds/array.c ds/bitset.c ds/buffer.c ds/dllist.c \
+		  ds/file-stream.c ds/hash-table.c ds/managed-buffer.c \
+		  ds/ring-buffer.c ds/slice.c
+posix_src := posix/directory-walker.c posix/env.c posix/exec.c \
+			 posix/files.c posix/process.c posix/subprocess.c
+pthreads_src := pthreads/thread.c
+
+CORK_SOURCE := $(cli_src) $(core_src) $(ds_src) $(posix_src) $(pthreads_src)
+
+LOCAL_MODULE := libcork
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
+				-DCORK_API=CORK_LOCAL
+
+LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libcork/,$(CORK_SOURCE))
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## libudns
+########################################################
+
+include $(CLEAR_VARS)
+
+UDNS_SOURCES := udns_dn.c udns_dntosp.c udns_parse.c udns_resolver.c udns_init.c \
+	udns_misc.c udns_XtoX.c \
+	udns_rr_a.c udns_rr_ptr.c udns_rr_mx.c udns_rr_txt.c udns_bl.c \
+	udns_rr_srv.c udns_rr_naptr.c udns_codes.c udns_jran.c
+
+LOCAL_MODULE := libudns
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libudns \
+				-DHAVE_DECL_INET_NTOP
+
+LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libudns/,$(UDNS_SOURCES))
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## libev
+########################################################
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libev
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/include/libev
+LOCAL_SRC_FILES := \
+	shadowsocks-libev/libev/ev.c \
+	shadowsocks-libev/libev/event.c
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## shadowsocks-libev local
+########################################################
+
+include $(CLEAR_VARS)
+
+SHADOWSOCKS_SOURCES := local.c cache.c udprelay.c encrypt.c \
+	utils.c netutils.c json.c jconf.c acl.c http.c tls.c rule.c \
+	android.c
+
+LOCAL_MODULE    := ssr-local
+LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
+LOCAL_CFLAGS    := -Wall -fno-strict-aliasing -DMODULE_LOCAL \
+					-DUSE_CRYPTO_MBEDTLS -DANDROID -DHAVE_CONFIG_H \
+					-DCONNECT_IN_PROGRESS=EINPROGRESS \
+					-I$(LOCAL_PATH)/include/shadowsocks-libev \
+					-I$(LOCAL_PATH)/include \
+					-I$(LOCAL_PATH)/libancillary \
+					-I$(LOCAL_PATH)/mbedtls/include  \
+					-I$(LOCAL_PATH)/pcre \
+					-I$(LOCAL_PATH)/shadowsocks-libev/libudns \
+					-I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
+					-I$(LOCAL_PATH)/libsodium/src/libsodium/include \
+					-I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
+					-I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
+					-I$(LOCAL_PATH)/shadowsocks-libev/libev \
+					-I$(LOCAL_PATH)/shadowsocks-libev/src
+
+LOCAL_STATIC_LIBRARIES := libev libmbedtls libipset libcork libudns \
+	libsodium libancillary libpcre
+
+LOCAL_LDLIBS := -llog
+
+include $(BUILD_SHARED_EXECUTABLE)
+
+########################################################
+## mbed TLS
+########################################################
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := mbedtls
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/mbedtls/include
+
+MBEDTLS_SOURCES := $(wildcard $(LOCAL_PATH)/mbedtls/library/*.c)
+
+LOCAL_SRC_FILES := $(MBEDTLS_SOURCES:$(LOCAL_PATH)/%=%)
+
+include $(BUILD_STATIC_LIBRARY)
+
+########################################################
+## pcre
+########################################################
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := pcre
+
+LOCAL_CFLAGS += -DHAVE_CONFIG_H
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/pcre/dist $(LOCAL_PATH)/pcre
+
+libpcre_src_files := \
+    dist/pcre_byte_order.c \
+    dist/pcre_compile.c \
+    dist/pcre_config.c \
+    dist/pcre_dfa_exec.c \
+    dist/pcre_exec.c \
+    dist/pcre_fullinfo.c \
+    dist/pcre_get.c \
+    dist/pcre_globals.c \
+    dist/pcre_jit_compile.c \
+    dist/pcre_maketables.c \
+    dist/pcre_newline.c \
+    dist/pcre_ord2utf8.c \
+    dist/pcre_refcount.c \
+    dist/pcre_string_utils.c \
+    dist/pcre_study.c \
+    dist/pcre_tables.c \
+    dist/pcre_ucd.c \
+    dist/pcre_valid_utf8.c \
+    dist/pcre_version.c \
+    dist/pcre_xclass.c
+
+LOCAL_SRC_FILES := $(addprefix pcre/, $(libpcre_src_files)) $(LOCAL_PATH)/patch/pcre/pcre_chartables.c
+
+include $(BUILD_STATIC_LIBRARY)

+ 4 - 0
shadowsocksr/src/main/jni/Application.mk

@@ -0,0 +1,4 @@
+APP_CFLAGS := -fdata-sections -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden
+APP_LDFLAGS := -Wl,--hash-style=both -Wl,-exclude-libs,ALL -Wl,--gc-sections
+APP_THIN_ARCHIVE := true
+APP_STL := c++_static

+ 31 - 0
shadowsocksr/src/main/jni/build-shared-executable.mk

@@ -0,0 +1,31 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# this file is included from Android.mk files to build a target-specific
+# executable program
+#
+# Modified by @Mygod, based on:
+#   https://android.googlesource.com/platform/ndk/+/a355a4e/build/core/build-shared-library.mk
+#   https://android.googlesource.com/platform/ndk/+/a355a4e/build/core/build-executable.mk
+LOCAL_BUILD_SCRIPT := BUILD_EXECUTABLE
+LOCAL_MAKEFILE     := $(local-makefile)
+$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
+$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
+$(call check-LOCAL_MODULE_FILENAME)
+# we are building target objects
+my := TARGET_
+$(call handle-module-filename,lib,$(TARGET_SONAME_EXTENSION))
+$(call handle-module-built)
+LOCAL_MODULE_CLASS := EXECUTABLE
+include $(BUILD_SYSTEM)/build-module.mk

+ 129 - 0
shadowsocksr/src/main/jni/include/libev/config.h

@@ -0,0 +1,129 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+/* #undef HAVE_CLOCK_GETTIME */
+
+/* Define to 1 to use the syscall interface for clock_gettime */
+#define HAVE_CLOCK_SYSCALL 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+#define HAVE_EPOLL_CTL 1
+
+/* Define to 1 if you have the `eventfd' function. */
+#define HAVE_EVENTFD 1
+
+/* Define to 1 if the floor function is available */
+#define HAVE_FLOOR 1
+
+/* Define to 1 if you have the `inotify_init' function. */
+#define HAVE_INOTIFY_INIT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef HAVE_KQUEUE */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+#define HAVE_NANOSLEEP 1
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef HAVE_PORT_H */
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `signalfd' function. */
+#define HAVE_SIGNALFD 0
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#define HAVE_SYS_EPOLL_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define HAVE_SYS_EVENTFD_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/inotify.h> header file. */
+#define HAVE_SYS_INOTIFY_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/signalfd.h> header file. */
+#define HAVE_SYS_SIGNALFD_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libev"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "4.11"
+
+#define DNDEBUG 1
+#define HAVE_CONFIG_H 1

+ 425 - 0
shadowsocksr/src/main/jni/include/shadowsocks-libev/config.h

@@ -0,0 +1,425 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* errno for incomplete non-blocking connect(2) */
+#define CONNECT_IN_PROGRESS EINPROGRESS
+
+/* Override libev default fd conversion macro. */
+/* #undef EV_FD_TO_WIN32_HANDLE */
+
+/* Override libev default fd close macro. */
+/* #undef EV_WIN32_CLOSE_FD */
+
+/* Override libev default handle conversion macro. */
+/* #undef EV_WIN32_HANDLE_TO_FD */
+
+/* Reset max file descriptor size. */
+/* #undef FD_SETSIZE */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `CCCryptorCreateWithMode' function. */
+/* #undef HAVE_CCCRYPTORCREATEWITHMODE */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+/* #undef HAVE_CLOCK_GETTIME */
+
+/* Define to 1 to use the syscall interface for clock_gettime */
+/* #undef HAVE_CLOCK_SYSCALL */
+
+/* Define to 1 if you have the <CommonCrypto/CommonCrypto.h> header file. */
+/* #undef HAVE_COMMONCRYPTO_COMMONCRYPTO_H */
+
+/* Define to 1 if you have the declaration of `inet_ntop', and to 0 if you
+   don't. */
+#define HAVE_DECL_INET_NTOP 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+/* #undef HAVE_EPOLL_CTL */
+
+/* Define to 1 if you have the `eventfd' function. */
+/* #undef HAVE_EVENTFD */
+
+/* Define to 1 if you have the `EVP_EncryptInit_ex' function. */
+/* #undef HAVE_EVP_ENCRYPTINIT_EX */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if the floor function is available */
+#define HAVE_FLOOR 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+#define HAVE_GETPWNAM_R 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+/* #undef HAVE_INET_NTOP */
+
+/* Define to 1 if you have the `inotify_init' function. */
+/* #undef HAVE_INOTIFY_INIT */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Enable IPv6 support in libudns */
+#define HAVE_IPv6 1
+
+/* Define to 1 if you have the `kqueue' function. */
+#define HAVE_KQUEUE 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/if.h> header file. */
+/* #undef HAVE_LINUX_IF_H */
+
+/* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */
+/* #undef HAVE_LINUX_NETFILTER_IPV4_H */
+
+/* Define to 1 if you have the <linux/netfilter_ipv6/ip6_tables.h> header
+   file. */
+/* #undef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `malloc' function. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+#define HAVE_NANOSLEEP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#define HAVE_NET_IF_H 1
+
+/* Define to 1 if you have the <openssl/engine.h> header file. */
+/* #undef HAVE_OPENSSL_ENGINE_H */
+
+/* Define to 1 if you have the <openssl/err.h> header file. */
+/* #undef HAVE_OPENSSL_ERR_H */
+
+/* Define to 1 if you have the <openssl/evp.h> header file. */
+/* #undef HAVE_OPENSSL_EVP_H */
+
+/* Define to 1 if you have the <openssl/pem.h> header file. */
+/* #undef HAVE_OPENSSL_PEM_H */
+
+/* Define to 1 if you have the <openssl/rand.h> header file. */
+/* #undef HAVE_OPENSSL_RAND_H */
+
+/* Define to 1 if you have the <openssl/rsa.h> header file. */
+/* #undef HAVE_OPENSSL_RSA_H */
+
+/* Define to 1 if you have the <openssl/sha.h> header file. */
+/* #undef HAVE_OPENSSL_SHA_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef HAVE_PORT_H */
+
+/* Have PTHREAD_PRIO_INHERIT. */
+#define HAVE_PTHREAD_PRIO_INHERIT 1
+
+/* Define to 1 if you have the `RAND_pseudo_bytes' function. */
+/* #undef HAVE_RAND_PSEUDO_BYTES */
+
+/* Define to 1 if you have the 'select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `setresuid' function. */
+/* #undef HAVE_SETRESUID */
+
+/* Define to 1 if you have the `setreuid' function. */
+#define HAVE_SETREUID 1
+
+/* Define to 1 if you have the `setrlimit' function. */
+#define HAVE_SETRLIMIT 1
+
+/* Define to 1 if you have the `signalfd' function. */
+/* #undef HAVE_SIGNALFD */
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+#define HAVE_SYS_EVENT_H 1
+
+/* Define to 1 if you have the <sys/inotify.h> header file. */
+/* #undef HAVE_SYS_INOTIFY_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/signalfd.h> header file. */
+/* #undef HAVE_SYS_SIGNALFD_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+/* #undef HAVE_WINSOCK2_H */
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+/* #undef HAVE_WS2TCPIP_H */
+
+/* have zlib compression support */
+/* #undef HAVE_ZLIB */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+/* #undef HAVE_ZLIB_H */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 if assertions should be disabled. */
+/* #undef NDEBUG */
+
+/* Name of package */
+#define PACKAGE "shadowsocks-libev"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "[email protected]"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "shadowsocks-libev"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "shadowsocks-libev 2.4.8"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "shadowsocks-libev"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.4.8"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to the type of arg 1 for `select'. */
+#define SELECT_TYPE_ARG1 int
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#define SELECT_TYPE_ARG234 (fd_set *)
+
+/* Define to the type of arg 5 for `select'. */
+#define SELECT_TYPE_ARG5 (struct timeval *)
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* If the compiler supports a TLS storage class define it to that here */
+#define TLS __thread
+
+/* Use Apple CommonCrypto library */
+/* #undef USE_CRYPTO_APPLECC */
+
+/* Use mbed TLS library */
+#define USE_CRYPTO_MBEDTLS 1
+
+/* Use OpenSSL library */
+/* #undef USE_CRYPTO_OPENSSL */
+
+/* Use PolarSSL library */
+/* #undef USE_CRYPTO_POLARSSL */
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Version number of package */
+#define VERSION "2.4.8"
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT8_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#define restrict __restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint16_t */
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint8_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
+
+/* Define to 1 if you have the <pcre.h> header file. */
+#define HAVE_PCRE_H 1
+
+/* Define to 1 if you have the <pcre/pcre.h> header file. */
+/* #undef HAVE_PCRE_PCRE_H */

+ 29 - 0
shadowsocksr/src/main/jni/include/sodium/version.h

@@ -0,0 +1,29 @@
+
+#ifndef sodium_version_H
+#define sodium_version_H
+
+#include "export.h"
+
+#define SODIUM_VERSION_STRING "1.0.7"
+
+#define SODIUM_LIBRARY_VERSION_MAJOR 9
+#define SODIUM_LIBRARY_VERSION_MINOR 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+const char *sodium_version_string(void);
+
+SODIUM_EXPORT
+int         sodium_library_version_major(void);
+
+SODIUM_EXPORT
+int         sodium_library_version_minor(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 1 - 0
shadowsocksr/src/main/jni/libancillary

@@ -0,0 +1 @@
+Subproject commit 311e5d14f593f16c785bc6605220517eb1f21f6b

+ 1 - 0
shadowsocksr/src/main/jni/libsodium

@@ -0,0 +1 @@
+Subproject commit 710b2d3963347017ba73047550d8822e50d3bcec

+ 1 - 0
shadowsocksr/src/main/jni/mbedtls

@@ -0,0 +1 @@
+Subproject commit d414c32a160a45725430d99b3c11904760ac8b9c

+ 198 - 0
shadowsocksr/src/main/jni/patch/pcre/pcre_chartables.c

@@ -0,0 +1,198 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* This file contains character tables that are used when no external tables
+are passed to PCRE by the application that calls it. The tables are used only
+for characters whose code values are less than 256.
+
+This is a default version of the tables that assumes ASCII encoding. A program
+called dftables (which is distributed with PCRE) can be used to build
+alternative versions of this file. This is necessary if you are running in an
+EBCDIC environment, or if you want to default to a different encoding, for
+example ISO-8859-1. When dftables is run, it creates these tables in the
+current locale. If PCRE is configured with --enable-rebuild-chartables, this
+happens automatically.
+
+The following #includes are present because without them gcc 4.x may remove the
+array definition from the final binary if PCRE is built into a static library
+and dead code stripping is activated. This leads to link errors. Pulling in the
+header ensures that the array gets flagged as "someone outside this compilation
+unit might reference this" and so it will always be supplied to the linker. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre_internal.h"
+
+const pcre_uint8 PRIV(default_tables)[] = {
+
+/* This table is a lower casing table. */
+
+    0,  1,  2,  3,  4,  5,  6,  7,
+    8,  9, 10, 11, 12, 13, 14, 15,
+   16, 17, 18, 19, 20, 21, 22, 23,
+   24, 25, 26, 27, 28, 29, 30, 31,
+   32, 33, 34, 35, 36, 37, 38, 39,
+   40, 41, 42, 43, 44, 45, 46, 47,
+   48, 49, 50, 51, 52, 53, 54, 55,
+   56, 57, 58, 59, 60, 61, 62, 63,
+   64, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122, 91, 92, 93, 94, 95,
+   96, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122,123,124,125,126,127,
+  128,129,130,131,132,133,134,135,
+  136,137,138,139,140,141,142,143,
+  144,145,146,147,148,149,150,151,
+  152,153,154,155,156,157,158,159,
+  160,161,162,163,164,165,166,167,
+  168,169,170,171,172,173,174,175,
+  176,177,178,179,180,181,182,183,
+  184,185,186,187,188,189,190,191,
+  192,193,194,195,196,197,198,199,
+  200,201,202,203,204,205,206,207,
+  208,209,210,211,212,213,214,215,
+  216,217,218,219,220,221,222,223,
+  224,225,226,227,228,229,230,231,
+  232,233,234,235,236,237,238,239,
+  240,241,242,243,244,245,246,247,
+  248,249,250,251,252,253,254,255,
+
+/* This table is a case flipping table. */
+
+    0,  1,  2,  3,  4,  5,  6,  7,
+    8,  9, 10, 11, 12, 13, 14, 15,
+   16, 17, 18, 19, 20, 21, 22, 23,
+   24, 25, 26, 27, 28, 29, 30, 31,
+   32, 33, 34, 35, 36, 37, 38, 39,
+   40, 41, 42, 43, 44, 45, 46, 47,
+   48, 49, 50, 51, 52, 53, 54, 55,
+   56, 57, 58, 59, 60, 61, 62, 63,
+   64, 97, 98, 99,100,101,102,103,
+  104,105,106,107,108,109,110,111,
+  112,113,114,115,116,117,118,119,
+  120,121,122, 91, 92, 93, 94, 95,
+   96, 65, 66, 67, 68, 69, 70, 71,
+   72, 73, 74, 75, 76, 77, 78, 79,
+   80, 81, 82, 83, 84, 85, 86, 87,
+   88, 89, 90,123,124,125,126,127,
+  128,129,130,131,132,133,134,135,
+  136,137,138,139,140,141,142,143,
+  144,145,146,147,148,149,150,151,
+  152,153,154,155,156,157,158,159,
+  160,161,162,163,164,165,166,167,
+  168,169,170,171,172,173,174,175,
+  176,177,178,179,180,181,182,183,
+  184,185,186,187,188,189,190,191,
+  192,193,194,195,196,197,198,199,
+  200,201,202,203,204,205,206,207,
+  208,209,210,211,212,213,214,215,
+  216,217,218,219,220,221,222,223,
+  224,225,226,227,228,229,230,231,
+  232,233,234,235,236,237,238,239,
+  240,241,242,243,244,245,246,247,
+  248,249,250,251,252,253,254,255,
+
+/* This table contains bit maps for various character classes. Each map is 32
+bytes long and the bits run from the least significant end of each byte. The
+classes that have their own maps are: space, xdigit, digit, upper, lower, word,
+graph, print, punct, and cntrl. Other classes are built from combinations. */
+
+  0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+  0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
+  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc,
+  0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+  0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/* This table identifies various classes of character by individual bits:
+  0x01   white space character
+  0x02   letter
+  0x04   decimal digit
+  0x08   hexadecimal digit
+  0x10   alphanumeric or '_'
+  0x80   regular expression metacharacter or binary zero
+*/
+
+  0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7 */
+  0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /*   8- 15 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  16- 23 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  24- 31 */
+  0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /*    - '  */
+  0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /*  ( - /  */
+  0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /*  0 - 7  */
+  0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /*  8 - ?  */
+  0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /*  @ - G  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  H - O  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  P - W  */
+  0x12,0x12,0x12,0x80,0x80,0x00,0x80,0x10, /*  X - _  */
+  0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /*  ` - g  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  h - o  */
+  0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /*  p - w  */
+  0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /*  x -127 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
+
+/* End of pcre_chartables.c */

+ 1 - 0
shadowsocksr/src/main/jni/pcre

@@ -0,0 +1 @@
+Subproject commit 222bbf4b3fb8e13c21686803e47e31aa3e4ad130

+ 1 - 0
shadowsocksr/src/main/jni/re2

@@ -0,0 +1 @@
+Subproject commit 6ec705dcd7a44a458f2b41630ab2101dc404053c

+ 1 - 0
shadowsocksr/src/main/jni/shadowsocks-libev

@@ -0,0 +1 @@
+Subproject commit 70921a02a860b0ca2df4069a609951bc4182c245