Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(connlib): explicitly set DNS from clients instead of requesting it via callback #4240

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

conectado
Copy link
Collaborator

@conectado conectado commented Mar 21, 2024

Extracted from #4163

Dependant PRs:
#4198
#4133
#4163

Copy link

vercel bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
firezone ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2024 1:13am

@conectado conectado force-pushed the refactor/use-set-dns-instead-of-callback branch 2 times, most recently from b99e4eb to d0ade0c Compare March 21, 2024 00:09
Copy link

github-actions bot commented Mar 21, 2024

Terraform Cloud Plan Output

Plan: 9 to add, 8 to change, 9 to destroy.

Terraform Cloud Plan

@conectado conectado marked this pull request as ready for review March 21, 2024 00:22
Copy link
Member

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for extracting this, it makes review a lot easier! A few comments.

rust/connlib/clients/shared/Cargo.toml Outdated Show resolved Hide resolved
Comment on lines 146 to 148
firezone_tunnel::ClientEvent::RefreshInterfance => {
unreachable!("Handled internally");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to not re-introduce something like this now that we have removed the old instances of it. We should make an internal event or something for the state to communicate with the Io runtime.

rust/connlib/tunnel/src/client.rs Outdated Show resolved Hide resolved
rust/connlib/tunnel/src/client.rs Outdated Show resolved Hide resolved
#[test]
fn dns_updated_when_dns_changes() {
assert!(dns_updated(
&["1.0.0.1".parse().unwrap()],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd appreciate a helper function like ip that hides the noise of .parse().unwrap() for these tests.

rust/connlib/tunnel/src/client.rs Outdated Show resolved Hide resolved
rust/connlib/tunnel/src/client.rs Outdated Show resolved Hide resolved
}

self.next_system_resolver_refresh = Some(now + std::time::Duration::from_millis(500));
self.system_resolvers = new_dns;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to already overwrite this? Wouldn't it be better to store this together with the timeout and only apply it once the timeout expires?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any harm on setting it here, it's easier to implement and if for some reason update_interface is called earlier there's no harm on setting the latest dns

Copy link

github-actions bot commented Mar 21, 2024

Performance Test Results

TCP

Test Name Received/s Sent/s Retransmits
direct-tcp-client2server 229.1 MiB (+1%) 230.2 MiB (+1%) 347 (+18%)
direct-tcp-server2client 227.7 MiB (+1%) 229.2 MiB (+1%) 378 (+77%)
relayed-tcp-client2server 146.1 MiB (+1%) 147.1 MiB (+1%) 211 (+44%)
relayed-tcp-server2client 142.9 MiB (-9%) 143.3 MiB (-9%) 152 (-20%)

UDP

Test Name Total/s Jitter Lost
direct-udp-client2server 50.0 MiB (+0%) 0.04ms (-6%) 0.00% (NaN%)
direct-udp-server2client 50.0 MiB (+0%) 0.01ms (-8%) 0.00% (NaN%)
relayed-udp-client2server 50.0 MiB (+0%) 0.13ms (+41%) 0.00% (NaN%)
relayed-udp-server2client 50.0 MiB (-0%) 0.06ms (+19%) 0.00% (NaN%)

@thomaseizinger thomaseizinger changed the title refactor(connlib): use set_dns instead of get_system_default_resolvers refactor(connlib): explicitly set DNS from clients instead of requesting it via callback Mar 21, 2024
Comment on lines +84 to +98
Some(client::Event::SignalIceCandidate { conn_id, candidate }) => {
return Poll::Ready(Ok(ClientEvent::SignalIceCandidate { conn_id, candidate }))
}
Some(client::Event::ConnectionIntent {
resource,
connected_gateway_ids,
}) => {
return Poll::Ready(Ok(ClientEvent::ConnectionIntent {
resource,
connected_gateway_ids,
}))
}
Some(client::Event::RefreshResources { connections }) => {
return Poll::Ready(Ok(ClientEvent::RefreshResources { connections }))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could solve this with a little less boilerplate by implementing From:

Some(other) => {
	return Poll::Ready(Ok(ClientEvent::from(other)))
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that has a fallible codepath then. Nevermind.

@conectado conectado force-pushed the refactor/use-set-dns-instead-of-callback branch from 309375e to 56d7ded Compare March 21, 2024 01:12
Copy link
Member

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for extracting this into a separate PR!

@conectado conectado added this pull request to the merge queue Mar 21, 2024
Merged via the queue into main with commit 40f5fa3 Mar 21, 2024
138 checks passed
@conectado conectado deleted the refactor/use-set-dns-instead-of-callback branch March 21, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants