MarioNoll / WG-Auto-Connect

Auto connect to a WireGuard tunnel
MIT License
11 stars 1 forks source link

Feature Request: AutoConnect to Mobile Networks #8

Open GeneralTDog opened 2 months ago

GeneralTDog commented 2 months ago

Hi, I've noticed, that it successfully disconnects my VPN, when im in my designated network where it should disconnect. It also sucessfully auto-enables the vpn tunnel when switching WiFi.

But i did notice it wont auto-enable when switching from my WLAN to a mobile network, so i would like to request this feature.

MarioNoll commented 2 months ago

Hey @GeneralTDog do I understand correctly that the enabling of the tunnel does not work for you when you disconnect from your designated WiFi? Does it work if you disable WiFi? Can you share some more details maybe? Which Android Version are you using?

GeneralTDog commented 2 months ago

Sure thing.

It does not establish a tunnel when:

Android 14 LineageOS 21-20240426-NIGHTLY-kebab lineage_kebab-userdebug 14 AP1A.240405.002.A1 6012ba0027

App via F-Droid Version 1.1.0 de.marionoll.wgautoconnect

Rouji commented 1 month ago

Exactly the same thing here happening here, also on Lineage 21.

MarioNoll commented 1 month ago

@Rouji @GeneralTDog Can you please check if disabling "Pause app activity if unused" in the permission settings "Addtional Permissions" for "control WireGuard tunnels" does help? After switching to a Pixel 8a I noticed the same behavior, for the moment that seems to have fixed it on my side.

Rouji commented 1 month ago

That does help a bit. It does enable the VPN now when switching to cellular, but not always. I'll keep an eye on it for a bit, maybe I'll notice a pattern

MarioNoll commented 1 month ago

Yeah I noticed the same flakiness, I did a little more digging and the request to the WireGuard App itself to activate the tunnel is send correctly, but somehow it didn't seem to get received. After disabling battery optimization for the WireGuard App though, it seems to work flawlessly now.

Rouji commented 1 month ago

I'll give that a try too

Rouji commented 1 month ago

Unfortunately didn't help.
I can kind of confirm it seems to be more on the wireguard app's side though. It works perfectly for a short while after I've had the wireguard app open (or it was active for some other reason?) and then stops working again

GeneralTDog commented 1 month ago

Did some testing and disabled all power optimizations and checked all settings. Unfortunately it indeed didn't work out for me aswell. Also the Pause activity slider did sadly not fix it.

Rouji commented 1 month ago

Unfortunately didn't help. I can kind of confirm it seems to be more on the wireguard app's side though. It works perfectly for a short while after I've had the wireguard app open (or it was active for some other reason?) and then stops working again

I'm gonna back-pedal on that, it does also work even if I've not touched the wireguard app in ages. It just (as far as I can tell) completely randomly sometimes fails to do its thing.

Overall it does seem to work more often than not now though; the battery optimisation settings seem to have done something