zaneschepke / wgtunnel

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

[BUG] - Auto-tunneling not switching #250

Closed JohannCR closed 2 weeks ago

JohannCR commented 1 month ago

Describe the bug When disconnecting from my home wifi, auto-tunneling does not switch the vpn back on in the background. I have to open WG tunnel for it to automatically switch. I checked, battery optimization is disabled and background run is authorized for it. Any idea of what else I could check ? If you need a log, I'll try to get one when the VPN should have turned on. PS : I don't remember if the behaviour is similar when getting connected to my trusted wifi, I'll check later today and report back if it's different. EDIT: it works when connecting to trusted wifi, so it only happens on disconnects...

Smartphone (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Leave trusted wifi
  2. Wait at least a minute
  3. Check if VPN is activated
  4. If not, open WG tunnel and see if it switches itself

Expected behavior VPN should turn on in the background

Additional context

zaneschepke commented 1 month ago

Hello! Do you have tunnel on mobile data enabled?

JohannCR commented 1 month ago

Hi, Yes it is enabled. Note that I've noticed it does sometimes work... I don't know what could bring that randomness. It's not as bad as it was now compared to when I opened the ticket, I don't get it I did not change anything 🤔

KarlKarp commented 1 month ago

Hi @zaneschepke, you did a wonderful job. Many thanks 4 it. Today I'm using WG TUNNEL 1. time and the behaviour is the same as @JohannCR. I'm Guest in WiFi6 area and whole time there is good wifi power. After night wifi is on, but WG TUNNEL is waiting 4 connection. I've been using 'modes and routines' to save power at night. Android 14 / Samsung Galaxy S23 Ultra

JohannCR commented 1 month ago

Update on my side, things seem to have gone back to normal... It just always works now, just like it did for a while after I first installed it.

So my guess is it did not work for a time because I must have tinkered too much with android, with data on/off. I did this because I went abroad and didn't want to pay roaming charges + wanted to limit bandwidth as much as possible when I had wifi. I can't remember exactly what I did, but among other things I deactivated data or limited it for all apps (including most system apps) except for a few I needed to use (WG tunnel was one I kept data activated for). When I got back I reactivated data globally, but forgot that I also did that for all apps manually. I think it works again since I reactivated data for all apps. So maybe there was a system app that needed data for WG auto tunnel to work correctly? I don't know enough about android system services to be sure... Any of this makes sense to you @zaneschepke ?

zaneschepke commented 2 weeks ago

Yeah, that makes sense. I can't be sure that is what was causing the issue, but if it pops up again we can reopen. I am also making some pretty big changes to auto tunneling that I hope will improve the reliability in #298.