dev7dev / V2ray-Android

A simple Java module with sample source for implementing V2ray/Xray on Android.
37 stars 12 forks source link

Split Tunneling? #6

Closed CodeWithTamim closed 7 months ago

CodeWithTamim commented 8 months ago

How can I add split tunneling feature.

dev7dev commented 7 months ago

Hi, Currently, this feature is available in the library. If you take a look at line 59 of the V2rayController class you will see that in the last parameter, it receives a string array list called blocked_apps. By default, in this example, we send ‍‍null because we want all programs to pass through the tunnel. You can put the package of any program that you don't want to pass through the tunnel in this array.

For example, I want the Chrome browser to not go through the tunnel and every site the user visits will see the user's real IP.


List<String> blocked_applications = new ArrayList<>();
blocked_applications.add("com.android.chrome");
V2rayController.StartV2ray(getApplicationContext(), "Default", v2ray_json_config.getText().toString(), blocked_applications);
CodeWithTamim commented 7 months ago

Hi, Currently, this feature is available in the library. If you take a look at line 59 of the V2rayController class you will see that in the last parameter, it receives a string array list called blocked_apps. By default, in this example, we send ‍‍null because we want all programs to pass through the tunnel. You can put the package of any program that you don't want to pass through the tunnel in this array.

For example, I want the Chrome browser to not go through the tunnel and every site the user visits will see the user's real IP.


List<String> blocked_applications = new ArrayList<>();
blocked_applications.add("com.android.chrome");
V2rayController.StartV2ray(getApplicationContext(), "Default", v2ray_json_config.getText().toString(), blocked_applications);

Thanks man !