celzero / rethink-app

DNS over HTTPS / DNS over Tor / DNSCrypt client, WireGuard proxifier, firewall, and connection tracker for Android.
https://rethinkfirewall.com/
Apache License 2.0
2.64k stars 134 forks source link

Auto-enable proxies based on network type Mobile, WiFi #1143

Open ignoramous opened 7 months ago

ignoramous commented 7 months ago

A user says,

Will it be possible to automatically activate a WireGuard connection or a WireGuard profile only when the mobile interface (i.e. separate from WiFi) is active?

p-f-w commented 7 months ago

maybe confused "wifi"/"mobile" vs. "metered"/"unmetered"

In android settings every "wifi" can set to "metered/"unmetered"/"auto" and only "metered data" are set to limited in "background data" (and "unrestricted data usage" ("when Data Saver is on")) per app in android settings (maybe depands from android settings per app for "battery optimisation"(("Optimising battery use"/"Not optimised")and from appops-settings per app for "START_FOREGROUND"(allow/ignore), "RUN_IN_BACKGROUND" & "RUN_ANY_IN_BACKGROUND("No restriction"(<api 33/Android 8 level)/"Basic restriction"/"strict restriction"(Android 9+)

What is with "Developers options"->"Mobile data always active"("Always keep mobile data active, even when Wi-Fi is active(for fast network switching)." on or off?

I mean to know that android will registry all traffic for apps used the vpn for the the vpn-app, but are restrictions per app in android are out of order and only the restrictions in vpn-app or will they only add?

ignoramous commented 7 months ago

maybe confused "wifi"/"mobile" vs. "metered"/"unmetered"

No, this is deliberate.

In android settings every "wifi" can set to "metered/"unmetered"/"auto" and only "metered data" are set to limited in "background data" (and "unrestricted data usage" ("when Data Saver is on")) per app in android settings

Not familiar with this, honestly. And of course, what Android can accomplish on a per-app isn't entirely always possible to do (and undo) with a VPN-based userspace firewall like Rethink.

What is with "Developers options" -> "Mobile data always active"("Always keep mobile data active, even when Wi-Fi is active(for fast network switching)." on or off?

It allows apps to use either mobile data or wifi. When disabled, if wifi is active, apps cannot use mobile data.

but are restrictions per app in android are out of order and only the restrictions in vpn-app or will they only add

Sorry, I don't follow. Can you explain what is meant here?

HomemadeAdvanced commented 4 months ago

Maybe take a look at this App. They seem to have something like this implemented in their app: https://github.com/zaneschepke/wgtunnel

Qpp0 commented 1 month ago

@ignoramous like this feature: Auto connect to tunnels based on Wi-Fi SSID, ethernet, or mobile data