简体   繁体   中英

Android VpnService class and its builder class

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?

  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

I haven't test the feature but, NetGuard application has port forwarding feature.

This application act as firewall for route the other application traffic through VPN.

Its a open source project. you can find it on github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM