Skip to content

Commit

Permalink
upgrade to api level 28
Browse files Browse the repository at this point in the history
  • Loading branch information
bndeff committed Oct 11, 2019
1 parent 90db683 commit 94d5e87
Show file tree
Hide file tree
Showing 74 changed files with 1,890 additions and 1,503 deletions.
17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
build
obj
libs
assets
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
113 changes: 113 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 5 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
SocksDroid
---
SOCKS5 client for Android 5.0+ making use of the `VpnService` API and `tun2socks` so that it works without root permission (unlike ProxyDroid).
==========

Most of the JNI code are imported from `shadowsocks-android` project because they have already done most of the work.
## SOCKS5 client for Android 5.0+ using VpnService

### THIS IS NOT A SHADOWSOCKS CLIENT! SOCKS5 IS NOT SHADOWSOCKS!
This is an updated version of [SocksDroid by PeterCxy](https://github.com/PeterCxy/SocksDroid) to support modern Android devices.

UDP Forwarding
---
As `tun2socks` does not support UDP associate but has its own implementation of UDP forwarding `badvpn-udpgw`, so it is needed that the udpgw daemon run on remote server to use UDP forwarding.
The project is in maintenance mode: no new features are planned, only bug fixes and compatibility upgrades.

On remote server

```
badvpn-udpgw --listen-addr 127.0.0.1:7300
```

And set `UDP Gateway` in this app to `127.0.0.1:7300`

DNS
---
If the server does not run `udpgw`, DNS lookups can also be processed in this app.

It makes use of the TCP DNS feature of `pdnsd`. You just set a DNS server that supports TCP DNS in this app, and all DNS requests will be transformed into TCP queries.

Routing
---
The app has an embedded list of non-Chinese IPs. Chinese users can make use of it for best experience in bypassing GFW.

GFW
---
Note that SOCKS5 is currently blocked by the GFW, which means Chinese users cannot connect to any SOCKS5 servers outside China.

But there are still solutions. For example, use `stunnel` to wrap the SOCKS5 connection with SSL. See my project stunnel-android for usage on Android.

License
---
This project is licensed under GNU General Public License Version 3 or later.
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" width="200">](https://play.google.com/store/apps/details?id=net.typeblog.socks)
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
14 changes: 6 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.0"

compileSdkVersion 28
defaultConfig {
applicationId "net.typeblog.socks"
minSdkVersion 21
targetSdkVersion 22
versionCode 10
versionName "1.0.1"
targetSdkVersion 28
versionCode 11
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Binary file added app/release/app-release.apk
Binary file not shown.
1 change: 1 addition & 0 deletions app/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":11,"versionName":"1.0.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
1 change: 1 addition & 0 deletions app/src/main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj
50 changes: 28 additions & 22 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.typeblog.socks" >

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
xmlns:tools="http://schemas.android.com/tools"
package="net.typeblog.socks"
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme"
android:extractNativeLibs="false"
android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
Expand All @@ -19,22 +25,22 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".SocksVpnService"
android:permission="android.permission.BIND_VPN_SERVICE"
android:process=":vpn">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
</service>
<receiver
android:name=".BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

<service
android:name=".SocksVpnService"
android:permission="android.permission.BIND_VPN_SERVICE"
android:process=":vpn">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
</service>

<receiver
android:name=".BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>

</manifest>
Binary file added app/src/main/assets/arm64-v8a/pdnsd
Binary file not shown.
Binary file added app/src/main/assets/arm64-v8a/tun2socks
Binary file not shown.
Binary file added app/src/main/assets/armeabi-v7a/pdnsd
Binary file not shown.
Binary file added app/src/main/assets/armeabi-v7a/tun2socks
Binary file not shown.
Binary file added app/src/main/assets/x86/pdnsd
Binary file not shown.
Binary file added app/src/main/assets/x86/tun2socks
Binary file not shown.
Binary file added app/src/main/assets/x86_64/pdnsd
Binary file not shown.
Binary file added app/src/main/assets/x86_64/tun2socks
Binary file not shown.
6 changes: 3 additions & 3 deletions app/src/main/build-jni.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

rm -rf assets
rm -rf ../../libs
rm -rf jniLibs

ndk-build

for p in armeabi-v7a arm64-v8a x86 mips; do
for p in armeabi-v7a arm64-v8a x86 x86_64; do
mkdir -p assets/$p
cp libs/$p/{tun2socks,pdnsd} assets/$p/
done

rm -rf libs/*/{tun2socks,pdnsd}
mv libs ../../
mv libs jniLibs
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 17 additions & 15 deletions app/src/main/java/net/typeblog/socks/BootReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@
import static net.typeblog.socks.BuildConfig.DEBUG;

public class BootReceiver extends BroadcastReceiver {
private static final String TAG = BootReceiver.class.getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
Profile p = ProfileManager.getInstance(context).getDefault();

if (p.autoConnect() && VpnService.prepare(context) == null) {

if (DEBUG) {
Log.d(TAG, "starting VPN service on boot");
}

Utility.startVpn(context, p);
}
}
private static final String TAG = BootReceiver.class.getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Profile p = new ProfileManager(context).getDefault();

if (p.autoConnect() && VpnService.prepare(context) == null) {

if (DEBUG) {
Log.d(TAG, "starting VPN service on boot");
}

Utility.startVpn(context, p);
}
}
}
}
Loading

0 comments on commit 94d5e87

Please sign in to comment.