-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Substitute DNS Resolver #1517
Comments
The I've seen others ask to replace the resolve in I'd be open to working this out, though! |
I'd follow this issue and maybe even help: Would be pretty nice to just use Tokio's DNS resolver in Hyper when it's ready. There are some unofficial crates to use in your custom connector that should not be that hard to add to your stack, e.g: |
Ah okay great, forget about the I think thinking about a stable trait design is a fair point and might be more involved than I expected given the wide range of use-cases However, if a trait-bound on let work = dns::Work::new(host, port);
state = State::Resolving(oneshot::spawn(work, executor)); The input on some hypothetical resolve function would be: Okay, but maybe that's not the end goal, what other possible use cases might be brought up?
Let me know if I'm missing anything, or if you're worried about any other use-cases! The only thing I can see is possibly supporting a generic Anyways I think an initial step is for me to duplicate the HttpConnector and add in DNS substitution. That way I can continue without being blocked and if supporting a larger scope is required it can be prototyped outside of Hyper without requiring releases for the crate as a whole. If no larger scope is required though, it would be good to get the trait bound merged in! |
If we already had an I think it'd be reasonable to try to include a trait Resolve {
type Future: Future<Item=Self::Addrs, Error=io::Error>;
type Addrs: Iterator<Item=SocketAddr>;
fn resolve(&self, host: &str, port: u16) -> Self::Future;
} Does it make sense to include a port as input? Or should the |
Didn't see your reply @pimeys, thanks for the links! I'll definitely keep an eye on tokio-dns, and would be happy to wait for it if that's the right solution. @seanmonstar: Ah, yeah oops, that would not be necessary :P. Does Ah, okay, I'm looking at the 0.11 branch, on Good point with the port:
Given the API for these crates, I would lean towards avoiding passing in the port and have the future return trait Resolve {
type Future: Future<Item=Self::Addrs, Error=io::Error>;
type Addrs: Iterator<Item=IpAddr>;
fn resolve(&self, host: &str) -> Self::Future;
} Let me know what you think! |
As an update on this, I've created a duplicate of Both implementations would match the latest proposed trait without any problems 👍. |
Great! How does the generic on I've wanted to be able to change out the default resolver for trust-dns for a while, and besides wanting to wait for it to be as reliable as Basically, it could be similar to I'll be of limited availability for the next week, but I'd welcome this change for the 0.12 release if someone would like to make a PR! |
This may slip out of 0.12, as it isn't high on my priorities, and I'd like to release this week. |
Oh, sorry for ignoring this thread! Happy to contribute a PR once we're satisfied with the code, we're still on 0.11 so it would require some changes to work with 0.12. |
This introduces a `Resolve` trait to describe asynchronous DNS resolution. The `HttpConnector` can be configured with a resolver, allowing a user to still use all the functionality of the `HttpConnector`, while customizing the DNS resolution. To prevent a breaking change, the `HttpConnector` has its `Resolve` generic set by default to `GaiResolver`. This is same as the existing resolver, which uses `getaddrinfo` inside a thread pool. Closes #1517
This introduces a `Resolve` trait to describe asynchronous DNS resolution. The `HttpConnector` can be configured with a resolver, allowing a user to still use all the functionality of the `HttpConnector`, while customizing the DNS resolution. To prevent a breaking change, the `HttpConnector` has its `Resolve` generic set by default to `GaiResolver`. This is same as the existing resolver, which uses `getaddrinfo` inside a thread pool. Closes #1517
I got around to fleshing this out in #1674. |
This introduces a `Resolve` trait to describe asynchronous DNS resolution. The `HttpConnector` can be configured with a resolver, allowing a user to still use all the functionality of the `HttpConnector`, while customizing the DNS resolution. To prevent a breaking change, the `HttpConnector` has its `Resolve` generic set by default to `GaiResolver`. This is same as the existing resolver, which uses `getaddrinfo` inside a thread pool. Closes #1517
This introduces a `Resolve` trait to describe asynchronous DNS resolution. The `HttpConnector` can be configured with a resolver, allowing a user to still use all the functionality of the `HttpConnector`, while customizing the DNS resolution. To prevent a breaking change, the `HttpConnector` has its `Resolve` generic set by default to `GaiResolver`. This is same as the existing resolver, which uses `getaddrinfo` inside a thread pool. Closes #1517
This introduces a `Resolve` trait to describe asynchronous DNS resolution. The `HttpConnector` can be configured with a resolver, allowing a user to still use all the functionality of the `HttpConnector`, while customizing the DNS resolution. To prevent a breaking change, the `HttpConnector` has its `Resolve` generic set by default to `GaiResolver`. This is same as the existing resolver, which uses `getaddrinfo` inside a thread pool. Closes #1517
This relates to #1174.
It would be great if we could substitute a resolver instead of using
to_socket_addrs
andgetaddrinfo
. It seems there was already a good amount of discussion around this in #1174, but I'm not sure what the conclusion was.It seems like there are three options:
Connect
instead of HttpConnectorClientProto
(?). I admit I'm not sure what this actually means for end-users.Honestly I think 2) makes a lot of sense because we get to avoid any duplication and maintenance efforts to keep a custom connector up-to-date / bug-free with HttpConnector. But again, I'm not sure if 3) is better?
Context for this is: we're trying to update from an old fork of hyper and had previously swapped out the resolver in the fork :).
@seanmonstar thoughts?
The text was updated successfully, but these errors were encountered: