mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[PR #1938] [MERGED] Provider API Redesign #2707
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#2707
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/1938
Author: @XOR-op
Created: 5/20/2023
Status: ✅ Merged
Merged: 6/6/2023
Merged by: @bluejekyll
Base:
main← Head:provider-api📝 Commits (9)
e1f142echore: rename {Abstract} backb33c8cbfeat: new ConnectionProvider API1133348feat(WIP): change relevant typesd2743f9test(WIP): fix integration teste68b4bdfix(WIP): improper use with featurese07ba0dfix: improper use with features918ea4echore: remove unused CreateConnection182e58fchore: fix clippy1f44e8cfix: error in rebase📊 Changes
22 files changed (+437 additions, -344 deletions)
View changed files
📝
crates/async-std-resolver/src/lib.rs(+4 -5)📝
crates/async-std-resolver/src/runtime.rs(+39 -2)📝
crates/async-std-resolver/src/tests.rs(+80 -47)📝
crates/recursor/src/recursor.rs(+6 -4)📝
crates/recursor/src/recursor_pool.rs(+3 -3)📝
crates/resolver/examples/custom_provider.rs(+4 -4)📝
crates/resolver/examples/flush_cache.rs(+3 -4)📝
crates/resolver/examples/global_resolver.rs(+3 -2)📝
crates/resolver/examples/multithreaded_runtime.rs(+2 -3)📝
crates/resolver/src/async_resolver.rs(+81 -75)📝
crates/resolver/src/https.rs(+2 -2)📝
crates/resolver/src/lookup.rs(+3 -3)📝
crates/resolver/src/name_server/connection_provider.rs(+56 -14)📝
crates/resolver/src/name_server/mod.rs(+7 -5)📝
crates/resolver/src/name_server/name_server.rs(+42 -64)📝
crates/resolver/src/name_server/name_server_pool.rs(+54 -54)📝
crates/resolver/src/resolver.rs(+4 -3)📝
crates/resolver/src/tls/mod.rs(+2 -2)📝
crates/server/src/store/forwarder/authority.rs(+3 -3)📝
crates/server/tests/forwarder.rs(+3 -3)...and 2 more files
📄 Description
In the later discussion of #1876, @jeff-hiner argues that the current Provider API doesn't offer a convenient way to statefully create
DnsHandle. This PR redesigns the Provider API.This PR replaces the original
CreateConnectiontrait with the new factory traitConnectionProvider, allowing stateful connection creation. Now we have two layers of customization,ConnectionProviderandRuntimeProvider. TheRuntimeProvideris a factory to create TCP or UDP connections, as well as runtime-specific timer. TheConnectionProvideris a factory to create aDnsHandlewith the help ofRuntimeProvider.If a user wants to override the default networking behavior, he/she can simply implement a new
RuntimeProvider, without the need of re-implementing theGenericConnectioninternal logic. If a user wants to override the upper logic of aDnsHandle, for example add an auth field to the HTTP header, he/she can just implement a newConnectionProviderand reuse currentRuntimeProvider(It's also possible not to use a connection provided byRuntimeProvider, as long as the user insists).Currently, the default handle is
GenericConnectionand the default connection provider isGenericProvider.This PR also clarifies the usage of Provider API. The original comment in 0.22 as well as #1876 is kind of misleading.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.