porech / engarde

A go network utility to create a reliable IP tunnel over multiple connections
GNU General Public License v2.0
275 stars 41 forks source link

When phone hotspot shuts off, internet goes down #44

Closed regstuff closed 2 years ago

regstuff commented 4 years ago

Having a bit of an issue and I'm unable to debug what's wrong. My connections are an ethernet Lan cable and a WiFi from a phone hotspot. Engarde is on via TUNSafe. I'm using this config to do a livestream with OBS. When I unplug the Lan cable, the livestream continues, albeit with a slight drop in bitrate (because of the WiFi bandwidth). I plug the Lan back in, and turn off the data on my phone. (So the laptop is still connected to the hotspot, but no data will go through). The livestream continues (via Lan). Strangely, the Windows Performance tab continues to show data going through WiFi! Though it seems to be a replica of the Lan graph. Engarde's web console shows only Ethernet connected. The WiFi connection shows no packets going through. However, if I disable the hotspot on my phone, the livestream bitrate drops to zero for a few seconds, before coming back up again. I'm guessing OBS or engarde or something assumes the connection went down. Not sure why this would happen, especially considering that just turning off the data on my phone doesnt have this effect.

Configs are as below: TUNSAFE [Interface] PrivateKey = ** Address = 192.168.2.2/24 DNS = 1.1.1.1 MTU = 1360

[Peer] PublicKey = ** AllowedIPs = 0.0.0.0/0 Endpoint = 127.0.0.1:54320

ENGARDE client: description: "My engarde-client instance" listenAddr: "127.0.0.1:54320"

dstAddr: "34.87.166.121:54321" excludedInterfaces:

server: description: "My engarde-server instance" listenAddr: "0.0.0.0:54321" dstAddr: "127.0.0.1:54320" clientTimeout: 30 writeTimeout: 10 webManager: listenAddr: "0.0.0.0:80" username: "engarde" password: "engarde"

ale-rinaldi commented 4 years ago

Hello, thanks for trying engarde and sorry for the enormous delay in my answer.

UDP packets are, by design, sent out to the interface, without actually checking if they reach or not their destination. So I'm not surprised that if you turn off your mobile data you don't notice any change: packets will just reach the mobile phone and get lost there (that's also why you see traffic in the Windows manager). Here something strange is happening when you disconnect the wifi: the network driver is probably blocking the write call when the wifi goes down, so it gets stuck there until it actually returns an error and removes the interface. As a first attempt I would try to set a low writeTimeout in the engarde client configuration, like 10 (ms) or so, that should immediatly stop the attempt to write if the interface isn't ready. If you see high package loss, just increase it a little; the right value pretty much depends on you environment, so just experiment a little đź‘Ť

Please let me know if this solves for you :)

Thanks again