mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-04-05 10:06:25 +00:00
In our NAT table on the gateway, we try to first pick the external port as the one on the packet that we want to translate. This makes that port mapping consistent between NAT sessions in the majority of cases. In case the port is taken, we iterate through two chained `Range`s that end up cycling the entire port range. [`RangeFrom`](https://doc.rust-lang.org/std/ops/struct.RangeFrom.html) has a somewhat unexpected behaviour in regards to exhaustived ranges: They panic when trying to access the next element. To avoid this, we explicitly end the first range at `u16::MAX` which makes it an empty range in case the source port is `u16::MAX`.
Connlib
Firezone's connectivity library shared by all clients.
Building Connlib
You shouldn't need to build connlib directly; it's typically built as a dependency of one of the other Firezone components. See READMEs in those directories for relevant instructions.