diff --git a/tokio-xmpp/Cargo.toml b/tokio-xmpp/Cargo.toml index 02a2232b..c8359172 100644 --- a/tokio-xmpp/Cargo.toml +++ b/tokio-xmpp/Cargo.toml @@ -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 } diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index 63020a6d..57bceae6 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -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 ``. + * Changed: + - Update hickory-dns to 0.26 (!671) Version 5.0.0: 2025-10-28 pep diff --git a/tokio-xmpp/src/connect/dns.rs b/tokio-xmpp/src/connect/dns.rs index c1cd796b..716ce714 100644 --- a/tokio-xmpp/src/connect/dns.rs +++ b/tokio-xmpp/src/connect/dns.rs @@ -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 diff --git a/tokio-xmpp/src/error.rs b/tokio-xmpp/src/error.rs index 6d68c7b6..c0cd7043 100644 --- a/tokio-xmpp/src/error.rs +++ b/tokio-xmpp/src/error.rs @@ -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")]