mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
We encapsulate the internals of `Device` by providing high-level functions on `Device` itself and make all the fields private. From the outside, each consumer this only has an `Arc<Device>` that they can interact with. To achieve this, we use the `arc-swap` crate to atomically swap out the reference to the `Arc<Device>` instead of relying on an `RwLock`. Note that the _reference_ to this `ArcSwapOption` is also wrapped in an `Arc` because we need to share this pointer across many `peer_handler`s. Once we get rid of `Arc<Tunnel>`, this will become a lot simpler.