bannedbook / v2ray.vpn

V2free for android, a V2ray and Shadowsocks client with many builtin free servers.
Other
399 stars 85 forks source link

Android VpnService exception routing problem! #3

Closed liulilittle closed 3 years ago

liulilittle commented 3 years ago

I've been watching on Android VpnService Document, there is no exception routing support

We added 0.0.0.0/0 routing, so it also means that all traffic will be tun0 (Virtual LAN) take over, Android SDK provides only a protect (int fd) function is used to protect a "fd/socket" don't go tun0, so does this mean, There is no way to add a route that does not go "tun0" without root.

Directly call route or iptables command, which requires Android to provide ROOT permissions. At present, I do not know whether there is another way to add an exception route for Android without providing ROOT permissions (without going to virtual network adapter Tun0), because of the extra performance cost of using the alternative;

There are workarounds, of course, In which C/C++ programs are via sockets to the local loop (127.0.0.1). This program makes a forward call to the Protect function to ensure that outbound sockets are exempt from the vNic(tun0).