Files
firezone/.github
Thomas Eizinger 578363a7fe refactor(ip-packet): introduce etherparse (#6524)
This PR introduces the `etherparse` dependency for parsing and
generating IP packets.

Using `etherparse`, we can implement the NAT46 & NAT64 implementations
for the gateway more elegantly because it allows us to parse the IP and
protocol headers into a static and much richer representation. The
conversion to the IPv4/IPv6 equivalent is then just a question of
transforming one data structure into another and writing it to the
correct place in the buffer.

We extract this functionality into dedicated `nat64` and `nat46`
modules.

Furthermore, we implement the various functions in `ip_packet::make`
using `etherparse` too. Following that, we also overhaul the NAT
translation tests that we have in `ip_packet::proptests`. Those now use
the more low-level `consume_to_ipX` APIs which makes the tests more
ergonomic to write.

In the future, we should upstream `Ipv4HeaderSliceMut` and
`Ipv6HeaderSliceMut` to `etherparse`.

Moving all of this functionality to `etherparse` will make it easier to
write tests that involve more IP packets as well as customise the
behaviour of our NAT.

Related: #5614.
Related: #6371.
Related: #6353.
2024-09-04 20:01:01 +00:00
..
2024-06-09 18:05:56 +00:00