-
Notifications
You must be signed in to change notification settings - Fork 270
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
b99e4eb
to
d0ade0c
Compare
Terraform Cloud Plan Output
|
There was a problem hiding this 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.
firezone_tunnel::ClientEvent::RefreshInterfance => { | ||
unreachable!("Handled internally"); | ||
} |
There was a problem hiding this comment.
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
#[test] | ||
fn dns_updated_when_dns_changes() { | ||
assert!(dns_updated( | ||
&["1.0.0.1".parse().unwrap()], |
There was a problem hiding this comment.
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.
} | ||
|
||
self.next_system_resolver_refresh = Some(now + std::time::Duration::from_millis(500)); | ||
self.system_resolvers = new_dns; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Performance Test ResultsTCP
UDP
|
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 })) | ||
} |
There was a problem hiding this comment.
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)))
}
There was a problem hiding this comment.
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.
309375e
to
56d7ded
Compare
There was a problem hiding this 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!
Extracted from #4163
Dependant PRs:
#4198
#4133
#4163