tokio-xmpp: update hickory-dns to 0.26

This commit is contained in:
famfo 2026-05-14 20:45:37 +02:00
commit 697d4d3bef
No known key found for this signature in database
4 changed files with 19 additions and 12 deletions

View file

@ -30,7 +30,7 @@ xmpp-parsers = { version = "0.22", path = "../parsers", features = [ "log" ] }
xso = { version = "0.3", path = "../xso" }
# these are only needed for starttls ServerConnector support
hickory-resolver = { version = "0.25", optional = true}
hickory-resolver = { version = "0.26", optional = true}
idna = { version = "1.0", optional = true}
native-tls = { version = "0.2", optional = true }
tokio-native-tls = { version = "0.3", optional = true }

View file

@ -16,6 +16,8 @@ Version NEXT:
tokio-xmpp's `IqResponseTracker`.
- Actually count inbound stream management stanzas (!657) instead of
always sending h='0' in our `<a/>`.
* Changed:
- Update hickory-dns to 0.26 (!671)
Version 5.0.0:
2025-10-28 pep <pep@bouah.net>

View file

@ -2,7 +2,9 @@ use core::{fmt, net::SocketAddr};
#[cfg(feature = "dns")]
use futures::{future::select_ok, FutureExt};
#[cfg(feature = "dns")]
use hickory_resolver::{config::LookupIpStrategy, IntoName, TokioResolver};
use hickory_resolver::{
config::LookupIpStrategy, proto::rr::IntoName, proto::rr::RData, TokioResolver,
};
#[cfg(feature = "dns")]
use log::debug;
use tokio::net::TcpStream;
@ -131,7 +133,7 @@ impl DnsConfig {
let (_config, options) = hickory_resolver::system_conf::read_system_conf()?;
let resolver = TokioResolver::builder_tokio()?
.with_options(options)
.build();
.build()?;
let srv_domain = format!("{}.{}.", srv, ascii_domain).into_name()?;
let srv_records = resolver.srv_lookup(srv_domain.clone()).await.ok();
@ -139,10 +141,13 @@ impl DnsConfig {
match srv_records {
Some(lookup) => {
// TODO: sort lookup records by priority/weight
for srv in lookup.iter() {
for record in lookup.answers().iter() {
let RData::SRV(ref srv) = record.data else {
continue;
};
debug!("Attempting connection to {srv_domain} {srv}");
if let Ok(stream) =
Self::resolve_no_srv(&srv.target().to_ascii(), srv.port()).await
if let Ok(stream) = Self::resolve_no_srv(&srv.target.to_ascii(), srv.port).await
{
return Ok(stream);
}
@ -169,14 +174,14 @@ impl DnsConfig {
options.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
let resolver = TokioResolver::builder_tokio()?
.with_options(options)
.build();
.build()?;
let ips = resolver.lookup_ip(ascii_domain).await?;
// Happy Eyeballs: connect to all records in parallel, return the
// first to succeed
select_ok(
ips.into_iter()
ips.iter()
.map(|ip| TcpStream::connect(SocketAddr::new(ip, port)).boxed()),
)
.await

View file

@ -1,6 +1,6 @@
use core::{fmt, net::AddrParseError, str::Utf8Error};
#[cfg(feature = "dns")]
use hickory_resolver::{proto::ProtoError as DnsProtoError, ResolveError as DnsResolveError};
use hickory_resolver::{net::NetError as DnsNetError, proto::ProtoError as DnsProtoError};
use sasl::client::MechanismError as SaslMechanismError;
use std::io;
use thiserror::Error;
@ -45,11 +45,11 @@ pub enum Error {
/// DNS protocol error
#[cfg(feature = "dns")]
#[error("{0:?}")]
Dns(#[from] DnsProtoError),
/// DNS resolution error
DnsProto(#[from] DnsProtoError),
/// DNS network error
#[cfg(feature = "dns")]
#[error("{0:?}")]
Resolve(#[from] DnsResolveError),
DnsNet(#[from] DnsNetError),
/// DNS label conversion error, no details available from module
/// `idna`
#[cfg(feature = "dns")]