Small fixes

This commit is contained in:
dovecoteescapee 2024-03-03 15:21:01 +03:00
parent 52bf3cc272
commit 65cfecc679
7 changed files with 13 additions and 17 deletions

View File

@ -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,7 +127,9 @@ Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket(
}
JNIEXPORT jint JNICALL
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(JNIEnv *env, jobject thiz,
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;
@ -139,7 +140,9 @@ 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,
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) {

View File

@ -8,10 +8,7 @@ class ByeDpiProxy {
companion object {
init {
System.loadLibrary("byedpi")
jniInit()
}
private external fun jniInit(): Int
}
private val mutex = Mutex()

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -118,7 +118,7 @@
<com.takisoft.preferencex.EditTextPreference
android:key="byedpi_fake_sni"
android:title="SNI of fake packet"
android:defaultValue="www.w3c.org"
android:defaultValue="www.iana.org"
app:useSimpleSummaryProvider="true" />
<com.takisoft.preferencex.EditTextPreference