├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── github │ │ └── shadowsocks │ │ └── plugin │ │ └── gq_client │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── shadowsocks │ │ │ └── plugin │ │ │ └── gq_client │ │ │ ├── BinaryProvider.kt │ │ │ ├── ConfigActivity.kt │ │ │ └── ConfigFragment.kt │ └── res │ │ ├── drawable-v24 │ │ ├── ic_action_done.xml │ │ ├── ic_launcher_foreground.xml │ │ └── ic_navigation_close.xml │ │ ├── drawable │ │ ├── ic_action_done.xml │ │ ├── ic_launcher_background.xml │ │ └── ic_navigation_close.xml │ │ ├── layout │ │ └── activity_config.xml │ │ ├── menu │ │ └── menu_config.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── array.xml │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── config.xml │ └── make.sh ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /app/src/main/jniLibs/ 11 | .idea 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GoQuiet-android 2 | Shadowsocks plugin GoQuiet for Android 3 | 4 | ## Requirements 5 | 6 | - Go1.11+ 7 | - Android NDK 8 | - Android SDK 26+ 9 | 10 | ## Build Instructions 11 | 12 | 1. Edit ndk-bundle\build\tools\make_standalone_toolchain.py, change the line `flags = '-target {} -stdlib=libc++'.format(target)` to `flags = '-target {}'.format(target)` (see https://github.com/golang/go/issues/29706) 13 | 2. Execute `make.sh` 14 | 3. Build with Android Studio -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | 8 | android { 9 | signingConfigs { 10 | } 11 | compileSdkVersion 29 12 | //buildToolsVersion '26.0.2' 13 | defaultConfig { 14 | applicationId "com.github.shadowsocks.plugin.gq_client" 15 | minSdkVersion 21 16 | targetSdkVersion 29 17 | versionCode 2 18 | versionName '1.0.0' 19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 20 | } 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | productFlavors { 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(include: ['*.jar'], dir: 'libs') 33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 34 | implementation 'androidx.appcompat:appcompat:1.1.0' 35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 36 | implementation 'com.github.shadowsocks:plugin:1.3.4' 37 | androidTestImplementation 'androidx.test:runner:1.2.0' 38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 40 | } 41 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/github/shadowsocks/plugin/gq_client/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.github.shadowsocks.plugin.gq_client 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.github.shadowsocks.plugin.gq_client", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/github/shadowsocks/plugin/gq_client/BinaryProvider.kt: -------------------------------------------------------------------------------- 1 | package com.github.shadowsocks.plugin.gq_client 2 | 3 | import android.net.Uri 4 | import android.os.ParcelFileDescriptor 5 | import java.io.File 6 | import java.io.FileNotFoundException 7 | import android.util.Log 8 | 9 | import com.github.shadowsocks.plugin.NativePluginProvider 10 | import com.github.shadowsocks.plugin.PathProvider 11 | 12 | class BinaryProvider : NativePluginProvider() { 13 | override fun populateFiles(provider: PathProvider) { 14 | provider.addPath("gq-client", 0b111101101) 15 | } 16 | 17 | override fun getExecutable(): String { 18 | val exec = context.applicationInfo.nativeLibraryDir + "/libgq-client.so" 19 | Log.d("execPath", exec) 20 | Log.d("execExists", File(exec).exists().toString()) 21 | return exec 22 | } 23 | 24 | override fun openFile(uri: Uri): ParcelFileDescriptor { 25 | when (uri.path) { 26 | "/gq-client" -> return ParcelFileDescriptor.open(File(getExecutable()), ParcelFileDescriptor.MODE_READ_ONLY) 27 | else -> throw FileNotFoundException() 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/shadowsocks/plugin/gq_client/ConfigActivity.kt: -------------------------------------------------------------------------------- 1 | package com.github.shadowsocks.plugin.gq_client 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.widget.Toolbar 5 | import android.util.Log 6 | import android.view.MenuItem 7 | import com.github.shadowsocks.plugin.ConfigurationActivity 8 | import com.github.shadowsocks.plugin.PluginOptions 9 | 10 | 11 | class ConfigActivity : ConfigurationActivity(), Toolbar.OnMenuItemClickListener { 12 | 13 | fun getChild(): ConfigFragment { 14 | return getFragmentManager().findFragmentById(R.id.content) as ConfigFragment 15 | } 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContentView(R.layout.activity_config) 20 | val toolbar = findViewById(R.id.toolbar) as Toolbar 21 | toolbar.setTitle(getTitle()) 22 | toolbar.setNavigationIcon(R.drawable.ic_navigation_close) 23 | toolbar.setNavigationOnClickListener( 24 | fun(_) { 25 | onBackPressed() 26 | }) 27 | toolbar.inflateMenu(R.menu.menu_config) 28 | toolbar.setOnMenuItemClickListener(this) 29 | } 30 | 31 | override fun onInitializePluginOptions(options: PluginOptions) { 32 | getChild().onInitializePluginOptions(options) 33 | } 34 | 35 | override fun onMenuItemClick(item: MenuItem): Boolean { 36 | when (item.getItemId()) { 37 | R.id.action_apply -> { 38 | Log.d("options", getChild()._options.toString()) 39 | saveChanges(getChild()._options) 40 | finish() 41 | return true 42 | } 43 | else -> return false 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/shadowsocks/plugin/gq_client/ConfigFragment.kt: -------------------------------------------------------------------------------- 1 | package com.github.shadowsocks.plugin.gq_client 2 | 3 | import android.os.Bundle 4 | import android.preference.EditTextPreference 5 | import android.preference.ListPreference 6 | import android.preference.Preference 7 | import android.preference.PreferenceFragment 8 | import android.view.View 9 | import com.github.shadowsocks.plugin.PluginContract 10 | import com.github.shadowsocks.plugin.PluginOptions 11 | 12 | 13 | class ConfigFragment : PreferenceFragment() { 14 | var _options = PluginOptions() 15 | 16 | fun onInitializePluginOptions(options: PluginOptions) { 17 | this._options = options 18 | val ary = arrayOf(Pair("Key", ""), Pair("ServerName", "bing.com"), 19 | Pair("TicketTimeHint", "3600"), Pair("Browser", "chrome")) 20 | for (element in ary) { 21 | val key = element.first 22 | val defaultValue = element.second 23 | val pref = findPreference(key) 24 | val current: String? = options.get(key) 25 | val value = current ?: defaultValue 26 | when (pref) { 27 | is ListPreference -> { 28 | pref.setValue(value) 29 | } 30 | is EditTextPreference -> { 31 | pref.setText(value) 32 | } 33 | } 34 | // we want all preferences to be put into the options, not only the changed ones 35 | options.put(key, value) 36 | pref.setOnPreferenceChangeListener( 37 | fun(_: Preference, value: Any): Boolean { 38 | options.put(key, value.toString()) 39 | return true 40 | } 41 | ) 42 | } 43 | } 44 | 45 | override fun onSaveInstanceState(outState: Bundle) { 46 | super.onSaveInstanceState(outState) 47 | outState.putString(PluginContract.EXTRA_OPTIONS, _options.toString()) 48 | } 49 | 50 | override fun onViewCreated(vidw: View, savedInstanceState: Bundle?) { 51 | super.onViewCreated(vidw, savedInstanceState) 52 | if (savedInstanceState != null) { 53 | _options = PluginOptions(savedInstanceState.getString(PluginContract.EXTRA_OPTIONS)) 54 | onInitializePluginOptions(_options) 55 | } 56 | addPreferencesFromResource(R.xml.config) 57 | } 58 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_action_done.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_navigation_close.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_done.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_navigation_close.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/array.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | chrome 5 | firefox 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF5722 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GoQuiet 3 | Server Name 4 | Key 5 | Ticket Time Hint 6 | Browser 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 14 | 20 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/make.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #Copyright (C) 2017 by Max Lv 4 | #Copyright (C) 2017 by Mygod Studio 5 | #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. 6 | #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. 7 | #You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. 8 | 9 | 10 | 11 | function try () { 12 | "$@" || exit -1 13 | } 14 | 15 | [ -z "$ANDROID_NDK_HOME" ] && ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle 16 | 17 | if [ ! -d "$ANDROID_SDK_PATH" ]; then 18 | ANDROID_NDK_HOME=$USERPROFILE/AppData/Local/Android/Sdk/ndk-bundle 19 | fi 20 | 21 | while [ ! -d "$ANDROID_NDK_HOME" ]; do 22 | echo "Path to ndk-bundle not found. Please enter the full path" 23 | read -p '' ANDROID_NDK_HOME 24 | done 25 | 26 | 27 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 28 | MIN_API=21 29 | DEPS=$(pwd)/.deps 30 | ANDROID_ARM_TOOLCHAIN=$DEPS/android-toolchain-${MIN_API}-arm 31 | ANDROID_ARM64_TOOLCHAIN=$DEPS/android-toolchain-21-arm64 32 | ANDROID_X86_TOOLCHAIN=$DEPS/android-toolchain-${MIN_API}-x86 33 | 34 | ANDROID_ARM_CC=$ANDROID_ARM_TOOLCHAIN/bin/arm-linux-androideabi-clang 35 | ANDROID_ARM_STRIP=$ANDROID_ARM_TOOLCHAIN/bin/arm-linux-androideabi-strip 36 | 37 | ANDROID_ARM64_CC=$ANDROID_ARM64_TOOLCHAIN/bin/aarch64-linux-android-clang 38 | ANDROID_ARM64_STRIP=$ANDROID_ARM64_TOOLCHAIN/bin/aarch64-linux-android-strip 39 | 40 | ANDROID_X86_CC=$ANDROID_X86_TOOLCHAIN/bin/i686-linux-android-clang 41 | ANDROID_X86_STRIP=$ANDROID_X86_TOOLCHAIN/bin/i686-linux-android-strip 42 | 43 | try mkdir -p $DEPS $DIR/main/jniLibs/armeabi-v7a $DIR/main/jniLibs/x86 $DIR/main/jniLibs/arm64-v8a 44 | 45 | if [ ! -f "$ANDROID_ARM_CC" ]; then 46 | echo "Make standalone toolchain for ARM arch" 47 | $ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch arm \ 48 | --api $MIN_API --install-dir $ANDROID_ARM_TOOLCHAIN 49 | fi 50 | 51 | if [ ! -f "$ANDROID_ARM64_CC" ]; then 52 | echo "Make standalone toolchain for ARM64 arch" 53 | $ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch arm64 \ 54 | --api 21 --install-dir $ANDROID_ARM64_TOOLCHAIN 55 | fi 56 | 57 | if [ ! -f "$ANDROID_X86_CC" ]; then 58 | echo "Make standalone toolchain for X86 arch" 59 | $ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch x86 \ 60 | --api $MIN_API --install-dir $ANDROID_X86_TOOLCHAIN 61 | fi 62 | 63 | export GOPATH=$DEPS/gopath 64 | 65 | echo "Getting GoQuiet source code" 66 | go get -u github.com/cbeuw/GoQuiet 67 | 68 | pushd $GOPATH/src/github.com/cbeuw/GoQuiet/cmd/gq-client 69 | 70 | echo "Cross compile gqclient for arm" 71 | try env CGO_ENABLED=1 CC=$ANDROID_ARM_CC GOOS=android GOARCH=arm GOARM=7 go build -ldflags="-s -w" 72 | try $ANDROID_ARM_STRIP gq-client 73 | try mv gq-client $DIR/main/jniLibs/armeabi-v7a/libgq-client.so 74 | 75 | echo "Cross compile gqclient for arm64" 76 | try env CGO_ENABLED=1 CC=$ANDROID_ARM64_CC GOOS=android GOARCH=arm64 go build -ldflags="-s -w" 77 | try $ANDROID_ARM64_STRIP gq-client 78 | try mv gq-client $DIR/main/jniLibs//arm64-v8a/libgq-client.so 79 | 80 | echo "Cross compile gqclient for x86" 81 | try env CGO_ENABLED=1 CC=$ANDROID_X86_CC GOOS=android GOARCH=386 go build -ldflags="-s -w" 82 | try $ANDROID_X86_STRIP gq-client 83 | try mv gq-client $DIR/main/jniLibs/x86/libgq-client.so 84 | popd 85 | 86 | echo "Success" -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.11' 5 | repositories { 6 | google() 7 | jcenter() 8 | maven { url "https://jitpack.io" } 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.3.0' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | google() 22 | jcenter() 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | android.enableJetifier=true 10 | android.useAndroidX=true 11 | org.gradle.jvmargs=-Xmx1536m 12 | # When configured, Gradle will run in incubating parallel mode. 13 | # This option should only be used with decoupled projects. More details, visit 14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 15 | # org.gradle.parallel=true 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbeuw/GoQuiet-android/a9585d5e676ec79838fbee1ca1203a7599b550b0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Feb 15 20:01:32 AEDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':preference-v7', ':plugin' 2 | --------------------------------------------------------------------------------