I am using [VpnService] (http://developer.android.com/reference/android/net/VpnService.html)! and able to create VPN connection. I could see (tracert) all the internet traffic going through VPN.
Now, my requirement is to bypass VPN for certain URLs (eg. www.google.com). To achieve this, I have written the following code:
if (vpnService.protect(new Socket(InetAddress.getByName("74.125.225.241"), 80))) {
Log.d("TAG", "Socket protection for google.com is successfull");
}
But on visiting www.google.com, I could still see VPN server ip on tracert. So, with this code it seems VpnService is not protecting this request from going to VPN server.
Can anyone point me where I am going wrong and suggest the correct way of doing it?
From my understanding you only exclude (protect) one specific socket from the VPN tunnel.
Therefore every other socket you open with the same target is still going through the VPN tunnel. You have to call protect prepare(...)
on every socket that is established from your device towards Google.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments