diff --git a/Cargo.lock b/Cargo.lock index 9a89e9fac..6fd9498e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,6 +234,28 @@ dependencies = [ "uuid", ] +[[package]] +name = "bson" +version = "2.15.0" +source = "git+https://github.com/mongodb/bson-rust?branch=2.15.x#f6f163095b5159ce175424b0e02f9bd7acfaddf2" +dependencies = [ + "ahash", + "base64 0.22.1", + "bitvec", + "getrandom 0.2.16", + "getrandom 0.3.2", + "hex", + "indexmap 2.9.0", + "js-sys", + "once_cell", + "rand 0.9.1", + "serde", + "serde_bytes", + "serde_json", + "time", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -1508,7 +1530,7 @@ name = "mongocrypt" version = "0.2.1" source = "git+https://github.com/mongodb/libmongocrypt-rust.git?branch=main#c333ab07e36f72ac3a4fd8c9f1ff96a98e60ea3e" dependencies = [ - "bson", + "bson 2.14.0", "mongocrypt-sys", "once_cell", "serde", @@ -1529,7 +1551,7 @@ dependencies = [ "backtrace", "base64 0.13.1", "bitflags 1.3.2", - "bson", + "bson 2.15.0", "chrono", "ctrlc", "derive-where", diff --git a/Cargo.toml b/Cargo.toml index b612f8998..919f954cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ tracing-unstable = ["dep:tracing", "dep:log"] async-trait = "0.1.42" base64 = "0.13.0" bitflags = "1.1.0" -bson = { git = "https://github.com/mongodb/bson-rust", branch = "main", version = "2.14.0" } +bson = { git = "https://github.com/mongodb/bson-rust", branch = "2.15.x", version = "2.14.0" } chrono = { version = "0.4.7", default-features = false, features = [ "clock", "std", diff --git a/src/error.rs b/src/error.rs index effb28369..77bcaec1d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -290,6 +290,14 @@ impl Error { .into() } + #[cfg(feature = "dns-resolver")] + pub(crate) fn from_resolve_proto_error(error: hickory_proto::error::ProtoError) -> Self { + ErrorKind::DnsResolve { + message: error.to_string(), + } + .into() + } + pub(crate) fn is_non_timeout_network_error(&self) -> bool { matches!(self.kind.as_ref(), ErrorKind::Io(ref io_err) if io_err.kind() != std::io::ErrorKind::TimedOut) } diff --git a/src/runtime/resolver.rs b/src/runtime/resolver.rs index c67acb113..bd75a9d09 100644 --- a/src/runtime/resolver.rs +++ b/src/runtime/resolver.rs @@ -2,7 +2,7 @@ use hickory_resolver::{ config::ResolverConfig, error::ResolveErrorKind, lookup::{SrvLookup, TxtLookup}, - IntoName, + Name, }; use crate::error::{Error, Result}; @@ -25,17 +25,19 @@ impl AsyncResolver { } impl AsyncResolver { - pub async fn srv_lookup(&self, query: N) -> Result { + pub async fn srv_lookup(&self, query: &str) -> Result { + let name = Name::from_str_relaxed(query).map_err(Error::from_resolve_proto_error)?; let lookup = self .resolver - .srv_lookup(query) + .srv_lookup(name) .await .map_err(Error::from_resolve_error)?; Ok(lookup) } - pub async fn txt_lookup(&self, query: N) -> Result> { - let lookup_result = self.resolver.txt_lookup(query).await; + pub async fn txt_lookup(&self, query: &str) -> Result> { + let name = Name::from_str_relaxed(query).map_err(Error::from_resolve_proto_error)?; + let lookup_result = self.resolver.txt_lookup(name).await; match lookup_result { Ok(lookup) => Ok(Some(lookup)), Err(e) => match e.kind() {