zaneschepke / wgtunnel

An alternative Android client app for WireGuard VPN
https://zaneschepke.com/wgtunnel-docs
MIT License
601 stars 33 forks source link

[FEATURE] - Turn up when call specific IP #205

Open evazzoler opened 1 month ago

evazzoler commented 1 month ago

Hi, don't know if it is possible, but I'd like the tunnel goes up when I try to reach a certain IP or Class. In example when I open a VoIP app and it try to connect the SIP server, or when I open Chrome and try to reach a device at home but want the rest of the connections normally goes to Internet via mobile network without triggering the VPN. Hope is it useful and possible...

FingerlessGlov3s commented 1 month ago

Would the app specific tunneling option not work? Just add the SIP and browser to the list? Then use the auto wifi tunnel, whitelist your Home SSID and then your golden?

evazzoler commented 1 month ago

I don't want the tunnel up everytime l'm out of home (useless battery drain) but only when I really want to reach an IP on the other side of the tunnel.

FingerlessGlov3s commented 1 month ago

So you would like it to detect you want to browse to say 10.0.0.1 and then bring up the VPN?

evazzoler commented 1 month ago

Exactly! Better if only authorized app can do that.

FingerlessGlov3s commented 1 month ago

Would be a cool feature indeed, but not sure Android has APIs for that kind of detection 🤔. Shall see what Zane says.

zaneschepke commented 1 month ago

Practically speaking, I would say there is not a way to trigger a tunnel by detecting an request to a certain IP address. I definitely don't think this is something that could be done without root.

If I understand your use case correctly, I think what would fit the use cases you described would be a combination of allowedIps and split tunneling.

When configured correctly, allowedIps should route only traffic to specific Ip addresses through the tunnel and let the rest of the traffic outside of the tunnel. For the VoIP app this could also be an app you enable for the tunnel with split tunneling.

Check out this tool for configuring this feature: https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator/

This could be something that would be cool to have built into the app one day.