diff --git a/Cargo.lock b/Cargo.lock index e9ca3591d0..eeac8bdfc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,6 +284,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -806,6 +817,7 @@ dependencies = [ "file_test_runner", "flaky_test", "hickory-client", + "hickory-proto", "hickory-server", "http 1.1.0", "http-body-util", @@ -1293,7 +1305,7 @@ dependencies = [ "test_server", "text-size", "text_lines", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tokio-util", "tracing", @@ -1380,7 +1392,7 @@ version = "0.174.0" dependencies = [ "async-trait", "deno_core", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "uuid", ] @@ -1394,7 +1406,7 @@ dependencies = [ "rusqlite", "serde", "sha2", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", ] @@ -1426,7 +1438,7 @@ dependencies = [ "deno_webgpu", "image", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", ] [[package]] @@ -1510,7 +1522,7 @@ dependencies = [ "chrono", "deno_core", "saffron", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", ] @@ -1545,7 +1557,7 @@ dependencies = [ "sha2", "signature", "spki", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "uuid", "x25519-dalek", @@ -1627,7 +1639,7 @@ dependencies = [ "rustls-webpki", "serde", "serde_json", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tokio-rustls", "tokio-socks", @@ -1652,7 +1664,7 @@ dependencies = [ "serde", "serde-value", "serde_json", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "winapi", ] @@ -1675,7 +1687,7 @@ dependencies = [ "rand", "rayon", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "winapi", "windows-sys 0.59.0", ] @@ -1744,7 +1756,7 @@ dependencies = [ "scopeguard", "serde", "smallvec", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tokio-util", ] @@ -1798,7 +1810,7 @@ dependencies = [ "rand", "rusqlite", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "url", ] @@ -1854,7 +1866,7 @@ dependencies = [ "libuv-sys-lite", "log", "napi_sym", - "thiserror 1.0.64", + "thiserror 2.0.3", "windows-sys 0.59.0", ] @@ -1884,7 +1896,7 @@ dependencies = [ "rustls-tokio-stream", "serde", "socket2", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", ] @@ -1929,7 +1941,7 @@ dependencies = [ "http-body-util", "hyper 1.4.1", "hyper-util", - "idna 1.0.3", + "idna", "indexmap 2.3.0", "ipnetwork", "k256", @@ -1968,7 +1980,7 @@ dependencies = [ "sm3", "spki", "stable_deref_trait", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tokio-eld", "url", @@ -2024,7 +2036,7 @@ dependencies = [ "serde_json", "tar", "tempfile", - "thiserror 1.0.64", + "thiserror 2.0.3", "url", ] @@ -2084,7 +2096,7 @@ dependencies = [ "once_cell", "percent-encoding", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "which 4.4.2", "winapi", ] @@ -2104,7 +2116,7 @@ dependencies = [ "deno_semver", "node_resolver", "test_server", - "thiserror 1.0.64", + "thiserror 2.0.3", "url", ] @@ -2167,7 +2179,7 @@ dependencies = [ "signal-hook-registry", "tempfile", "test_server", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tokio-metrics", "twox-hash", @@ -2261,7 +2273,7 @@ dependencies = [ "rustls-tokio-stream", "rustls-webpki", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "webpki-roots", ] @@ -2308,7 +2320,7 @@ dependencies = [ "deno_console", "deno_core", "deno_webidl", - "thiserror 1.0.64", + "thiserror 2.0.3", "urlpattern", ] @@ -2329,7 +2341,7 @@ dependencies = [ "flate2", "futures", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "uuid", ] @@ -2341,7 +2353,7 @@ dependencies = [ "deno_core", "raw-window-handle", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "wgpu-core", "wgpu-types", @@ -2373,7 +2385,7 @@ dependencies = [ "once_cell", "rustls-tokio-stream", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", ] @@ -2384,7 +2396,7 @@ dependencies = [ "deno_core", "deno_web", "rusqlite", - "thiserror 1.0.64", + "thiserror 2.0.3", ] [[package]] @@ -3698,9 +3710,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] name = "hickory-client" -version = "0.24.1" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab9683b08d8f8957a857b0236455d80e1886eaa8c6178af556aa7871fb61b55" +checksum = "83536dab9a159b2b5cf2c20c47ecf188cee35316f96be028e63e8e1340d2724d" dependencies = [ "cfg-if", "data-encoding", @@ -3710,17 +3722,18 @@ dependencies = [ "once_cell", "radix_trie", "rand", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tracing", ] [[package]] name = "hickory-proto" -version = "0.24.1" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7" dependencies = [ + "async-recursion", "async-trait", "cfg-if", "data-encoding", @@ -3728,12 +3741,12 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.4.0", + "idna", "ipnet", "once_cell", "rand", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "tinyvec", "tokio", "tracing", @@ -3742,40 +3755,43 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.24.1" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" +checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27" dependencies = [ "cfg-if", "futures-util", "hickory-proto", "ipconfig", - "lru-cache", + "moka", "once_cell", "parking_lot", "rand", "resolv-conf", "serde", "smallvec", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "tracing", ] [[package]] name = "hickory-server" -version = "0.24.1" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be0e43c556b9b3fdb6c7c71a9a32153a2275d02419e3de809e520bfcfe40c37" +checksum = "aa7154e905d5c8a79c15427881e479b2ba749c55412804f0dc87723a531e45bd" dependencies = [ "async-trait", "bytes", "cfg-if", + "data-encoding", "enum-as-inner", "futures-util", "hickory-proto", + "ipnet", + "prefix-trie", "serde", - "thiserror 1.0.64", + "thiserror 2.0.3", "time", "tokio", "tokio-util", @@ -4137,16 +4153,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -4287,6 +4293,9 @@ name = "ipnet" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +dependencies = [ + "serde", +] [[package]] name = "ipnetwork" @@ -4625,12 +4634,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -4668,15 +4671,6 @@ dependencies = [ "serde", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "lsp-types" version = "0.97.0" @@ -4841,6 +4835,26 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "moka" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "once_cell", + "parking_lot", + "quanta", + "rustc_version 0.4.0", + "smallvec", + "tagptr", + "thiserror 1.0.64", + "triomphe", + "uuid", +] + [[package]] name = "monch" version = "0.5.0" @@ -4961,7 +4975,7 @@ dependencies = [ "path-clean", "regex", "serde_json", - "thiserror 1.0.64", + "thiserror 2.0.3", "tokio", "url", ] @@ -5120,9 +5134,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opaque-debug" @@ -5617,6 +5631,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prefix-trie" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4defc8f5ac7522968431b7592a34432215d80cceb1cf7e0c06287087bca4f046" +dependencies = [ + "ipnet", + "num-traits", +] + [[package]] name = "pretty_assertions" version = "1.4.0" @@ -5812,6 +5836,21 @@ dependencies = [ "unicase", ] +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi", + "web-sys", + "winapi", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -5976,6 +6015,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" +[[package]] +name = "raw-cpuid" +version = "11.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "raw-window-handle" version = "0.6.1" @@ -7509,6 +7557,12 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tap" version = "1.0.1" @@ -8083,12 +8137,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-id" version = "0.3.4" @@ -8163,7 +8211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 713b3ed1f5..5d60eb0d7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,7 +133,7 @@ fs3 = "0.5.0" futures = "0.3.21" glob = "0.3.1" h2 = "0.4.4" -hickory-resolver = { version = "0.24", features = ["tokio-runtime", "serde-config"] } +hickory-resolver = { version = "0.25.0-alpha.4", features = ["tokio-runtime", "serde"] } http = "1.0" http-body = "1.0" http-body-util = "0.1.2" @@ -194,7 +194,7 @@ spki = "0.7.2" tar = "=0.4.40" tempfile = "3.4.0" termcolor = "1.1.3" -thiserror = "1.0.61" +thiserror = "2.0.3" tokio = { version = "1.36.0", features = ["full"] } tokio-metrics = { version = "0.3.0", features = ["rt"] } tokio-rustls = { version = "0.26.0", default-features = false, features = ["ring", "tls12"] } diff --git a/ext/fetch/dns.rs b/ext/fetch/dns.rs index 9e21a4c342..fdde4e17bb 100644 --- a/ext/fetch/dns.rs +++ b/ext/fetch/dns.rs @@ -7,10 +7,7 @@ use std::task::Poll; use std::task::{self}; use std::vec; -use hickory_resolver::error::ResolveError; -use hickory_resolver::name_server::GenericConnector; -use hickory_resolver::name_server::TokioRuntimeProvider; -use hickory_resolver::AsyncResolver; +use hickory_resolver::name_server::TokioConnectionProvider; use hyper_util::client::legacy::connect::dns::GaiResolver; use hyper_util::client::legacy::connect::dns::Name; use tokio::task::JoinHandle; @@ -21,7 +18,7 @@ pub enum Resolver { /// A resolver using blocking `getaddrinfo` calls in a threadpool. Gai(GaiResolver), /// hickory-resolver's userspace resolver. - Hickory(AsyncResolver>), + Hickory(hickory_resolver::Resolver), } impl Default for Resolver { @@ -36,14 +33,14 @@ impl Resolver { } /// Create a [`AsyncResolver`] from system conf. - pub fn hickory() -> Result { + pub fn hickory() -> Result { Ok(Self::Hickory( - hickory_resolver::AsyncResolver::tokio_from_system_conf()?, + hickory_resolver::Resolver::tokio_from_system_conf()?, )) } - pub fn hickory_from_async_resolver( - resolver: AsyncResolver>, + pub fn hickory_from_resolver( + resolver: hickory_resolver::Resolver, ) -> Self { Self::Hickory(resolver) } diff --git a/ext/fetch/tests.rs b/ext/fetch/tests.rs index e053c6b1cf..3da29f8aa7 100644 --- a/ext/fetch/tests.rs +++ b/ext/fetch/tests.rs @@ -41,7 +41,7 @@ fn test_userspace_resolver() { // use `localhost` to ensure dns step happens. let addr = format!("localhost:{}", src_addr.port()); - let hickory = hickory_resolver::AsyncResolver::tokio( + let hickory = hickory_resolver::Resolver::tokio( Default::default(), Default::default(), ); @@ -52,7 +52,7 @@ fn test_userspace_resolver() { addr.clone(), "https", http::Version::HTTP_2, - dns::Resolver::hickory_from_async_resolver(hickory), + dns::Resolver::hickory_from_resolver(hickory), ) .await; assert_eq!(thread_counter.load(SeqCst), 0, "userspace resolver shouldn't spawn new threads."); diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml index 401ce08ff4..cfdd151f3b 100644 --- a/ext/net/Cargo.toml +++ b/ext/net/Cargo.toml @@ -17,7 +17,7 @@ path = "lib.rs" deno_core.workspace = true deno_permissions.workspace = true deno_tls.workspace = true -hickory-proto = "0.24" +hickory-proto = "0.25.0-alpha.4" hickory-resolver.workspace = true pin-project.workspace = true rustls-tokio-stream.workspace = true diff --git a/ext/net/ops.rs b/ext/net/ops.rs index 8d62bdeb4d..16148ac90d 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -21,13 +21,14 @@ use deno_core::ResourceId; use hickory_proto::rr::rdata::caa::Value; use hickory_proto::rr::record_data::RData; use hickory_proto::rr::record_type::RecordType; +use hickory_proto::ProtoError; +use hickory_proto::ProtoErrorKind; use hickory_resolver::config::NameServerConfigGroup; use hickory_resolver::config::ResolverConfig; use hickory_resolver::config::ResolverOpts; -use hickory_resolver::error::ResolveError; -use hickory_resolver::error::ResolveErrorKind; use hickory_resolver::system_conf; -use hickory_resolver::AsyncResolver; +use hickory_resolver::ResolveError; +use hickory_resolver::ResolveErrorKind; use serde::Deserialize; use serde::Serialize; use socket2::Domain; @@ -646,7 +647,7 @@ where } } - let resolver = AsyncResolver::tokio(config, opts); + let resolver = hickory_resolver::Resolver::tokio(config, opts); let lookup_fut = resolver.lookup(query, record_type); @@ -674,11 +675,21 @@ where lookup .map_err(|e| match e.kind() { - ResolveErrorKind::NoRecordsFound { .. } => NetError::DnsNotFound(e), - ResolveErrorKind::Message("No connections available") => { + ResolveErrorKind::Proto(ProtoError { kind, .. }) + if matches!(**kind, ProtoErrorKind::NoRecordsFound { .. }) => + { + NetError::DnsNotFound(e) + } + ResolveErrorKind::Proto(ProtoError { kind, .. }) + if matches!(**kind, ProtoErrorKind::NoConnections { .. }) => + { NetError::DnsNotConnected(e) } - ResolveErrorKind::Timeout => NetError::DnsTimedOut(e), + ResolveErrorKind::Proto(ProtoError { kind, .. }) + if matches!(**kind, ProtoErrorKind::Timeout { .. }) => + { + NetError::DnsTimedOut(e) + } _ => NetError::Dns(e), })? .iter() diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 31cc022ce2..fa51d7b77b 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -47,8 +47,9 @@ deno_tls.workspace = true fastwebsockets = { workspace = true, features = ["upgrade", "unstable-split"] } file_test_runner = "0.7.3" flaky_test = "=0.2.2" -hickory-client = "=0.24" -hickory-server = "=0.24" +hickory-client = "0.25.0-alpha.4" +hickory-proto = "0.25.0-alpha.4" +hickory-server = "0.25.0-alpha.4" http.workspace = true http-body-util.workspace = true hyper.workspace = true diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 18cded90cb..f0b536aa22 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -16,7 +16,8 @@ use deno_tls::rustls; use deno_tls::rustls::ClientConnection; use deno_tls::rustls_pemfile; use deno_tls::TlsStream; -use hickory_client::serialize::txt::Parser; +use hickory_proto::serialize::txt::Parser; +use hickory_server::authority::AuthorityObject; use pretty_assertions::assert_eq; use test_util as util; use test_util::itest; @@ -2245,10 +2246,10 @@ async fn test_resolve_dns() { panic!("failed to parse: {:?}", records.err()) } let (origin, records) = records.unwrap(); - let authority = Box::new(Arc::new( + let authority: Vec> = vec![Arc::new( InMemoryAuthority::new(origin, records, ZoneType::Primary, false) .unwrap(), - )); + )]; let mut catalog: Catalog = Catalog::new(); catalog.upsert(Name::root().into(), authority);