Cake-VPN
Cake-VPN copied to clipboard
split tunneling
hi @ashraf789 i was looking into adding the split tunneling feature to the app so we could select the apps that are allowed to have vpn (all the apps are selected in default) and i was looking in to openvpn source and i found a class called Settings_Allowed_Apps.kt but the problem is i dont know kotlin so i was wondering if you would like to add this feature its really use full thanks
Hello, Thank you for your suggestion. I am sorry to say that I am also not familiar with Kotlin. Although I have the interestest to learn. Currently, I am working on web platform and I do not have much time.
I am sorry this time, I could not full fill your request. If you found the solution please update this source code too. Your contribution could save lots of other developer time. Thanks Ashraf.
Thats okay i would try to make this feature thanks again 👍
Hi guys, did you find any solution for the split tunneling? Can we restrict the app to only allow one app to use the OpenVPN?
Thank you.
on OpenVPNService.java after line number
https://github.com/ashraf789/Cake-VPN/blob/5a5b1b26a72eb402fbf7e97b24742f53f6c8c674/vpnLib/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java#L797
add this to your app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
try {
builder.addDisallowedApplication("com.android.chrome");
} catch (Exception e) {
}
}
Hello @Deepanshusuman, thank you for your reply, is this work same for builder.addAllowedApplication(appPackage);?
and one more question if possible can we restrict the vpn from google services like google search/ maps ? (specially in pixels devices)
Thank you so much. Have a nice day.
addAllowedApplication -> allow apps to use vpn addDisallowedApplication -> disallow apps to use vpn i don't know for pixel but you can use for google apps
PackageManager pm = getPackageManager();
List<ApplicationInfo> apps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo app : apps) {
if(pm.getLaunchIntentForPackage(app.packageName) != null) {
// apps with launcher intent
if((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
// here you you will get google apps
} else if ((app.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
// system apps
} else {
// user installed apps
}
appsList.add(app);
}
}
reference -> https://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run
or you can remove from arraylist which are google apps
Hi again, is their any way to monito the packages that pass thru the vpn tunnel? ex: monitoring WhatsApp packages passing thru the vpn or WhatsApp call... (i only need to count the number of messages)
Sorry for asking question here. Thank you so much. Have a nice day.
I haven't tried yet. But as far as I know the packets are encrypted for whatsapp
On Thu, Dec 3, 2020, 7:22 PM ChadiGSfeir [email protected] wrote:
Hi again, is their any way to monito the packages that pass thru the vpn tunnel? ex: monitoring WhatsApp packages passing thru the vpn or WhatsApp call... (i only need to count the number of messages)
Sorry for asking question here. Thank you so much. Have a nice day.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ashraf789/Cake-VPN/issues/30#issuecomment-738007142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCOQP26PUKCG5SGJYOHBGLSS6J3BANCNFSM4MSGYQ6Q .
Hello. I saw your message with how to disallow google chrome, I put your code in OpenVpnService, in function OpenTun but this doesn’t work. Are you using openTun somewhere?
Hello. I saw your message with how to disallow google chrome, I put your code in OpenVpnService, in function OpenTun but this doesn’t work. Are you using openTun somewhere?
I couldn't implement anything for google services, only I can block apps from using VPN as Deepanshusuman suggested.
As far as I know it’s very insecure
Hello, can we do this in ios?
hi @ashraf789 i was looking into adding the split tunneling feature to the app so we could select the apps that are allowed to have vpn (all the apps are selected in default) and i was looking in to openvpn source and i found a class called Settings_Allowed_Apps.kt but the problem is i dont know kotlin so i was wondering if you would like to add this feature its really use full thanks
#------------------------------------------------------------ put this code inside openvpnservice class opentun method,
public ParcelFileDescriptor openTun() { ArrayList<String> appsList = new ArrayList<>(); appsList.add("com.android.chrome");
//Debug.startMethodTracing(getExternalFilesDir(null).toString() + "/opentun.trace", 40* 1024 * 1024);
Builder builder = new Builder();
for (int i=0;i<appsList.size();i++){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
try {
builder.addDisallowedApplication(appsList.get(i));
} catch (Exception e) {
}
}
}