mirror of
https://github.com/dovecoteescapee/ByeDPIAndroid.git
synced 2024-12-22 06:15:44 +00:00
Small fixes
This commit is contained in:
parent
52bf3cc272
commit
65cfecc679
@ -23,16 +23,15 @@ extern int get_default_ttl();
|
|||||||
|
|
||||||
extern int get_addr(const char *str, struct sockaddr_ina *addr);
|
extern int get_addr(const char *str, struct sockaddr_ina *addr);
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, __attribute__((unused)) void *reserved) {
|
||||||
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_00024Companion_jniInit(JNIEnv *env, jobject thiz) {
|
|
||||||
oob_data.data = NULL;
|
oob_data.data = NULL;
|
||||||
return 0;
|
return JNI_VERSION_1_6;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket(
|
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket(
|
||||||
JNIEnv *env,
|
JNIEnv *env,
|
||||||
jobject thiz,
|
__attribute__((unused)) jobject thiz,
|
||||||
jstring ip,
|
jstring ip,
|
||||||
jint port,
|
jint port,
|
||||||
jint max_connections,
|
jint max_connections,
|
||||||
@ -128,8 +127,10 @@ Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniCreateSocket(
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(JNIEnv *env, jobject thiz,
|
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(
|
||||||
jint fd) {
|
__attribute__((unused)) JNIEnv *env,
|
||||||
|
__attribute__((unused)) jobject thiz,
|
||||||
|
jint fd) {
|
||||||
LOG(LOG_S, "start_proxy, fd: %d", fd);
|
LOG(LOG_S, "start_proxy, fd: %d", fd);
|
||||||
NOT_EXIT = 1;
|
NOT_EXIT = 1;
|
||||||
if (event_loop(fd) < 0) {
|
if (event_loop(fd) < 0) {
|
||||||
@ -139,8 +140,10 @@ Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStartProxy(JNIEnv *env
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStopProxy(JNIEnv *env, jobject thiz,
|
Java_io_github_dovecoteescapee_byedpi_core_ByeDpiProxy_jniStopProxy(
|
||||||
jint fd) {
|
__attribute__((unused)) JNIEnv *env,
|
||||||
|
__attribute__((unused)) jobject thiz,
|
||||||
|
jint fd) {
|
||||||
LOG(LOG_S, "stop_proxy, fd: %d", fd);
|
LOG(LOG_S, "stop_proxy, fd: %d", fd);
|
||||||
if (shutdown(fd, SHUT_RDWR) < 0) {
|
if (shutdown(fd, SHUT_RDWR) < 0) {
|
||||||
return get_e();
|
return get_e();
|
||||||
|
@ -8,10 +8,7 @@ class ByeDpiProxy {
|
|||||||
companion object {
|
companion object {
|
||||||
init {
|
init {
|
||||||
System.loadLibrary("byedpi")
|
System.loadLibrary("byedpi")
|
||||||
jniInit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private external fun jniInit(): Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mutex = Mutex()
|
private val mutex = Mutex()
|
||||||
|
@ -34,7 +34,7 @@ class ByeDpiProxyPreferences(
|
|||||||
val splitPosition: Int = splitPosition ?: 3
|
val splitPosition: Int = splitPosition ?: 3
|
||||||
val splitAtHost: Boolean = splitAtHost ?: false
|
val splitAtHost: Boolean = splitAtHost ?: false
|
||||||
val fakeTtl: Int = fakeTtl ?: 8
|
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 oobData: String = oobData ?: "a"
|
||||||
val hostMixedCase: Boolean = hostMixedCase ?: false
|
val hostMixedCase: Boolean = hostMixedCase ?: false
|
||||||
val domainMixedCase: Boolean = domainMixedCase ?: false
|
val domainMixedCase: Boolean = domainMixedCase ?: false
|
||||||
|
@ -40,7 +40,6 @@ class ByeDpiProxyService : LifecycleService() {
|
|||||||
private const val FOREGROUND_SERVICE_ID: Int = 2
|
private const val FOREGROUND_SERVICE_ID: Int = 2
|
||||||
private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPI Proxy"
|
private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPI Proxy"
|
||||||
|
|
||||||
@Volatile
|
|
||||||
private var status: ServiceStatus = ServiceStatus.Disconnected
|
private var status: ServiceStatus = ServiceStatus.Disconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,9 @@ package io.github.dovecoteescapee.byedpi.services
|
|||||||
import io.github.dovecoteescapee.byedpi.data.AppStatus
|
import io.github.dovecoteescapee.byedpi.data.AppStatus
|
||||||
import io.github.dovecoteescapee.byedpi.data.Mode
|
import io.github.dovecoteescapee.byedpi.data.Mode
|
||||||
|
|
||||||
@Volatile
|
|
||||||
var appStatus = AppStatus.Halted to Mode.VPN
|
var appStatus = AppStatus.Halted to Mode.VPN
|
||||||
private set
|
private set
|
||||||
|
|
||||||
fun setStatus(status: AppStatus, mode: Mode) {
|
fun setStatus(status: AppStatus, mode: Mode) {
|
||||||
appStatus = status to mode
|
appStatus = status to mode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ class ByeDpiVpnService : LifecycleVpnService() {
|
|||||||
private const val FOREGROUND_SERVICE_ID: Int = 1
|
private const val FOREGROUND_SERVICE_ID: Int = 1
|
||||||
private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPIVpn"
|
private const val NOTIFICATION_CHANNEL_ID: String = "ByeDPIVpn"
|
||||||
|
|
||||||
@Volatile
|
|
||||||
private var status: ServiceStatus = ServiceStatus.Disconnected
|
private var status: ServiceStatus = ServiceStatus.Disconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
<com.takisoft.preferencex.EditTextPreference
|
<com.takisoft.preferencex.EditTextPreference
|
||||||
android:key="byedpi_fake_sni"
|
android:key="byedpi_fake_sni"
|
||||||
android:title="SNI of fake packet"
|
android:title="SNI of fake packet"
|
||||||
android:defaultValue="www.w3c.org"
|
android:defaultValue="www.iana.org"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<com.takisoft.preferencex.EditTextPreference
|
<com.takisoft.preferencex.EditTextPreference
|
||||||
|
Loading…
Reference in New Issue
Block a user