From f74cca567dc293ae00cd052252a8e7f9a28a9804 Mon Sep 17 00:00:00 2001 From: zephyr Date: Sun, 10 Dec 2023 21:41:16 +0900 Subject: [PATCH] migrate trust_dns to hickory --- Cargo.lock | 121 ++++++++++++++++++-------------------- Cargo.toml | 4 +- realm_core/Cargo.toml | 6 +- realm_core/src/dns/mod.rs | 4 +- src/conf/dns.rs | 2 +- 5 files changed, 65 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e861df9e..9a10af14 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -269,14 +269,14 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -481,6 +481,51 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "hickory-proto" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "hostname" version = "0.3.1" @@ -529,11 +574,10 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -742,12 +786,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "memchr" version = "2.6.4" @@ -993,7 +1031,7 @@ dependencies = [ [[package]] name = "realm" -version = "2.4.6" +version = "2.5.0" dependencies = [ "cfg-if", "chrono", @@ -1014,11 +1052,12 @@ dependencies = [ [[package]] name = "realm_core" -version = "0.3.7" +version = "0.3.8" dependencies = [ "bytes", "env_logger", "futures", + "hickory-resolver", "kaminari", "log", "once_cell", @@ -1029,7 +1068,6 @@ dependencies = [ "realm_lb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "realm_syscall 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", - "trust-dns-resolver", ] [[package]] @@ -1505,9 +1543,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", @@ -1526,9 +1564,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.1.0", "serde", @@ -1568,51 +1606,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "trust-dns-proto" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "rand", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lazy_static", - "lru-cache", - "parking_lot", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "typenum" version = "1.17.0" diff --git a/Cargo.toml b/Cargo.toml index c498bd53..54eca1ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "realm" -version = "2.4.6" +version = "2.5.0" authors = ["zhboner "] edition = "2021" @@ -42,7 +42,7 @@ chrono = "0.4" # command clap = "3.1" -toml = "0.7" +toml = "0.8" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/realm_core/Cargo.toml b/realm_core/Cargo.toml index 99aff741..c18fc971 100644 --- a/realm_core/Cargo.toml +++ b/realm_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "realm_core" -version = "0.3.7" +version = "0.3.8" authors = ["Realm Contributors"] description = "Realm's core facilities." repository = "https://github.com/zhboner/realm/realm_core" @@ -24,8 +24,8 @@ log = "0.4" bytes = { version = "1", optional = true } once_cell = "1" pin-project = "1" -trust-dns-resolver = "0.22" -tokio = { version = "1.18", features = ["rt", "net", "time"] } +hickory-resolver = "0.24" +tokio = { version = "1.9", features = ["rt", "net", "time"] } proxy-protocol = { version = "0.5", optional = true } [features] diff --git a/realm_core/src/dns/mod.rs b/realm_core/src/dns/mod.rs index 265f67ba..4ce51507 100644 --- a/realm_core/src/dns/mod.rs +++ b/realm_core/src/dns/mod.rs @@ -3,7 +3,7 @@ use std::io::{Result, Error, ErrorKind}; use std::net::SocketAddr; -use trust_dns_resolver as resolver; +use hickory_resolver as resolver; use resolver::TokioAsyncResolver; use resolver::system_conf::read_system_conf; use resolver::lookup_ip::{LookupIp, LookupIpIter}; @@ -39,7 +39,7 @@ static mut DNS_CONF: OnceCell = OnceCell::new(); static mut DNS: Lazy = Lazy::new(|| { let DnsConf { conf, opts } = unsafe { DNS_CONF.take().unwrap() }; - TokioAsyncResolver::tokio(conf, opts).unwrap() + TokioAsyncResolver::tokio(conf, opts) }); /// Setup global dns resolver. This is not thread-safe! diff --git a/src/conf/dns.rs b/src/conf/dns.rs index 82e224af..bea3e9a9 100644 --- a/src/conf/dns.rs +++ b/src/conf/dns.rs @@ -264,7 +264,7 @@ impl Config for DnsConf { socket_addr, protocol, tls_dns_name: None, - trust_nx_responses: true, + trust_negative_responses: true, bind_addr: None, }); }