Skip to content

feat: Support custom DNS resolver#728

Open
kdn36 wants to merge 2 commits into
apache:mainfrom
kdn36:feat_with_dns_resolver
Open

feat: Support custom DNS resolver#728
kdn36 wants to merge 2 commits into
apache:mainfrom
kdn36:feat_with_dns_resolver

Conversation

@kdn36

@kdn36 kdn36 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Mitigates but does not close #726.

Rationale for this change

This PR enables users of object_store to provide a custom DNS resolver. Use case: the custom DNS resolver may have different properties (e.g., caching), and a different footprint (e.g., substantially smaller) than the default options.

What changes are included in this PR?

Enables override of the DNS resolver as used by the reqwest::HttpClient.

Are there any user-facing changes?

Yes. This PR adds ClientOptions::with_dns_resolver(Arc<dyn reqwest::dns::Resolve>).

@tustvold tustvold left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is probably fine, but generally we have tried to keep reqwest types out of our public API, especially in light of things like #724, and the fact we now support pluggable HTTP clients. The fact reqwest now has a resolve2 method, also doesn't really bode well for this API's stability longer-term 😅 It appears to have just been the legacy hyper API repackaged.

What do you think about defining our own resolve trait?

@alamb

alamb commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Can someone help me out -- is it possible to use a custom DNS resolver with a custom https://docs.rs/object_store/latest/object_store/client/trait.HttpConnector.html and wrapper around another client?

@alamb
alamb marked this pull request as draft June 17, 2026 19:38
@alamb

alamb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Marking as draft as I think this PR is no longer waiting on feedback and I am trying to make it easier to find PRs in need of review. Please mark it as ready for review when it is ready for another look

@kdn36

kdn36 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Apologies for the delay.

The custom client HttpConnector trait has the connect(&self, options: &ClientOptions) method, yet the fields of ClientOptions are not public. So to implement the trait and honor the options (which object_store may set or modify), one would have to extract them one by one and reapply. Technically not impossible, but error-prone and difficult to maintain. Unless I am missing something.

Object_store having its own Resolve trait (details to be worked out) should be viable and would enable object_store not to leak implementation details. This is something I can look into. At first glance, this would be the cleanest way forward for our use case.

Fwiw, the code in the PR is in use already with a lightweight shuffling cache and works as expected.

@kdn36

kdn36 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

The latest commit introduces a local DnsResolver trait, which gets mapped to the reqwest::Resolve trait for the built-in reqwest-based path.

The proposed implementation has been validated end-to-end from our client-side library. Kindly review and let me know any needed changes.

@kdn36
kdn36 marked this pull request as ready for review July 6, 2026 19:08
@kdn36
kdn36 requested a review from tustvold July 17, 2026 10:28
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.

Lightweight DNS cache with shuffle to prevent DNS flooding

3 participants