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(iroh-net): allow to set a custom DNS resolver on the magic endpoint #2116

Merged
merged 6 commits into from
Mar 23, 2024

Conversation

Frando
Copy link
Member

@Frando Frando commented Mar 22, 2024

Description

This makes the DNS resolver to be used in the context of a MagicEndpoint configurable. Up to now, we used a single, global, unconfigurable DNS resolver, stored in a per-process global static. This PR changes this so that we can set a DNS resolver in the builder of the MagicEndpoint. This resolver is passed through to all places where we need a DNS resolver - which is all places where we need to resolve relay URLs.

The default is unchanged: A single, shared DNS resolver is used for all endpoints. However, this default can now be changed per-endpoint. The global resolver is only used as a default in the endpoint builder if no custom resolver is set, and in the doctor, and in tests.

This change will make testing things that use DNS - prominently: #2045 - much easier. And we now have the means in place for people to customize the DNS resolving, if needed.

Notes & open questions

This makes the hickory_resolver::TokioAsyncResolver part of the public API surface of iroh-net.

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@Frando Frando added this pull request to the merge queue Mar 23, 2024
Merged via the queue into main with commit 8dcb196 Mar 23, 2024
20 checks passed
@dignifiedquire dignifiedquire deleted the refactor/dns-resolver branch March 23, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants