Skip to content

Commit

Permalink
Change trust-dns-resolver to hickory-resolver (#6164)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Oct 16, 2024
1 parent ef3ac44 commit fd6c0e2
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 57 deletions.
93 changes: 46 additions & 47 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ dependencies = [
"graphql_client",
"heck 0.5.0",
"hex",
"hickory-resolver",
"hmac",
"http 0.2.12",
"http-body 0.4.6",
Expand Down Expand Up @@ -382,7 +383,6 @@ dependencies = [
"tracing-serde",
"tracing-subscriber",
"tracing-test",
"trust-dns-resolver",
"uname",
"url",
"urlencoding",
Expand Down Expand Up @@ -3167,6 +3167,51 @@ dependencies = [
"serde",
]

[[package]]
name = "hickory-proto"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512"
dependencies = [
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.4.0",
"ipnet",
"once_cell",
"rand 0.8.5",
"thiserror",
"tinyvec",
"tokio",
"tracing",
"url",
]

[[package]]
name = "hickory-resolver"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243"
dependencies = [
"cfg-if",
"futures-util",
"hickory-proto",
"ipconfig",
"lru-cache",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"smallvec",
"thiserror",
"tokio",
"tracing",
]

[[package]]
name = "hmac"
version = "0.12.1"
Expand Down Expand Up @@ -6993,52 +7038,6 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "trust-dns-proto"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374"
dependencies = [
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.4.0",
"ipnet",
"once_cell",
"rand 0.8.5",
"smallvec",
"thiserror",
"tinyvec",
"tokio",
"tracing",
"url",
]

[[package]]
name = "trust-dns-resolver"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6"
dependencies = [
"cfg-if",
"futures-util",
"ipconfig",
"lru-cache",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"smallvec",
"thiserror",
"tokio",
"tracing",
"trust-dns-proto",
]

[[package]]
name = "try-lock"
version = "0.2.5"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ tracing = "0.1.40"
tracing-core = "0.1.32"
tracing-futures = { version = "0.2.5", features = ["futures-03"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
trust-dns-resolver = "0.23.2"
url = { version = "2.5.2", features = ["serde"] }
urlencoding = "2.1.3"
uuid = { version = "1.9.1", features = ["serde", "v4"] }
Expand All @@ -247,6 +246,7 @@ tokio-tungstenite = { version = "0.20.1", features = [
"rustls-tls-native-roots",
] }
tokio-rustls = "0.24.1"
hickory-resolver = "0.24.1"
http-serde = "1.1.3"
hmac = "0.12.1"
parking_lot = { version = "0.12.3", features = ["serde"] }
Expand Down
4 changes: 2 additions & 2 deletions apollo-router/src/plugins/coprocessor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ use crate::services::external::Externalizable;
use crate::services::external::PipelineStep;
use crate::services::external::DEFAULT_EXTERNALIZATION_TIMEOUT;
use crate::services::external::EXTERNALIZABLE_VERSION;
use crate::services::hickory_dns_connector::new_async_http_connector;
use crate::services::hickory_dns_connector::AsyncHyperResolver;
use crate::services::router;
use crate::services::router::body::get_body_bytes;
use crate::services::router::body::RouterBody;
use crate::services::router::body::RouterBodyConverter;
use crate::services::subgraph;
use crate::services::trust_dns_connector::new_async_http_connector;
use crate::services::trust_dns_connector::AsyncHyperResolver;

#[cfg(test)]
mod test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use std::pin::Pin;
use std::task::Context;
use std::task::Poll;

use hickory_resolver::TokioAsyncResolver;
use hyper::client::connect::dns::Name;
use hyper::client::HttpConnector;
use hyper::service::Service;
use trust_dns_resolver::TokioAsyncResolver;

/// Wrapper around trust-dns-resolver's
/// [`TokioAsyncResolver`](https://docs.rs/trust-dns-resolver/0.23.2/trust_dns_resolver/type.TokioAsyncResolver.html)
/// Wrapper around hickory-resolver's
/// [`TokioAsyncResolver`](https://docs.rs/hickory-resolver/latest/hickory_resolver/type.TokioAsyncResolver.html)
///
/// The resolver runs a background Task which manages dns requests. When a new resolver is created,
/// the background task is also created, it needs to be spawned on top of an executor before using the client,
Expand All @@ -22,7 +22,7 @@ pub(crate) struct AsyncHyperResolver(TokioAsyncResolver);

impl AsyncHyperResolver {
/// constructs a new resolver from default configuration, uses the corresponding method of
/// [`TokioAsyncResolver`](https://docs.rs/trust-dns-resolver/0.23.2/trust_dns_resolver/type.TokioAsyncResolver.html#method.new)
/// [`TokioAsyncResolver`](https://docs.rs/hickory-resolver/latest/hickory_resolver/type.TokioAsyncResolver.html)
pub(crate) fn new_from_system_conf() -> Result<Self, io::Error> {
let resolver = TokioAsyncResolver::tokio_from_system_conf()?;
Ok(Self(resolver))
Expand Down
4 changes: 2 additions & 2 deletions apollo-router/src/services/http/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ use crate::plugins::telemetry::reload::prepare_context;
use crate::plugins::telemetry::LOGGING_DISPLAY_BODY;
use crate::plugins::telemetry::LOGGING_DISPLAY_HEADERS;
use crate::plugins::traffic_shaping::Http2Config;
use crate::services::hickory_dns_connector::new_async_http_connector;
use crate::services::hickory_dns_connector::AsyncHyperResolver;
use crate::services::router::body::RouterBody;
use crate::services::trust_dns_connector::new_async_http_connector;
use crate::services::trust_dns_connector::AsyncHyperResolver;
use crate::Configuration;
use crate::Context;

Expand Down
2 changes: 1 addition & 1 deletion apollo-router/src/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub(crate) use crate::services::supergraph::Response as SupergraphResponse;

pub mod execution;
pub(crate) mod external;
pub(crate) mod hickory_dns_connector;
pub(crate) mod http;
pub(crate) mod layers;
pub(crate) mod new_service;
Expand All @@ -34,7 +35,6 @@ pub mod subgraph;
pub(crate) mod subgraph_service;
pub mod supergraph;
pub mod transport;
pub(crate) mod trust_dns_connector;

impl AsRef<Request> for http_ext::Request<Request> {
fn as_ref(&self) -> &Request {
Expand Down

0 comments on commit fd6c0e2

Please sign in to comment.