porech / engarde

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

Will engarde work for TCP traffic over RTMP protocol #40

Closed regstuff closed 4 years ago

regstuff commented 4 years ago

Sorry, this is not really an issue, but more of a few questions I had about engarde. My situation is that I am livestreaming over an ethernet that gives sufficient bandwidth most of the time, but I'd like to have seamless failover to a cellular network (via a dongle) in case the ethernet goes down. Engarde says "every UDP packet that is emitted (...) and sends it through every available connection. So, the first package that reaches its destination wins, and the others are silently discarded " I'm not a network guy so I was wondering if you guys could answer a few questions before I dive into trying to make this work. 1) Does this support only UDP? I'm streaming via RTMP which is a TCP protocol. Will Engarde work? 2) If it sends every packet over two networks, does it have the means to maintain packets in the right order at the server end? 3) If theoretically my ethernet does get throttled, and its bandwidth drops, and my Wifi becomes the higher bandwidth connection, does this mean my livestream will theoretically continue uninterrupted over WiFi (assuming the WiFi has sufficent bandwidth for the livestream)

Thanks for your efforts!

Marctraider commented 4 years ago
  1. Engarde uses Wireguard which utilizes the UDP as network protocol, which means it can carry any protocol on top of it without problems. In my example, my whole internet gets tunneled over UDP, so basically any protocol.

  2. Nope, out of order packets is possible. But I personally haven't seen this much. Only if your two connections have the exact same latency it could occur more regularly. It is not a problem at all if you say your program uses TCP, as TCP itself will deal with out of order and lost packets.

  3. Yep, with engarde your bandwidth is always as fast as the fastest connection that is still up, and transition should go seamlessly.

ale-rinaldi commented 4 years ago

Hello, @regstuff ,

actually, engarde itself works with UDP packets only, but its main use case is to overlay a WireGuard VPN. The WireGuard VPN will send all of its traffic via UDP, but on a two peers setup it will give you a new pair of private IPs to contact the endpoints. On this, you can create TCP connections without any issue.

This is the designed workflow: [Your client application] <---TCP---> [Wireguard] <---UDP---> [engarde-client] <---UDP--->[ engarde-server] <---UDP--->[Wireguard] <---TCP---> [Your server application]

Every UDP packet will be transmitted by engarde on all the available connections, so WireGuard on the other end will receive each packet multiple times, but it will discard all of them except the first valid one. The TCP connection you create on top of the WireGuard VPN will then assure the order of the packets.

I hope I've been clear :)

regstuff commented 4 years ago

Thank you for the clarifications. You can close this non-issue now. :) I'll give it a try.