Route all the internet traffic from my android voip app to my own vpn server

你说的曾经没有我的故事 提交于 2019-12-24 06:45:06

问题


We have set up our own VPN Server and want to route all the traffic from our VOIP android app through this server.

But all the solutions I have seen thus far use the vpn service class http://developer.android.com/reference/android/net/VpnService.html, which creates a vpn tunnel for the whole device and not just my application. I want the other apps running on the phone to use the internet as normal while the traffic from our app is routed through our VPN server.

Is there anyway to do this? I am very grateful for any suggestions. Thanks


回答1:


VpnService does not need to apply to the whole device. See: VpnService.Builder.addAllowedApplication (available with API 21 - 5.0):

Adds an application that's allowed to access the VPN connection. If this method is called at least once, only applications added through this method (and no others) are allowed access. Else (if this method is never called), 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.



来源:https://stackoverflow.com/questions/39330640/route-all-the-internet-traffic-from-my-android-voip-app-to-my-own-vpn-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!