tokio-xmpp: update hickory-dns to 0.26
This commit is contained in:
parent
3d38a54389
commit
697d4d3bef
4 changed files with 19 additions and 12 deletions
|
|
@ -30,7 +30,7 @@ xmpp-parsers = { version = "0.22", path = "../parsers", features = [ "log" ] }
|
||||||
xso = { version = "0.3", path = "../xso" }
|
xso = { version = "0.3", path = "../xso" }
|
||||||
|
|
||||||
# these are only needed for starttls ServerConnector support
|
# 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}
|
idna = { version = "1.0", optional = true}
|
||||||
native-tls = { version = "0.2", optional = true }
|
native-tls = { version = "0.2", optional = true }
|
||||||
tokio-native-tls = { version = "0.3", optional = true }
|
tokio-native-tls = { version = "0.3", optional = true }
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ Version NEXT:
|
||||||
tokio-xmpp's `IqResponseTracker`.
|
tokio-xmpp's `IqResponseTracker`.
|
||||||
- Actually count inbound stream management stanzas (!657) instead of
|
- Actually count inbound stream management stanzas (!657) instead of
|
||||||
always sending h='0' in our `<a/>`.
|
always sending h='0' in our `<a/>`.
|
||||||
|
* Changed:
|
||||||
|
- Update hickory-dns to 0.26 (!671)
|
||||||
|
|
||||||
Version 5.0.0:
|
Version 5.0.0:
|
||||||
2025-10-28 pep <pep@bouah.net>
|
2025-10-28 pep <pep@bouah.net>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ use core::{fmt, net::SocketAddr};
|
||||||
#[cfg(feature = "dns")]
|
#[cfg(feature = "dns")]
|
||||||
use futures::{future::select_ok, FutureExt};
|
use futures::{future::select_ok, FutureExt};
|
||||||
#[cfg(feature = "dns")]
|
#[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")]
|
#[cfg(feature = "dns")]
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
|
@ -131,7 +133,7 @@ impl DnsConfig {
|
||||||
let (_config, options) = hickory_resolver::system_conf::read_system_conf()?;
|
let (_config, options) = hickory_resolver::system_conf::read_system_conf()?;
|
||||||
let resolver = TokioResolver::builder_tokio()?
|
let resolver = TokioResolver::builder_tokio()?
|
||||||
.with_options(options)
|
.with_options(options)
|
||||||
.build();
|
.build()?;
|
||||||
|
|
||||||
let srv_domain = format!("{}.{}.", srv, ascii_domain).into_name()?;
|
let srv_domain = format!("{}.{}.", srv, ascii_domain).into_name()?;
|
||||||
let srv_records = resolver.srv_lookup(srv_domain.clone()).await.ok();
|
let srv_records = resolver.srv_lookup(srv_domain.clone()).await.ok();
|
||||||
|
|
@ -139,10 +141,13 @@ impl DnsConfig {
|
||||||
match srv_records {
|
match srv_records {
|
||||||
Some(lookup) => {
|
Some(lookup) => {
|
||||||
// TODO: sort lookup records by priority/weight
|
// 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}");
|
debug!("Attempting connection to {srv_domain} {srv}");
|
||||||
if let Ok(stream) =
|
if let Ok(stream) = Self::resolve_no_srv(&srv.target.to_ascii(), srv.port).await
|
||||||
Self::resolve_no_srv(&srv.target().to_ascii(), srv.port()).await
|
|
||||||
{
|
{
|
||||||
return Ok(stream);
|
return Ok(stream);
|
||||||
}
|
}
|
||||||
|
|
@ -169,14 +174,14 @@ impl DnsConfig {
|
||||||
options.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
|
options.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
|
||||||
let resolver = TokioResolver::builder_tokio()?
|
let resolver = TokioResolver::builder_tokio()?
|
||||||
.with_options(options)
|
.with_options(options)
|
||||||
.build();
|
.build()?;
|
||||||
|
|
||||||
let ips = resolver.lookup_ip(ascii_domain).await?;
|
let ips = resolver.lookup_ip(ascii_domain).await?;
|
||||||
|
|
||||||
// Happy Eyeballs: connect to all records in parallel, return the
|
// Happy Eyeballs: connect to all records in parallel, return the
|
||||||
// first to succeed
|
// first to succeed
|
||||||
select_ok(
|
select_ok(
|
||||||
ips.into_iter()
|
ips.iter()
|
||||||
.map(|ip| TcpStream::connect(SocketAddr::new(ip, port)).boxed()),
|
.map(|ip| TcpStream::connect(SocketAddr::new(ip, port)).boxed()),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use core::{fmt, net::AddrParseError, str::Utf8Error};
|
use core::{fmt, net::AddrParseError, str::Utf8Error};
|
||||||
#[cfg(feature = "dns")]
|
#[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 sasl::client::MechanismError as SaslMechanismError;
|
||||||
use std::io;
|
use std::io;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
@ -45,11 +45,11 @@ pub enum Error {
|
||||||
/// DNS protocol error
|
/// DNS protocol error
|
||||||
#[cfg(feature = "dns")]
|
#[cfg(feature = "dns")]
|
||||||
#[error("{0:?}")]
|
#[error("{0:?}")]
|
||||||
Dns(#[from] DnsProtoError),
|
DnsProto(#[from] DnsProtoError),
|
||||||
/// DNS resolution error
|
/// DNS network error
|
||||||
#[cfg(feature = "dns")]
|
#[cfg(feature = "dns")]
|
||||||
#[error("{0:?}")]
|
#[error("{0:?}")]
|
||||||
Resolve(#[from] DnsResolveError),
|
DnsNet(#[from] DnsNetError),
|
||||||
/// DNS label conversion error, no details available from module
|
/// DNS label conversion error, no details available from module
|
||||||
/// `idna`
|
/// `idna`
|
||||||
#[cfg(feature = "dns")]
|
#[cfg(feature = "dns")]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue