Update core

This commit is contained in:
世界
2021-10-27 14:42:35 +08:00
parent 8d7cbd6cac
commit a17c360e71
69 changed files with 62 additions and 2236 deletions

View File

@@ -184,106 +184,16 @@ jobs:
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run plugin hysteria
wireguard:
name: Native Build (WireGuard)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'plugin/wireguard/*' > wireguard_status
- name: WireGuard Cache
id: cache
uses: actions/cache@v2
with:
path: |
plugin/wireguard/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/wireguard/*', 'wireguard_status') }}
- name: Install Golang
uses: actions/setup-go@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: 1.17.1
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run plugin wireguard
shadowsocks:
name: Native Build (shadowsocks-rust)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'library/shadowsocks/*' > shadowsocks_status
- name: Shadowsocks Cache
id: cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks/build.gradle.kts', 'shadowsocks_status') }}
- name: Install Rust
if: steps.cache.outputs.cache-hit != 'true'
run: ./run init action shadowsocks
- name: Gradle cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle.kts') }}
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
env:
BUILD_PLUGIN: none
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
./run init action library
./run lib shadowsocks
shadowsocks_libev:
name: Native Build (shadowsocks-libev)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'library/shadowsocks-libev/*' > shadowsocks_libev_status
- name: shadowsocks-libev Cache
id: cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks-libev.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks-libev/build.gradle.kts', 'shadowsocks_libev_status') }}
- name: Gradle cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle.kts') }}
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
env:
BUILD_PLUGIN: none
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
./run init action library
./run lib shadowsocks_libev
Lint:
lint:
name: Android Lint
runs-on: ubuntu-latest
needs:
- libcore
- shadowsocks
- shadowsocks_libev
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
git submodule status 'library/shadowsocks/*' > shadowsocks_status
git submodule status 'library/shadowsocks-libev/*' > shadowsocks_libev_status
git submodule status library/core > libcore_status
- name: LibCore Cache
uses: actions/cache@v2
@@ -291,18 +201,6 @@ jobs:
path: |
app/libs/libcore.aar
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/core/*', 'libcore_status') }}
- name: Shadowsocks Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks/build.gradle.kts', 'shadowsocks_status') }}
- name: Shadowsocks (libev) Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks-libev.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks-libev/build.gradle.kts', 'shadowsocks_libev_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:

View File

@@ -58,85 +58,16 @@ jobs:
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
./run lib core
shadowsocks:
name: Native Build (shadowsocks-rust)
runs-on: ubuntu-latest
needs: check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'library/shadowsocks/*' > shadowsocks_status
- name: Shadowsocks Cache
id: cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks/build.gradle.kts', 'shadowsocks_status') }}
- name: Install Rust
if: steps.cache.outputs.cache-hit != 'true'
run: ./run init action shadowsocks
- name: Gradle cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle.kts') }}
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
env:
BUILD_PLUGIN: none
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
./run init action library
./run lib shadowsocks
shadowsocks_libev:
name: Native Build (shadowsocks-libev)
runs-on: ubuntu-latest
needs: check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'library/shadowsocks-libev/*' > shadowsocks_libev_status
- name: Shadowsocks Cache
id: cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks-libev.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks-libev/build.gradle.kts', 'shadowsocks_libev_status') }}
- name: Gradle cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle.kts') }}
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
env:
BUILD_PLUGIN: none
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
./run init action library
./run lib shadowsocks_libev
build:
name: Gradle Build
runs-on: ubuntu-latest
needs:
- libcore
- shadowsocks
- shadowsocks_libev
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
git submodule status 'library/shadowsocks/*' > shadowsocks_status
git submodule status 'library/shadowsocks-libev/*' > shadowsocks_libev_status
git submodule status library/core > libcore_status
- name: LibCore Cache
uses: actions/cache@v2
@@ -144,18 +75,6 @@ jobs:
path: |
app/libs/libcore.aar
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/core/*', 'libcore_status') }}
- name: Shadowsocks Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks/build.gradle.kts', 'shadowsocks_status') }}
- name: Shadowsocks (libev) Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks-libev.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks-libev/build.gradle.kts', 'shadowsocks_libev_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:
@@ -251,15 +170,11 @@ jobs:
runs-on: ubuntu-latest
needs:
- libcore
- shadowsocks
- shadowsocks_libev
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
git submodule status 'library/shadowsocks/*' > shadowsocks_status
git submodule status 'library/shadowsocks-libev/*' > shadowsocks_libev_status
git submodule status library/core > libcore_status
- name: LibCore Cache
uses: actions/cache@v2
@@ -267,18 +182,6 @@ jobs:
path: |
app/libs/libcore.aar
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/core/*', 'libcore_status') }}
- name: Shadowsocks Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks/build.gradle.kts', 'shadowsocks_status') }}
- name: Shadowsocks (libev) Cache
uses: actions/cache@v2
with:
path: |
app/libs/shadowsocks-libev.aar
key: ${{ hashFiles('.github/workflows/*', 'library/shadowsocks-libev/build.gradle.kts', 'shadowsocks_libev_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:

View File

@@ -1,198 +0,0 @@
name: WireGuard Plugin Release Build
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
upload:
description: 'Upload: If want ignore'
required: false
publish:
description: 'Publish: If want ignore'
required: false
play:
description: 'Play: If want ignore'
required: false
jobs:
check:
name: Check Access
runs-on: ubuntu-latest
steps:
- name: "Check access"
uses: "lannonbr/repo-permission-check-action@2.0.0"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
native:
name: Native Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'plugin/wireguard/*' > wireguard_status
- name: WireGuard Cache
id: cache
uses: actions/cache@v2
with:
path: |
plugin/wireguard/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/wireguard/*', 'wireguard_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Install Golang
uses: actions/setup-go@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: 1.17.1
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run plugin wireguard
build:
name: Gradle Build
runs-on: ubuntu-latest
needs:
- native
- check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'plugin/wireguard/*' > wireguard_status
- name: WireGuard Cache
uses: actions/cache@v2
with:
path: |
plugin/wireguard/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/wireguard/*', 'wireguard_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Release Build
env:
SKIP_BUILD: on
BUILD_PLUGIN: wireguard
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
./run init action library
./gradlew :plugin:wireguard:assembleOssRelease
APK=$(find plugin/wireguard/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname $APK)
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: APKs
path: ${{ env.APK }}
- uses: actions/upload-artifact@v2
with:
name: "SHA256-ARM ${{ env.SHA256_ARM }}"
path: ${{ env.SUM_ARM }}
- uses: actions/upload-artifact@v2
with:
name: "SHA256-ARM64 ${{ env.SHA256_ARM64 }}"
path: ${{ env.SUM_ARM64 }}
- uses: actions/upload-artifact@v2
with:
name: "SHA256-X64 ${{ env.SHA256_X64 }}"
path: ${{ env.SUM_X64 }}
- uses: actions/upload-artifact@v2
with:
name: "SHA256-X86 ${{ env.SHA256_X86 }}"
path: ${{ env.SUM_X86 }}
publish:
name: Publish Release
if: github.event.inputs.publish != 'y'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Donwload Artifacts
uses: actions/download-artifact@v2
with:
name: APKs
path: artifacts
- name: Release
run: |
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz
tar -xvf ghr.tar.gz
mv ghr*linux_amd64/ghr .
mkdir apks
find artifacts -name "*.apk" -exec cp {} apks \;
find artifacts -name "*.sha256sum.txt" -exec cp {} apks \;
./ghr -delete -prerelease -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" apks
upload:
name: Upload Release
if: github.event.inputs.upload != 'y'
runs-on: ubuntu-latest
needs: build
steps:
- name: Donwload Artifacts
uses: actions/download-artifact@v2
with:
name: APKs
path: artifacts
- name: Release
run: |
mkdir apks
find artifacts -name "*.apk" -exec cp {} apks \;
function upload() {
for apk in $@; do
echo ">> Uploading $apk"
curl https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
-X POST \
-F chat_id="${{ secrets.TELEGRAM_CHANNEL }}" \
-F document="@$apk" \
--silent --show-error --fail >/dev/null &
done
for job in $(jobs -p); do
wait $job || exit 1
done
}
upload apks/*
play:
name: Publish to Play Store
if: github.event.inputs.play != 'y'
runs-on: ubuntu-latest
needs:
- native
- check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'plugin/wireguard/*' > wireguard_status
- name: WireGuard Cache
uses: actions/cache@v2
with:
path: |
plugin/wireguard/src/main/jniLibs
key: ${{ hashFiles('.github/workflows/*', 'bin/lib/wireguard/*', 'wireguard_status') }}
- name: Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Release Build
env:
SKIP_BUILD: on
BUILD_PLUGIN: wireguard
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
cat > service_account_credentials.json << EOF
${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}"
EOF
./run init action library
./gradlew :plugin:wireguard:publishPlayReleaseBundle

28
.gitmodules vendored
View File

@@ -1,6 +1,3 @@
[submodule "library/shadowsocks/src/main/rust/shadowsocks-rust"]
path = library/shadowsocks/src/main/rust/shadowsocks-rust
url = https://github.com/shadowsocks/shadowsocks-rust.git
[submodule "plugin/trojan-go/src/main/go/trojan-go"]
path = plugin/trojan-go/src/main/go/trojan-go
url = https://github.com/p4gefau1t/trojan-go
@@ -40,28 +37,3 @@
[submodule "external/termux-view"]
path = external/termux-view
url = https://github.com/SagerNet/termux-view
[submodule "library/shadowsocks-libev/src/main/jni/libev"]
path = library/shadowsocks-libev/src/main/jni/libev
url = https://git.lighttpd.net/mirrors/libev.git
[submodule "library/shadowsocks-libev/src/main/jni/libancillary"]
path = library/shadowsocks-libev/src/main/jni/libancillary
url = https://github.com/shadowsocks/libancillary.git
[submodule "library/shadowsocks-libev/src/main/jni/libevent"]
path = library/shadowsocks-libev/src/main/jni/libevent
url = https://github.com/shadowsocks/libevent.git
[submodule "library/shadowsocks-libev/src/main/jni/mbedtls"]
path = library/shadowsocks-libev/src/main/jni/mbedtls
url = https://github.com/SagerNet/mbedtls
[submodule "library/shadowsocks-libev/src/main/jni/pcre"]
path = library/shadowsocks-libev/src/main/jni/pcre
url = https://android.googlesource.com/platform/external/pcre
[submodule "library/shadowsocks-libev/src/main/jni/libsodium"]
path = library/shadowsocks-libev/src/main/jni/libsodium
url = https://github.com/jedisct1/libsodium.git
branch = stable
[submodule "library/shadowsocks-libev/src/main/jni/shadowsocks-libev"]
path = library/shadowsocks-libev/src/main/jni/shadowsocks-libev
url = https://github.com/SagerNet/shadowsocks-libev
[submodule "plugin/wireguard/src/main/go/wgsocks"]
path = plugin/wireguard/src/main/go/wgsocks
url = https://github.com/SagerNet/wgsocks

2
.idea/gradle.xml generated
View File

@@ -76,8 +76,6 @@
<option value="$PROJECT_DIR$/library/include" />
<option value="$PROJECT_DIR$/library/proto" />
<option value="$PROJECT_DIR$/library/proto-stub" />
<option value="$PROJECT_DIR$/library/shadowsocks" />
<option value="$PROJECT_DIR$/library/shadowsocks-libev" />
<option value="$PROJECT_DIR$/library/stub" />
<option value="$PROJECT_DIR$/plugin" />
<option value="$PROJECT_DIR$/plugin/api" />

View File

@@ -26,12 +26,12 @@ The application is designed to be used whenever possible.
* VLESS
* Trojan
* Snell
* WireGuard
* Trojan-Go ( trojan-go-plugin )
* NaïveProxy ( naive-plugin )
* relaybaton ( relaybaton-plugin )
* Brook ( brook-plugin )
* Hysteria ( hysteria-plugin )
* WireGuard ( wireguard-plugin )
##### ROOT required

View File

@@ -23,7 +23,6 @@ package com.github.shadowsocks.plugin
class InternalPlugin(override val id: String, override val label: CharSequence) : Plugin() {
companion object {
val SIMPLE_OBFS = InternalPlugin("obfs-local", "Simple Obfs (Internal)")
val V2RAY_PLUGIN = InternalPlugin("v2ray-plugin", "V2Ray Plugin (Internal)")
}
}

View File

@@ -30,7 +30,6 @@ class PluginList(skipInternal: Boolean) : ArrayList<Plugin>() {
init {
add(NoPlugin)
if (!skipInternal) {
add(InternalPlugin.SIMPLE_OBFS)
add(InternalPlugin.V2RAY_PLUGIN)
}
addAll(SagerNet.application.packageManager.queryIntentContentProviders(

View File

@@ -86,8 +86,6 @@ object Key {
const val ALWAYS_SHOW_ADDRESS = "alwaysShowAddress"
const val PROVIDER_TROJAN = "providerTrojan"
const val PROVIDER_SS_AEAD = "providerShadowsocksAEAD"
const val PROVIDER_SS_STREAM = "providerShadowsocksStream"
const val TUN_IMPLEMENTATION = "tunImplementation"
const val ENABLE_PCAP = "enablePcap"
@@ -205,19 +203,6 @@ object TrojanProvider {
const val TROJAN_GO = 2
}
object ShadowsocksProvider {
const val V2RAY = 0
const val SHADOWSOCKS_RUST = 1
const val CLASH = 2
const val SHADOWSOCKS_LIBEV = 3
}
object ShadowsocksStreamProvider {
const val SHADOWSOCKS_RUST = 0
const val CLASH = 1
const val SHADOWSOCKS_LIBEV = 2
}
object IPv6Mode {
const val DISABLE = 0
const val ENABLE = 1

View File

@@ -30,12 +30,7 @@ import java.io.File
import java.io.IOException
object Executable {
const val SS_LOCAL = "libsslocal.so"
const val SS_LIBEV_LOCAL = "libss-local.so"
private val EXECUTABLES = setOf(
SS_LOCAL,
SS_LIBEV_LOCAL,
"libtrojan.so",
"libtrojan-go.so",
"libnaive.so",

View File

@@ -1,69 +0,0 @@
/******************************************************************************
* *
* Copyright (C) 2021 by nekohasekai <contact-sagernet@sekai.icu> *
* *
* 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.proto
import cn.hutool.json.JSONObject
import com.github.shadowsocks.plugin.PluginConfiguration
import io.nekohasekai.sagernet.bg.ClashBasedInstance
import io.nekohasekai.sagernet.fmt.shadowsocks.ShadowsocksBean
import libcore.Libcore
class ShadowsocksInstance(val server: ShadowsocksBean, val port: Int) : ClashBasedInstance() {
override fun createInstance() {
var pluginName = ""
val pluginOpts = JSONObject()
if (server.plugin.isNotBlank()) {
val plugin = PluginConfiguration(server.plugin)
pluginName = plugin.selected
val options = plugin.getOptions()
when (pluginName) {
"obfs-local" -> {
pluginOpts["mode"] = options["obfs"]
pluginOpts["host"] = options["obfs-host"]
}
"v2ray-plugin" -> {
pluginOpts["mode"] = options["mode"]
pluginOpts["host"] = options["host"]
pluginOpts["path"] = options["path"]
if (options.containsKey("tls")) {
pluginOpts["tls"] = true
}
if (options.containsKey("mux")) {
pluginOpts["mux"] = true
}
}
}
}
instance = Libcore.newShadowsocksInstance(
port,
server.finalAddress,
server.finalPort,
server.password,
server.method,
pluginName,
pluginOpts.toStringPretty()
)
}
}

View File

@@ -27,10 +27,8 @@ import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import io.nekohasekai.sagernet.SagerNet
import io.nekohasekai.sagernet.ShadowsocksProvider
import io.nekohasekai.sagernet.TrojanProvider
import io.nekohasekai.sagernet.bg.AbstractInstance
import io.nekohasekai.sagernet.bg.Executable
import io.nekohasekai.sagernet.bg.ExternalInstance
import io.nekohasekai.sagernet.bg.GuardedProcessPool
import io.nekohasekai.sagernet.database.DataStore
@@ -48,8 +46,6 @@ import io.nekohasekai.sagernet.fmt.naive.buildNaiveConfig
import io.nekohasekai.sagernet.fmt.pingtunnel.PingTunnelBean
import io.nekohasekai.sagernet.fmt.relaybaton.RelayBatonBean
import io.nekohasekai.sagernet.fmt.relaybaton.buildRelayBatonConfig
import io.nekohasekai.sagernet.fmt.shadowsocks.ShadowsocksBean
import io.nekohasekai.sagernet.fmt.shadowsocks.buildShadowsocksConfig
import io.nekohasekai.sagernet.fmt.shadowsocksr.ShadowsocksRBean
import io.nekohasekai.sagernet.fmt.snell.SnellBean
import io.nekohasekai.sagernet.fmt.ssh.SSHBean
@@ -108,16 +104,6 @@ abstract class V2RayInstance(
val mux = DataStore.enableMux && (isBalancer || chain.size == 0)
when (val bean = profile.requireBean()) {
is ShadowsocksBean -> when (val provider = profile.pickShadowsocksProvider()) {
ShadowsocksProvider.CLASH -> {
externalInstances[port] = ShadowsocksInstance(bean, port)
}
else -> {
pluginConfigs[port] = provider to bean.buildShadowsocksConfig(
port
)
}
}
is ShadowsocksRBean -> {
externalInstances[port] = ShadowsocksRInstance(bean, port)
}
@@ -170,10 +156,6 @@ abstract class V2RayInstance(
}
}
}
is WireGuardBean -> {
initPlugin("wireguard-plugin")
pluginConfigs[port] = profile.type to bean.buildWireGuardUapiConf()
}
is ConfigBean -> {
when (bean.type) {
"trojan-go" -> {
@@ -217,35 +199,6 @@ abstract class V2RayInstance(
externalInstances.containsKey(port) -> {
externalInstances[port]!!.launch()
}
bean is ShadowsocksBean -> {
val configFile = File(
context.noBackupFilesDir,
"shadowsocks_" + SystemClock.elapsedRealtime() + ".json"
)
configFile.parentFile?.mkdirs()
configFile.writeText(config)
cacheFiles.add(configFile)
val commands = mutableListOf(
File(
SagerNet.application.applicationInfo.nativeLibraryDir,
when (profileType) {
ShadowsocksProvider.SHADOWSOCKS_RUST -> Executable.SS_LOCAL
else -> Executable.SS_LIBEV_LOCAL
}
).absolutePath, "-c", configFile.absolutePath
)
if (profileType == ShadowsocksProvider.SHADOWSOCKS_RUST) {
commands.add("--log-without-time")
} else {
commands.addAll(arrayOf("-u", "-t", "600"))
}
if (DataStore.enableLog) commands.add("-v")
processes.start(commands)
}
bean is TrojanBean -> {
val configFile = File(
context.noBackupFilesDir,
@@ -389,30 +342,6 @@ abstract class V2RayInstance(
"client"
)
processes.start(commands)
}
bean is WireGuardBean -> {
val configFile = File(
context.noBackupFilesDir,
"wg_" + SystemClock.elapsedRealtime() + ".conf"
)
configFile.parentFile?.mkdirs()
configFile.writeText(config)
cacheFiles.add(configFile)
val commands = mutableListOf(
initPlugin("wireguard-plugin").path,
"-a",
bean.localAddress.split("\n").joinToString(","),
"-b",
"127.0.0.1:$port",
"-c",
configFile.absolutePath,
"-d",
"127.0.0.1:${DataStore.localDNSPort}"
)
processes.start(commands)
}
}

View File

@@ -20,7 +20,6 @@
package io.nekohasekai.sagernet.bg.test
import io.nekohasekai.sagernet.bg.proto.SSHInstance
import io.nekohasekai.sagernet.bg.proto.ShadowsocksInstance
import io.nekohasekai.sagernet.bg.proto.ShadowsocksRInstance
import io.nekohasekai.sagernet.bg.proto.SnellInstance
import io.nekohasekai.sagernet.database.DataStore
@@ -35,7 +34,6 @@ class UrlTest {
suspend fun doTest(profile: ProxyEntity): Int {
if (profile.useClashBased()) {
val instance = when (profile.type) {
ProxyEntity.TYPE_SS -> ShadowsocksInstance(profile.ssBean!!, 0)
ProxyEntity.TYPE_SSR -> ShadowsocksRInstance(profile.ssrBean!!, 0)
ProxyEntity.TYPE_SNELL -> SnellInstance(profile.snellBean!!, 0)
ProxyEntity.TYPE_SSH -> SSHInstance(profile.sshBean!!, 0)

View File

@@ -197,8 +197,6 @@ object DataStore : OnPreferenceDataStoreChangeListener {
// protocol
var providerTrojan by configurationStore.stringToInt(Key.PROVIDER_TROJAN)
var providerShadowsocksAEAD by configurationStore.stringToInt(Key.PROVIDER_SS_AEAD)
var providerShadowsocksStream by configurationStore.stringToInt(Key.PROVIDER_SS_STREAM)
// cache

View File

@@ -28,8 +28,6 @@ import androidx.room.*
import com.github.shadowsocks.plugin.PluginConfiguration
import com.github.shadowsocks.plugin.PluginManager
import io.nekohasekai.sagernet.R
import io.nekohasekai.sagernet.ShadowsocksProvider
import io.nekohasekai.sagernet.ShadowsocksStreamProvider
import io.nekohasekai.sagernet.TrojanProvider
import io.nekohasekai.sagernet.aidl.TrafficStats
import io.nekohasekai.sagernet.fmt.AbstractBean
@@ -359,10 +357,11 @@ data class ProxyEntity(
return when (type) {
TYPE_SOCKS -> false
TYPE_HTTP -> false
TYPE_SS -> pickShadowsocksProvider() != ShadowsocksProvider.V2RAY
TYPE_SS -> false
TYPE_VMESS -> false
TYPE_VLESS -> false
TYPE_TROJAN -> DataStore.providerTrojan != TrojanProvider.V2RAY
TYPE_WG -> false
TYPE_CHAIN -> false
TYPE_BALANCER -> false
else -> true
@@ -372,7 +371,6 @@ data class ProxyEntity(
fun useClashBased(): Boolean {
if (!needExternal()) return false
return when (type) {
TYPE_SS -> pickShadowsocksProvider() == ShadowsocksProvider.CLASH
TYPE_SSR -> true
TYPE_SNELL -> true
TYPE_SSH -> true
@@ -397,92 +395,6 @@ data class ProxyEntity(
}
}
fun pickShadowsocksProvider(): Int {
val bean = ssBean ?: return -1
if (bean.method.contains(ssSecureList)) {
val prefer = DataStore.providerShadowsocksAEAD
when {
prefer == ShadowsocksProvider.V2RAY && bean.method in methodsV2fly && bean.plugin.isBlank() -> {
return ShadowsocksProvider.V2RAY
}
prefer == ShadowsocksProvider.CLASH && bean.method in methodsClash && ssPluginSupportedByClash(
true
) -> {
return ShadowsocksProvider.CLASH
}
prefer == ShadowsocksProvider.SHADOWSOCKS_RUST && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && bean.method in methodsSsRust && !ssPluginSupportedByClash(
false
) -> {
return ShadowsocksProvider.SHADOWSOCKS_RUST
}
prefer == ShadowsocksProvider.SHADOWSOCKS_LIBEV && bean.method in methodsSsLibev && !ssPluginSupportedByClash(
false
) -> {
return ShadowsocksProvider.SHADOWSOCKS_LIBEV
}
}
return if (ssPreferClash()) {
ShadowsocksProvider.CLASH
} else if (bean.method in methodsV2fly && bean.plugin.isBlank()) {
ShadowsocksProvider.V2RAY
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ShadowsocksProvider.SHADOWSOCKS_RUST
} else {
ShadowsocksProvider.SHADOWSOCKS_LIBEV
}
} else {
val prefer = DataStore.providerShadowsocksStream
when {
prefer == ShadowsocksStreamProvider.CLASH && bean.method in methodsClash && ssPluginSupportedByClash(
true
) -> {
return ShadowsocksProvider.CLASH
}
prefer == ShadowsocksStreamProvider.SHADOWSOCKS_RUST && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && bean.method in methodsSsRust && !ssPluginSupportedByClash(
false
) -> {
return ShadowsocksProvider.SHADOWSOCKS_RUST
}
prefer == ShadowsocksStreamProvider.SHADOWSOCKS_LIBEV && bean.method in methodsSsLibev && !ssPluginSupportedByClash(
false
) -> {
return ShadowsocksProvider.SHADOWSOCKS_LIBEV
}
}
return if (ssPreferClash()) {
ShadowsocksProvider.CLASH
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ShadowsocksProvider.SHADOWSOCKS_RUST
} else {
ShadowsocksProvider.SHADOWSOCKS_LIBEV
}
}
}
fun ssPluginSupportedByClash(prefer: Boolean): Boolean {
val bean = ssBean ?: return false
if (bean.plugin.isNotBlank()) {
val plugin = PluginConfiguration(bean.plugin)
if (plugin.selected !in arrayOf("obfs-local", "v2ray-plugin")) return false
if (plugin.selected == "v2ray-plugin") {
if (plugin.getOptions()["mode"] != "websocket") return false
}
try {
PluginManager.init(plugin)
return prefer
} catch (e: Exception) {
}
return true
}
return prefer
}
fun ssPreferClash(): Boolean {
val bean = ssBean ?: return false
val onlyClash = bean.method !in methodsV2fly && bean.method !in methodsSsRust && bean.method !in methodsSsLibev
return onlyClash || ssPluginSupportedByClash(false)
}
fun putBean(bean: AbstractBean): ProxyEntity {
socksBean = null
httpBean = null

View File

@@ -23,6 +23,8 @@ import android.os.Build
import cn.hutool.core.util.NumberUtil
import cn.hutool.json.JSONArray
import cn.hutool.json.JSONObject
import com.github.shadowsocks.plugin.PluginConfiguration
import com.github.shadowsocks.plugin.PluginManager
import com.google.gson.JsonSyntaxException
import io.nekohasekai.sagernet.IPv6Mode
import io.nekohasekai.sagernet.Key
@@ -38,6 +40,7 @@ import io.nekohasekai.sagernet.fmt.http.HttpBean
import io.nekohasekai.sagernet.fmt.internal.BalancerBean
import io.nekohasekai.sagernet.fmt.internal.ChainBean
import io.nekohasekai.sagernet.fmt.shadowsocks.ShadowsocksBean
import io.nekohasekai.sagernet.fmt.shadowsocks.fixInvalidParams
import io.nekohasekai.sagernet.fmt.socks.SOCKSBean
import io.nekohasekai.sagernet.fmt.trojan.TrojanBean
import io.nekohasekai.sagernet.fmt.v2ray.StandardV2RayBean
@@ -45,6 +48,7 @@ import io.nekohasekai.sagernet.fmt.v2ray.V2RayConfig
import io.nekohasekai.sagernet.fmt.v2ray.V2RayConfig.*
import io.nekohasekai.sagernet.fmt.v2ray.VLESSBean
import io.nekohasekai.sagernet.fmt.v2ray.VMessBean
import io.nekohasekai.sagernet.fmt.wireguard.WireGuardBean
import io.nekohasekai.sagernet.ktx.isIpAddress
import io.nekohasekai.sagernet.ktx.isRunning
import io.nekohasekai.sagernet.ktx.mkPort
@@ -714,6 +718,13 @@ fun buildV2RayConfig(
}
}
}
if (bean.plugin.isNotBlank()) {
val pluginConfiguration = PluginConfiguration(plugin)
PluginManager.init(pluginConfiguration)?.let { (path, opts, _) ->
plugin = path
pluginOpts = opts.toString()
}
}
})
} else if (bean is TrojanBean) {
protocol = "trojan"
@@ -747,6 +758,25 @@ fun buildV2RayConfig(
tlsSettings.allowInsecure = true
}
}
} else if (bean is WireGuardBean) {
protocol = "wireguard"
settings = LazyOutboundConfigurationObject(this,
WireGuardOutbounzConfigurationObject().apply {
address = bean.finalAddress
port = bean.finalPort
network = "udp"
localAddresses = bean.localAddress.split("\n")
privateKey = bean.privateKey
peerPublicKey = bean.peerPublicKey
preSharedKey = bean.peerPreSharedKey
})
streamSettings = StreamSettingsObject().apply {
if (needKeepAliveInterval) {
sockopt = StreamSettingsObject.SockoptObject().apply {
tcpKeepAliveInterval = keepAliveInterval
}
}
}
}
if ((isBalancer || index == 0) && proxyEntity.needCoreMux() && DataStore.enableMux) {
mux = OutboundObject.MuxObject().apply {

View File

@@ -35,7 +35,6 @@ enum class PluginEntry(
RelayBaton("relaybaton-plugin", R.string.action_relay_baton, "io.nekohasekai.sagernet.plugin.relaybaton"),
Brook("brook-plugin", R.string.action_brook, "io.nekohasekai.sagernet.plugin.brook"),
Hysteria("hysteria-plugin", R.string.action_hysteria, "io.nekohasekai.sagernet.plugin.hysteria", DownloadSource(fdroid = false)),
WireGuard("wireguard-plugin", R.string.action_wireguard, "io.nekohasekai.sagernet.plugin.wireguard", DownloadSource(fdroid = false)),
// shadowsocks plugins

View File

@@ -364,6 +364,9 @@ public class V2RayConfig {
public String password;
public Integer level;
public String network;
public String plugin;
public String pluginOpts;
public String pluginArgs;
}
@@ -467,6 +470,8 @@ public class V2RayConfig {
return TrojanOutboundConfigurationObject.class;
case "loopback":
return LoopbackOutboundConfigurationObject.class;
case "wireguard":
return WireGuardOutbounzConfigurationObject.class;
}
return null;
}
@@ -583,6 +588,10 @@ public class V2RayConfig {
}
public String plugin;
public String pluginOpts;
public String pluginArgs;
}
public static class VLESSOutboundConfigurationObject implements OutboundConfigurationObject {
@@ -629,6 +638,20 @@ public class V2RayConfig {
}
public static class WireGuardOutbounzConfigurationObject implements OutboundConfigurationObject {
public String address;
public Integer port;
public String network;
public List<String> localAddresses;
public String privateKey;
public String peerPublicKey;
public String preSharedKey;
public Integer mtu;
public Integer userLevel;
}
public TransportObject transport;
public static class TransportObject {

View File

@@ -165,14 +165,6 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
}
val providerTrojan = findPreference<SimpleMenuPreference>(Key.PROVIDER_TROJAN)!!
val providerShadowsocksAEAD = findPreference<SimpleMenuPreference>(Key.PROVIDER_SS_AEAD)!!
val providerShadowsocksStream = findPreference<SimpleMenuPreference>(Key.PROVIDER_SS_STREAM)!!
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
providerShadowsocksAEAD.setEntries(R.array.ss_aead_provider_api21)
providerShadowsocksAEAD.setEntryValues(R.array.ss_aead_provider_api21_values)
providerShadowsocksStream.setEntries(R.array.ss_stream_provider_api21)
providerShadowsocksStream.setEntryValues(R.array.ss_stream_provider_api21_values)
}
if (!isExpert) {
providerTrojan.setEntries(R.array.trojan_provider)
@@ -249,8 +241,6 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
probeInterval.onPreferenceChangeListener = reloadListener
providerTrojan.onPreferenceChangeListener = reloadListener
providerShadowsocksAEAD.onPreferenceChangeListener = reloadListener
providerShadowsocksStream.onPreferenceChangeListener = reloadListener
appTrafficStatistics.onPreferenceChangeListener = reloadListener
tunImplementation.onPreferenceChangeListener = reloadListener
destinationOverride.onPreferenceChangeListener = reloadListener

View File

@@ -628,52 +628,6 @@
<item>Trojan-Go</item>
</string-array>
<string-array name="ss_aead_provider">
<item>V2Ray</item>
<item>shadowsocks-rust</item>
<item>shadowsocks-libev</item>
<item>Clash</item>
</string-array>
<string-array name="ss_aead_provider_values">
<item>0</item>
<item>1</item>
<item>3</item>
<item>2</item>
</string-array>
<string-array name="ss_aead_provider_api21">
<item>V2Ray</item>
<item>shadowsocks-libev</item>
<item>Clash</item>
</string-array>
<string-array name="ss_aead_provider_api21_values">
<item>0</item>
<item>3</item>
<item>2</item>
</string-array>
<string-array name="ss_stream_provider">
<item>shadowsocks-rust</item>
<item>shadowsocks-libev</item>
<item>Clash</item>
</string-array>
<string-array name="ss_stream_provider_values">
<item>0</item>
<item>2</item>
<item>1</item>
</string-array>
<string-array name="ss_stream_provider_api21">
<item>shadowsocks-libev</item>
<item>Clash</item>
</string-array>
<string-array name="ss_stream_provider_api21_values">
<item>2</item>
<item>1</item>
</string-array>
<string-array name="group_types">
<item>@string/group_basic</item>
<item>@string/subscription</item>

View File

@@ -331,8 +331,6 @@
<string name="bypass_lan_in_core_only_sum">If Lineage\'s "Allow hotspot clients to use VPNs" does not work, try this.</string>
<string name="protocol_settings">Protocol Settings</string>
<string name="trojan_provider">Trojan Provider</string>
<string name="ss_aead_provider">Shadowsocks AEAD Provider</string>
<string name="ss_stream_provider">Shadowsocks Stream Provider</string>
<string name="group_basic">Basic</string>
<string name="group_settings">Group Settings</string>
<string name="subscription">Subscription</string>

View File

@@ -154,21 +154,6 @@
</PreferenceCategory>
<PreferenceCategory app:title="@string/protocol_settings">
<com.takisoft.preferencex.SimpleMenuPreference
app:defaultValue="0"
app:entries="@array/ss_aead_provider"
app:entryValues="@array/ss_aead_provider_values"
app:icon="@drawable/ic_baseline_nfc_24"
app:key="providerShadowsocksAEAD"
app:title="@string/ss_aead_provider"
app:useSimpleSummaryProvider="true" />
<com.takisoft.preferencex.SimpleMenuPreference
app:defaultValue="0"
app:entries="@array/ss_stream_provider"
app:entryValues="@array/ss_stream_provider_values"
app:key="providerShadowsocksStream"
app:title="@string/ss_stream_provider"
app:useSimpleSummaryProvider="true" />
<com.takisoft.preferencex.SimpleMenuPreference
app:defaultValue="0"
app:entries="@array/trojan_provider_experimental"

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.#rustup.rs | sh -s -- --default-toolchain none -y
echo "source \$HOME/.cargo/env" >>$HOME/.bashrc
git submodule update --init library/shadowsocks/src/main/rust/shadowsocks-rust
cd library/shadowsocks/src/main/rust/shadowsocks-rust
rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
# rustup default $(cat rust-toolchain)

View File

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

View File

@@ -1,9 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
git submodule update --init --recursive library/shadowsocks-libev
rm -rf library/shadowsocks-libev/build/outputs/aar
./gradlew :library:shadowsocks-libev:assembleRelease || exit 1
mkdir -p app/libs
cp library/shadowsocks-libev/build/outputs/aar/shadowsocks-libev-release.aar app/libs/shadowsocks-libev.aar

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
bin/plugin/wireguard/init.sh &&
bin/plugin/wireguard/armeabi-v7a.sh &&
bin/plugin/wireguard/arm64-v8a.sh &&
bin/plugin/wireguard/x86.sh &&
bin/plugin/wireguard/x86_64.sh &&
bin/plugin/wireguard/end.sh

View File

@@ -1,9 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
source "bin/plugin/wireguard/build.sh"
DIR="$ROOT/arm64-v8a"
mkdir -p $DIR
env CC=$ANDROID_ARM64_CC GOARCH=arm64 go build -x -o $DIR/$LIB_OUTPUT -trimpath -ldflags="-s -w -buildid="
$ANDROID_ARM64_STRIP $DIR/$LIB_OUTPUT

View File

@@ -1,9 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
source "bin/plugin/wireguard/build.sh"
DIR="$ROOT/armeabi-v7a"
mkdir -p $DIR
env CC=$ANDROID_ARM_CC GOARCH=arm GOARM=7 go build -x -o $DIR/$LIB_OUTPUT -trimpath -ldflags="-s -w -buildid="
$ANDROID_ARM_STRIP $DIR/$LIB_OUTPUT

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
source "bin/init/env.sh"
export CGO_ENABLED=1
export GOOS=android
CURR="plugin/wireguard"
CURR_PATH="$PROJECT/$CURR"
ROOT="$CURR_PATH/src/main/jniLibs"
OUTPUT="wg"
LIB_OUTPUT="lib$OUTPUT.so"
cd $CURR_PATH/src/main/go/wgsocks

View File

@@ -1,5 +0,0 @@
source "bin/init/env.sh"
source "bin/plugin/wireguard/build.sh"
git reset HEAD --hard
git clean -fdx

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
source "bin/init/env.sh"
export CGO_ENABLED=1
export GOOS=android
CURR="plugin/wireguard"
CURR_PATH="$PROJECT/$CURR"
git submodule update --init "$CURR/*"
cd $CURR_PATH/src/main/go/wgsocks
go mod download -x

View File

@@ -1,9 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
source "bin/plugin/wireguard/build.sh"
DIR="$ROOT/x86"
mkdir -p $DIR
env CC=$ANDROID_X86_CC GOARCH=386 go build -x -o $DIR/$LIB_OUTPUT -trimpath -ldflags="-s -w -buildid="
$ANDROID_X86_STRIP $DIR/$LIB_OUTPUT

View File

@@ -1,9 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
source "bin/plugin/wireguard/build.sh"
DIR="$ROOT/x86_64"
mkdir -p $DIR
env CC=$ANDROID_X86_64_CC GOARCH=amd64 go build -x -o $DIR/$LIB_OUTPUT -trimpath -ldflags="-s -w -buildid="
$ANDROID_X86_64_STRIP $DIR/$LIB_OUTPUT

View File

@@ -6,8 +6,8 @@ git reset origin/main --hard
popd
pushd external/v2ray-core
git fetch origin main || exit 1
git reset origin/main --hard
git fetch origin dev-v5main || exit 1
git reset origin/dev-v5main --hard
popd
git add .

View File

@@ -18,7 +18,6 @@ dependencies {
implementation("com.github.triplet.gradle:play-publisher:3.6.0")
implementation("org.kohsuke:github-api:1.131")
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.2")
implementation("org.mozilla.rust-android-gradle:plugin:0.9.0")
implementation("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.9.1")
implementation("com.google.protobuf:protobuf-gradle-plugin:0.8.17")
implementation("com.github.ben-manes:gradle-versions-plugin:0.39.0")

View File

@@ -517,12 +517,6 @@ fun Project.setupApp() {
add("androidTestImplementation", "androidx.test.ext:junit:1.1.3")
add("androidTestImplementation", "androidx.test:runner:1.4.0")
add("androidTestImplementation", "androidx.test.espresso:espresso-core:3.4.0")
// workaround for f-droid builds
if (requireFlavor().contains("fdroid",true)) {
add("implementation", project(":library:shadowsocks"))
add("implementation", project(":library:shadowsocks-libev"))
}
}
setupPlay()

View File

@@ -1,5 +0,0 @@
plugins {
id("com.android.library")
}
setupNdkLibrary()

View File

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

View File

@@ -1,311 +0,0 @@
# 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)
########################################################
## libevent
########################################################
include $(CLEAR_VARS)
LIBEVENT_SOURCES := \
buffer.c bufferevent.c event.c \
bufferevent_sock.c bufferevent_ratelim.c \
evthread.c log.c evutil.c evutil_rand.c evutil_time.c evmap.c epoll.c poll.c signal.c select.c
LOCAL_MODULE := event
LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES))
LOCAL_CFLAGS := -I$(LOCAL_PATH)/libevent \
-I$(LOCAL_PATH)/libevent/include \
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)
########################################################
## libbloom
########################################################
include $(CLEAR_VARS)
BLOOM_SOURCE := bloom.c murmur2/MurmurHash2.c
LOCAL_MODULE := libbloom
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
-I$(LOCAL_PATH)/shadowsocks-libev/libbloom/murmur2
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libbloom/, $(BLOOM_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/src/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/src/libcork/,$(CORK_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## libev
########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := libev
LOCAL_CFLAGS += -DNDEBUG -DHAVE_CONFIG_H \
-I$(LOCAL_PATH)/include/libev
LOCAL_SRC_FILES := \
libev/ev.c \
libev/event.c
include $(BUILD_STATIC_LIBRARY)
########################################################
## shadowsocks-libev local
########################################################
include $(CLEAR_VARS)
SHADOWSOCKS_SOURCES := local.c \
cache.c udprelay.c utils.c netutils.c json.c jconf.c \
acl.c rule.c \
crypto.c aead.c stream.c base64.c \
plugin.c ppbloom.c \
android.c
LOCAL_MODULE := ss-local
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS := -Wall -fno-strict-aliasing -DMODULE_LOCAL \
-DUSE_CRYPTO_MBEDTLS -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)/libsodium/src/libsodium/include \
-I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
-I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
-I$(LOCAL_PATH)/libev
LOCAL_STATIC_LIBRARIES := libev libmbedtls libipset libcork libbloom \
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)

View File

@@ -1,31 +0,0 @@
# 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

View File

@@ -1,126 +0,0 @@
/* 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"

View File

@@ -1,428 +0,0 @@
/* 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 <linux/tcp.h> header file. */
#define HAVE_LINUX_TCP_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 "max.c.lv@gmail.com"
/* 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 */

View File

@@ -1,29 +0,0 @@
#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

View File

@@ -1,198 +0,0 @@
/*************************************************
* 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 */

View File

@@ -1,54 +0,0 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android")
}
setupCommon()
setupNdk()
dependencies {
implementation(project(":library:shadowsocks-libev"))
}
cargo {
module = "src/main/rust/shadowsocks-rust"
libname = "sslocal"
val nativeTarget = requireTargetAbi()
targets = when (nativeTarget) {
"armeabi-v7a" -> listOf("arm")
"arm64-v8a" -> listOf("arm64")
"x86" -> listOf("x86")
"x86_64" -> listOf("x86_64")
else -> listOf("arm", "arm64", "x86", "x86_64")
}
profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
extraCargoBuildArguments = listOf("--bin", "sslocal")
featureSpec.noDefaultBut(arrayOf(
"local",
"stream-cipher",
"aead-cipher-extra",
"logging"))
exec = { spec, toolchain ->
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY",
"$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET",
"target/${toolchain.target}/$profile/lib$libname.so")
}
}
tasks.whenTaskAdded {
if (name.startsWith("merge") && name.endsWith("JniLibFolders")) {
dependsOn("cargoBuild")
}
}
tasks.register<Exec>("cargoClean") {
executable("cargo") // cargo.cargoCommand
args("clean")
workingDir("$projectDir/${cargo.module}")
}
tasks.clean.dependsOn("cargoClean")

View File

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

View File

@@ -1,18 +0,0 @@
from __future__ import absolute_import, print_function, unicode_literals
import os
import pipes
import shutil
import subprocess
import sys
args = [os.environ['RUST_ANDROID_GRADLE_CC'], os.environ['RUST_ANDROID_GRADLE_CC_LINK_ARG']] + sys.argv[1:]
# This only appears when the subprocess call fails, but it's helpful then.
printable_cmd = ' '.join(pipes.quote(arg) for arg in args)
print(printable_cmd)
code = subprocess.call(args)
if code == 0:
shutil.copyfile(sys.argv[sys.argv.index('-o') + 1], os.environ['RUST_ANDROID_GRADLE_TARGET'])
sys.exit(code)

View File

@@ -1,5 +0,0 @@
plugins {
id("com.android.application")
}
setupPlugin("wireguard")

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.nekohasekai.sagernet.plugin.wireguard"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<application
android:allowBackup="false"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher"
android:label="WireGuard Plugin"
android:roundIcon="@mipmap/ic_launcher_round">
<provider
android:name=".BinaryProvider"
android:authorities="io.nekohasekai.sagernet.plugin.wireguard.BinaryProvider"
android:directBootAware="true"
android:exported="true"
tools:ignore="ExportedContentProvider">
<intent-filter>
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
</intent-filter>
<intent-filter>
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
<data
android:host="io.nekohasekai.sagernet"
android:path="/wireguard-plugin"
android:scheme="plugin" />
</intent-filter>
<meta-data
android:name="io.nekohasekai.sagernet.plugin.id"
android:value="wireguard-plugin" />
<meta-data
android:name="io.nekohasekai.sagernet.plugin.executable_path"
android:value="libwg.so" />
</provider>
</application>
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1,40 +0,0 @@
/******************************************************************************
* *
* Copyright (C) 2021 by nekohasekai <contact-sagernet@sekai.icu> *
* *
* 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.plugin.wireguard
import android.net.Uri
import android.os.ParcelFileDescriptor
import io.nekohasekai.sagernet.plugin.NativePluginProvider
import io.nekohasekai.sagernet.plugin.PathProvider
import java.io.File
import java.io.FileNotFoundException
class BinaryProvider : NativePluginProvider() {
override fun populateFiles(provider: PathProvider) {
provider.addPath("wireguard-plugin", 0b111101101)
}
override fun getExecutable() = context!!.applicationInfo.nativeLibraryDir + "/libwg.so"
override fun openFile(uri: Uri): ParcelFileDescriptor = when (uri.path) {
"/wireguard-plugin" -> ParcelFileDescriptor.open(File(getExecutable()),
ParcelFileDescriptor.MODE_READ_ONLY)
else -> throw FileNotFoundException()
}
}

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.11997853"
android:scaleY="0.11997853"
android:translateX="28.682308"
android:translateY="31.433317">
<group android:translateY="146.88005">
<path android:pathData="M15.703125,-0L3.59375,-105.5L15.984375,-105.5L23.90625,-27.453125Q24.34375,-22.671875,24.703125,-17.546875Q25.0625,-12.421875,25.203125,-9.390625Q25.484375,-12.421875,25.984375,-17.546875Q26.5,-22.671875,27.078125,-27.453125L36.859375,-105.5L50.25,-105.5L59.1875,-27.390625Q59.765625,-22.609375,60.328125,-17.46875Q60.90625,-12.34375,61.203125,-9.3125Q61.484375,-12.34375,61.84375,-17.46875Q62.203125,-22.609375,62.78125,-27.390625L70.984375,-105.5L82.796875,-105.5L70.421875,-0L54.140625,-0L45.21875,-79.484375Q44.640625,-84.40625,44.203125,-89.09375Q43.78125,-93.796875,43.484375,-96.390625Q43.203125,-93.796875,42.6875,-89.09375Q42.1875,-84.40625,41.609375,-79.484375L31.96875,-0L15.703125,-0Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M98.234375,0L98.234375,-11.859375L126.3125,-11.859375L126.3125,-68L101.84375,-68L101.84375,-79.859375L139.28125,-79.859375L139.28125,-11.859375L165.92188,-11.859375L165.92188,0L98.234375,0ZM131.35938,-94Q126.609375,-94,123.875,-96.453125Q121.140625,-98.921875,121.140625,-103.109375Q121.140625,-107.453125,123.875,-109.984375Q126.609375,-112.515625,131.35938,-112.515625Q136.10938,-112.515625,138.84375,-109.984375Q141.57812,-107.453125,141.57812,-103.109375Q141.57812,-98.921875,138.84375,-96.453125Q136.10938,-94,131.35938,-94Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M187.98438,0L187.98438,-79.546875L200.65625,-79.546875L200.65625,-65.375Q204.54688,-81,221.53125,-81Q234.0625,-81,241.46875,-73.109375Q248.89062,-65.234375,248.89062,-51.78125L248.89062,-47.015625L235.9375,-47.015625L235.9375,-50.625Q235.9375,-60.03125,231.39062,-65.015625Q226.85938,-70,218.51562,-70Q210.29688,-70,205.60938,-64.9375Q200.9375,-59.875,200.9375,-50.625L200.9375,0L187.98438,0Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M301.20312,1Q291.84375,1,284.85938,-2.78125Q277.875,-6.5625,274.04688,-13.453125Q270.23438,-20.359375,270.23438,-29.515625L270.23438,-51.328125Q270.23438,-60.625,274.04688,-67.453125Q277.875,-74.296875,284.85938,-78.0625Q291.84375,-81.84375,301.20312,-81.84375Q310.5625,-81.84375,317.54688,-78.046875Q324.53125,-74.25,328.34375,-67.375Q332.15625,-60.515625,332.15625,-51.171875L332.15625,-37L282.90625,-37L282.90625,-29.34375Q282.90625,-19.96875,287.65625,-14.984375Q292.42188,-10,301.20312,-10Q308.6875,-10,313.29688,-12.65625Q317.90625,-15.328125,318.90625,-20.6875L331.875,-20.6875Q330.57812,-10.703125,322.15625,-4.84375Q313.73438,1,301.20312,1ZM282.90625,-46.84375L319.48438,-46.84375L319.48438,-51.109375Q319.48438,-60.6875,314.79688,-65.84375Q310.125,-71,301.20312,-71Q292.42188,-71,287.65625,-65.84375Q282.90625,-60.6875,282.90625,-51.109375L282.90625,-46.84375Z"
android:fillColor="#FFFFFF"/>
</group>
<group android:translateY="336.96014">
<path android:pathData="M43.78125,1Q29.375,1,21.015625,-7.109375Q12.671875,-15.234375,12.671875,-29.4375L12.671875,-77.28125Q12.671875,-91.484375,21.015625,-99.59375Q29.375,-107.71875,43.78125,-107.71875Q57.890625,-107.71875,66.234375,-99.484375Q74.59375,-91.25,74.59375,-77.125L61.625,-77.125Q61.625,-86.203125,56.9375,-91.09375Q52.265625,-96,43.78125,-96Q35.28125,-96,30.453125,-91.203125Q25.625,-86.421875,25.625,-77.453125L25.625,-29.421875Q25.625,-20.4375,30.453125,-15.5Q35.28125,-10.578125,43.78125,-10.578125Q52.265625,-10.578125,56.9375,-15.453125Q61.625,-20.328125,61.625,-29.21875L61.625,-42.140625L40.3125,-42.140625L40.3125,-54L74.59375,-54L74.59375,-29.234375Q74.59375,-15.265625,66.234375,-7.125Q57.890625,1,43.78125,1Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M129.0625,1Q115.375,1,107.15625,-7.171875Q98.953125,-15.34375,98.953125,-29.375L98.953125,-80L111.921875,-80L111.921875,-29.375Q111.921875,-20.40625,116.53125,-15.421875Q121.140625,-10.4375,129.0625,-10.4375Q137.125,-10.4375,141.79688,-15.421875Q146.48438,-20.40625,146.48438,-29.375L146.48438,-80L159.4375,-80L159.4375,-29.375Q159.4375,-15.34375,151.07812,-7.171875Q142.73438,1,129.0625,1Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M208.28125,1Q195.76562,1,188.5625,-5.421875Q181.35938,-11.859375,181.35938,-22.859375Q181.35938,-33.984375,188.5625,-40.328125Q195.76562,-46.6875,208,-46.6875L232.48438,-46.6875L232.48438,-54.640625Q232.48438,-61.890625,228.09375,-65.9375Q223.70312,-70,215.625,-70Q208.57812,-70,203.96875,-67.03125Q199.35938,-64.0625,198.35938,-59L185.39062,-59Q186.6875,-69.265625,195.03125,-75.34375Q203.39062,-81.421875,215.92188,-81.421875Q229.59375,-81.421875,237.51562,-74.328125Q245.4375,-67.25,245.4375,-55.109375L245.4375,-0.453125L232.76562,-0.453125L232.76562,-15.640625L232.625,-15.640625Q231.76562,-7.96875,225.20312,-3.484375Q218.65625,1,208.28125,1ZM211.45312,-9.28125Q220.67188,-9.28125,226.57812,-13.890625Q232.48438,-18.515625,232.48438,-25.734375L232.48438,-37L208.28125,-37Q201.8125,-37,198.0625,-33.390625Q194.3125,-29.78125,194.3125,-23.5625Q194.3125,-16.921875,198.84375,-13.09375Q203.39062,-9.28125,211.45312,-9.28125Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M273.98438,0L273.98438,-79.546875L286.65625,-79.546875L286.65625,-65.375Q290.54688,-81,307.53125,-81Q320.0625,-81,327.46875,-73.109375Q334.89062,-65.234375,334.89062,-51.78125L334.89062,-47.015625L321.9375,-47.015625L321.9375,-50.625Q321.9375,-60.03125,317.39062,-65.015625Q312.85938,-70,304.51562,-70Q296.29688,-70,291.60938,-64.9375Q286.9375,-59.875,286.9375,-50.625L286.9375,0L273.98438,0Z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M382.59375,1Q370.78125,1,363.5,-6.9375Q356.23438,-14.890625,356.23438,-28.453125L356.23438,-51.6875Q356.23438,-65.40625,363.4375,-73.34375Q370.64062,-81.28125,382.59375,-81.28125Q391.51562,-81.28125,397.28125,-76.796875Q403.04688,-72.328125,404.04688,-64.65625L404.48438,-64.65625L404.1875,-82.796875L404.1875,-106L417.15625,-106L417.15625,-0.40625L404.1875,-0.40625L404.1875,-15.625L404.04688,-15.625Q403.04688,-7.8125,397.28125,-3.40625Q391.51562,1,382.59375,1ZM386.90625,-10.28125Q394.96875,-10.28125,399.57812,-15.328125Q404.1875,-20.375,404.1875,-29.3125L404.1875,-50.96875Q404.1875,-59.90625,399.57812,-64.953125Q394.96875,-70,386.90625,-70Q378.70312,-70,373.95312,-65.09375Q369.20312,-60.1875,369.20312,-50.96875L369.20312,-29.3125Q369.20312,-20.09375,373.95312,-15.1875Q378.70312,-10.28125,386.90625,-10.28125Z"
android:fillColor="#FFFFFF"/>
</group>
</group>
</vector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#E91E63</color>
</resources>

View File

@@ -1,5 +1,5 @@
PACKAGE_NAME=io.nekohasekai.sagernet
VERSION_NAME=0.5-rc25
VERSION_NAME=0.6-beta01
VERSION_CODE=120
NAIVE_VERSION_NAME=95.0.4638.54-1

View File

@@ -3,9 +3,6 @@ include(":library:include")
include(":library:proto")
include(":library:proto-stub")
include(":library:shadowsocks")
include(":library:shadowsocks-libev")
include(":plugin:api")
val buildPlugin = System.getenv("BUILD_PLUGIN")