mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
When we receive a DNS query for a DNS resource in Firezone, we take the next available 4 IPs from the CG-NAT range and assign them to the domain name. For example, if `example.com` is a DNS resource and it is the first resource being queried in a Firezone session, we will assigned the IPs `100.96.0.1` - `100.96.0.4` to it. If the user now restarts Firezone or signs out and back in, this state is lost and we assign those same IPs to the next DNS query coming in. This creates a problem for applications that do not re-query DNS very often or never. They expect these IPs to not change. Restarting software or signing out and back in is a common approach to fixing software problems, yet in this specific case, doing so may create even more problems for the user. To mitigate this, `ClientState` introduce a new event `DnsRecordsChanged` that gets emitted to the event-loop every time we assign new records. The event-loop then caches this in memory and reuses it in case a new session is initiated. The records are only stored in-memory and not on disk. Most likely, the tunnel process will be alive for the entire OS session. To verify this behaviour, we add a new `RestartClient` transition to our proptests. In the proptests, we already keep a mapping of all DNS names we ever resolved, including DNS resources. When generating IP traffic, we sample from this list of IPs and then expect the packet to be routed. By replacing the `ClientState` as part of this transition and re-seeding it with the previously exported DNS records, we can verify that packets to IPs resolved from a previous session still get successfully routed to the resource. Related: #5498
38 lines
1.1 KiB
TOML
38 lines
1.1 KiB
TOML
[package]
|
|
name = "client-shared"
|
|
version = "0.1.0"
|
|
edition = { workspace = true }
|
|
license = { workspace = true }
|
|
|
|
[dependencies]
|
|
anyhow = { workspace = true }
|
|
backoff = { workspace = true }
|
|
bimap = { workspace = true }
|
|
connlib-model = { workspace = true }
|
|
dns-types = { workspace = true }
|
|
firezone-logging = { workspace = true }
|
|
firezone-tunnel = { workspace = true }
|
|
futures = { workspace = true }
|
|
ip_network = { workspace = true }
|
|
libc = { workspace = true }
|
|
parking_lot = { workspace = true }
|
|
phoenix-channel = { workspace = true }
|
|
secrecy = { workspace = true }
|
|
serde = { workspace = true, features = ["std", "derive"] }
|
|
snownet = { workspace = true }
|
|
socket-factory = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
time = { workspace = true, features = ["formatting"] }
|
|
tokio = { workspace = true, features = ["rt", "sync"] }
|
|
tokio-stream = { workspace = true, features = ["sync"] }
|
|
tracing = { workspace = true, features = ["std", "attributes"] }
|
|
tun = { workspace = true }
|
|
url = { workspace = true, features = ["serde"] }
|
|
|
|
[dev-dependencies]
|
|
chrono = { workspace = true }
|
|
serde_json = { workspace = true, features = ["std"] }
|
|
|
|
[lints]
|
|
workspace = true
|