Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android VpnService class and its builder class

Tags:

android

vpn

I have two questions concerning the VpnService.Builder class.

Suppose I know an App communicate with its server www.somedomain.com, I know the server's IP address is 210.32.204.165.

  1. About the addAddress(String address, int prefixLength) function. In documentation, it says this function "add a network address to the VPN interface", what does that mean? Does it mean the traffic goes to that address (server IP address of an App) will go through VPN or traffic from this address (device IP?) will go through VPN?

  2. There is a function addAllowedApplication(String packageName) which specify which app's traffic go through the VPN tunnel. Is there a way or a function to force all traffic send to server www.somedomain.com go through VPN tunnel?

like image 347
Leem.fin Avatar asked Feb 07 '17 15:02

Leem.fin


1 Answers

  1. It mean the traffic goes to that address (server IP address of an App) will go through VPN

  2. link: if this method is never called then all applications are allowed by default. If some applications are added, other, un-added applications will use networking as if the VPN wasn't running. So you can to never call this method and all applications will use VPN

like image 98
MaxV Avatar answered Nov 10 '22 05:11

MaxV