From 65cfecc67991b2bdb66901b59212029433b3fe1a Mon Sep 17 00:00:00 2001 From: dovecoteescapee Date: Sun, 3 Mar 2024 15:21:01 +0300 Subject: [PATCH] Small fixes --- app/src/main/cpp/native-lib.c | 19 +++++++++++-------- .../byedpi/core/ByeDpiProxy.kt | 3 --- .../byedpi/core/ByeDpiProxyPreferences.kt | 2 +- .../byedpi/services/ByeDpiProxyService.kt | 1 - .../byedpi/services/ByeDpiStatus.kt | 2 -- .../byedpi/services/ByeDpiVpnService.kt | 1 - app/src/main/res/xml/settings.xml | 2 +- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/src/main/cpp/native-lib.c b/app/src/main/cpp/native-lib.c index 21bb870..a903e75 100644 --- a/app/src/main/cpp/native-lib.c +++ b/app/src/main/cpp/native-lib.c @@ -23,16 +23,15 @@ extern int get_default_ttl(); extern int get_addr(const char *str, struct sockaddr_ina *addr); -JNIEXPORT jint JNICALL -Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_00024Companion_jniInit(JNIEnv *env, jobject thiz) { +JNIEXPORT jint JNI_OnLoad(JavaVM *vm, __attribute__((unused)) void *reserved) { oob_data.data = NULL; - return 0; + return JNI_VERSION_1_6; } JNIEXPORT jint JNICALL Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket( JNIEnv *env, - jobject thiz, + __attribute__((unused)) jobject thiz, jstring ip, jint port, jint max_connections, @@ -128,8 +127,10 @@ Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket( } JNIEXPORT jint JNICALL -Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(JNIEnv *env, jobject thiz, - jint fd) { +Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy( + __attribute__((unused)) JNIEnv *env, + __attribute__((unused)) jobject thiz, + jint fd) { LOG(LOG_S, "start_proxy, fd: %d", fd); NOT_EXIT = 1; if (event_loop(fd) < 0) { @@ -139,8 +140,10 @@ Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(JNIEnv *env } JNIEXPORT jint JNICALL -Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStopProxy(JNIEnv *env, jobject thiz, - jint fd) { +Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStopProxy( + __attribute__((unused)) JNIEnv *env, + __attribute__((unused)) jobject thiz, + jint fd) { LOG(LOG_S, "stop_proxy, fd: %d", fd); if (shutdown(fd, SHUT_RDWR) < 0) { return get_e(); diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxy.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxy.kt index b85ef25..5626423 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxy.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxy.kt @@ -8,10 +8,7 @@ class ByeDpiProxy { companion object { init { System.loadLibrary("byedpi") - jniInit() } - - private external fun jniInit(): Int } private val mutex = Mutex() diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxyPreferences.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxyPreferences.kt index cb33049..ae489e7 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxyPreferences.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/core/ByeDpiProxyPreferences.kt @@ -34,7 +34,7 @@ class ByeDpiProxyPreferences( val splitPosition: Int = splitPosition ?: 3 val splitAtHost: Boolean = splitAtHost ?: false val fakeTtl: Int = fakeTtl ?: 8 - val fakeSni: String = fakeSni ?: "www.w3c.org" + val fakeSni: String = fakeSni ?: "www.iana.org" val oobData: String = oobData ?: "a" val hostMixedCase: Boolean = hostMixedCase ?: false val domainMixedCase: Boolean = domainMixedCase ?: false diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiProxyService.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiProxyService.kt index cb0f39d..e3b4799 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiProxyService.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiProxyService.kt @@ -40,7 +40,6 @@ class ByeDpiProxyService : LifecycleService() { private const val FOREGROUND_SERVICE_ID: Int = 2 private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPI Proxy" - @Volatile private var status: ServiceStatus = ServiceStatus.Disconnected } diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiStatus.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiStatus.kt index fb425c5..64e29e2 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiStatus.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiStatus.kt @@ -3,11 +3,9 @@ package io.github.dovecoteescapee.byedpi.services import io.github.dovecoteescapee.byedpi.data.AppStatus import io.github.dovecoteescapee.byedpi.data.Mode -@Volatile var appStatus = AppStatus.Halted to Mode.VPN private set fun setStatus(status: AppStatus, mode: Mode) { appStatus = status to mode - } diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiVpnService.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiVpnService.kt index 32af5de..3832f98 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiVpnService.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/services/ByeDpiVpnService.kt @@ -47,7 +47,6 @@ class ByeDpiVpnService : LifecycleVpnService() { private const val FOREGROUND_SERVICE_ID: Int = 1 private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPIVpn" - @Volatile private var status: ServiceStatus = ServiceStatus.Disconnected } diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index f3fc482..702b21d 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -118,7 +118,7 @@