Skip to content

Commit

Permalink
upgrade trust-dns-resolver to hickory-resolver 0.24 (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Mar 9, 2024
1 parent 0150130 commit f7a4ed6
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 90 deletions.
152 changes: 75 additions & 77 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ figment = { version = "0.10.10", features = ["toml", "env"] }
futures-util = "0.3.28"
harness = { path = "crates/harness" }
harness_macros = { path = "crates/harness_macros" }
hickory-resolver = { version = "0.24.0", features = ["system-config"] }
humantime-serde = "1.1"
hyper = { version = "1.0.0-rc.4", features = ["full"] }
hyper-util = { git = "https://github.com/hyperium/hyper-util.git", rev = "f898015" }
Expand All @@ -35,7 +36,6 @@ tokio-tungstenite = "0.21.0"
tokio-util = "0.7.8"
tracing = "0.1.40"
tracing-subscriber = "0.3.17"
trust-dns-resolver = { version = "0.22.0", features = ["system-config"] }
tungstenite = "0.21.0"
typeshare = "1.0.0"
url = "2.3.1"
Expand Down
1 change: 0 additions & 1 deletion crates/ott-balancer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ route-recognizer = "0.3.1"
once_cell.workspace = true
pin-project.workspace = true
prometheus.workspace = true
trust-dns-resolver.workspace = true

[dev-dependencies]
criterion.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/ott-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
anyhow.workspace = true
async-trait.workspace = true
futures-util.workspace = true
hickory-resolver.workspace = true
hyper.workspace = true
hyper-util.workspace = true
http-body-util.workspace = true
Expand All @@ -20,6 +21,5 @@ tracing-subscriber.workspace = true
tokio.workspace = true
tokio-tungstenite.workspace = true
tokio-util.workspace = true
trust-dns-resolver.workspace = true
tungstenite.workspace = true
url.workspace = true
11 changes: 5 additions & 6 deletions crates/ott-common/src/discovery/dns.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use async_trait::async_trait;
use tracing::info;
use trust_dns_resolver::{
use hickory_resolver::{
config::{NameServerConfig, Protocol, ResolverConfig, ResolverOpts},
TokioAsyncResolver,
};
use tracing::info;

use super::*;

Expand Down Expand Up @@ -43,20 +43,19 @@ impl ServiceDiscoverer for DnsServiceDiscoverer {
resolver_config.add_name_server(NameServerConfig::new(server, Protocol::Udp));

TokioAsyncResolver::tokio(resolver_config, ResolverOpts::default())
.expect("failed to create resolver")
}
};

let lookup = resolver.ipv4_lookup(&self.config.query).await?;
let monoliths = lookup
let instances = lookup
.iter()
.map(|ip| ConnectionConfig {
host: HostOrIp::Ip(IpAddr::V4(*ip)),
host: HostOrIp::Ip(ip.0.into()),
port: self.config.service_port,
})
.collect::<Vec<_>>();

Ok(monoliths)
Ok(instances)
}

fn mode(&self) -> DiscoveryMode {
Expand Down
Loading

0 comments on commit f7a4ed6

Please sign in to comment.