Skip to content

Commit

Permalink
Release 0.1.1-alpha:
Browse files Browse the repository at this point in the history
- Fix bug with UDP
- Fix some crashes
- Add DNS setting
- Add button reset settings
- Add log saving
- Update UI
  • Loading branch information
dovecoteescapee committed Feb 23, 2024
1 parent cf80311 commit 54cc788
Show file tree
Hide file tree
Showing 23 changed files with 365 additions and 133 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.gradle
/local.properties
/.idea/caches
/.idea/deploymentTargetDropDown.xml
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
Expand Down
10 changes: 0 additions & 10 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ByeDPI for Android

Application for Android that start a local VPN service to bypass DPI (Deep Packet Inspection) and unblock the internet
Application for Android that start a local VPN service to bypass DPI (Deep Packet Inspection) and censorship.

## Features

Expand Down
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/build
/debug
/release
*.aar
*.jar
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "io.github.dovecoteescapee.byedpi"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "0.1.0-alpha"
versionCode = 2
versionName = "0.1.1-alpha"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion app/libs/tun2socks
Submodule tun2socks updated 1 files
+1 −1 proxy/proxy.go
Binary file removed app/release/byedpi.apk
Binary file not shown.
20 changes: 0 additions & 20 deletions app/release/output-metadata.json

This file was deleted.

3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

<activity
android:name=".SettingsActivity"
android:exported="true" />
android:label="@string/title_settings"
android:exported="false"/>

<service android:name=".ByeDpiVpnService"
android:permission="android.permission.BIND_VPN_SERVICE"
Expand Down
50 changes: 37 additions & 13 deletions app/src/main/cpp/native-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
#include <params.h>
#include <packets.h>
#include <jni.h>
#include <android/log.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>

extern int big_loop(int fd);
extern int NOT_EXIT;

struct packet fake_tls = {
sizeof(tls_data), tls_data
Expand Down Expand Up @@ -33,7 +36,7 @@ struct params params = {
.max_open = 512,
.bfsize = 16384,
.baddr = {
.sin6_family = AF_INET6
.sin6_family = AF_INET
},
.debug = 2
};
Expand All @@ -55,8 +58,16 @@ int get_default_ttl()
return orig_ttl;
}

JNIEXPORT jint JNICALL
Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_startProxy__IIIIZZIIZIZZZIZ(
void *run(void *srv) {
LOG(LOG_S, "Start proxy thread");
listener(*((struct sockaddr_ina *) srv));
free(srv);
LOG(LOG_S, "Stop proxy thread");
return NULL;
}

JNIEXPORT jlong JNICALL
Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_jniStartProxy(
JNIEnv *env,
jobject thiz,
jint port,
Expand All @@ -72,7 +83,8 @@ Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_startProxy__IIIIZZIIZIZZZ
jboolean host_mixed_case,
jboolean domain_mixed_case,
jboolean host_remove_space,
jint tls_record_split,
jboolean tls_record_split,
jint tls_record_split_position,
jboolean tls_record_split_at_sni) {
enum demode desync_methods[] = {DESYNC_NONE, DESYNC_SPLIT, DESYNC_DISORDER, DESYNC_FAKE};

Expand All @@ -89,6 +101,7 @@ Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_startProxy__IIIIZZIIZIZZZ
params.mod_http |= domain_mixed_case ? MH_DMIX : 0;
params.mod_http |= host_remove_space ? MH_SPACE : 0;
params.tlsrec = tls_record_split;
params.tlsrec_pos = tls_record_split_position;
params.tlsrec_sni = tls_record_split_at_sni;

if (!params.def_ttl && params.attack != DESYNC_NONE) {
Expand All @@ -97,12 +110,23 @@ Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_startProxy__IIIIZZIIZIZZZ
}
}

struct sockaddr_ina srv = {
.in = {
.sin_family = AF_INET,
.sin_port = htons(port),
}
};
struct sockaddr_ina *srv = malloc(sizeof(struct sockaddr_ina));
srv->in.sin_family = AF_INET;
srv->in.sin_addr.s_addr = inet_addr("0.0.0.0");
srv->in.sin_port = htons(port);

NOT_EXIT = 1;

return listener(srv);
}
pthread_t proxy_thread;
if (pthread_create(&proxy_thread, NULL, run, srv) != 0) {
LOG(LOG_S, "Failed to start proxy thread");
return -1;
}

return proxy_thread;
}

JNIEXPORT void JNICALL
Java_io_github_dovecoteescapee_byedpi_ByeDpiVpnService_jniStopProxy(JNIEnv *env, jobject thiz, jlong proxy_thread) {
NOT_EXIT = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class ByeDpiProxyPreferences(
hostMixedCase: Boolean? = null,
domainMixedCase: Boolean? = null,
hostRemoveSpaces: Boolean? = null,
tlsRecordSplit: Int? = null,
tlsRecordSplit: Boolean? = null,
tlsRecordSplitPosition: Int? = null,
tlsRecordSplitAtSni: Boolean? = null,
) {
val port: Int = port ?: 1080
Expand All @@ -23,14 +24,15 @@ class ByeDpiProxyPreferences(
val defaultTtl: Int = defaultTtl ?: 0
val noDomain: Boolean = noDomain ?: false
val desyncKnown: Boolean = desyncKnown ?: false
val desyncMethod: DesyncMethod = desyncMethod ?: DesyncMethod.None
val desyncMethod: DesyncMethod = desyncMethod ?: DesyncMethod.Disorder
val splitPosition: Int = splitPosition ?: 3
val splitAtHost: Boolean = splitAtHost ?: false
val fakeTtl: Int = fakeTtl ?: 8
val hostMixedCase: Boolean = hostMixedCase ?: false
val domainMixedCase: Boolean = domainMixedCase ?: false
val hostRemoveSpaces: Boolean = hostRemoveSpaces ?: false
val tlsRecordSplit: Int = tlsRecordSplit ?: 0
val tlsRecordSplit: Boolean = tlsRecordSplit ?: false
val tlsRecordSplitPosition: Int = tlsRecordSplitPosition ?: 0
val tlsRecordSplitAtSni: Boolean = tlsRecordSplitAtSni ?: false

enum class DesyncMethod {
Expand Down
Loading

0 comments on commit 54cc788

Please sign in to comment.