From 713ee6795df34db49167e5058e9bf68df8208b90 Mon Sep 17 00:00:00 2001 From: Zhang Jingqiang Date: Mon, 30 Oct 2023 16:48:41 +0800 Subject: [PATCH] switch back to use c-ares --- Cargo.lock | 240 +++++++++++++++++++++++++++---------- Cargo.toml | 2 + lib/g3-resolver/Cargo.toml | 4 +- 3 files changed, 184 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77e0e67c7..ebccfcd1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,7 +140,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -151,7 +151,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -258,6 +258,52 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "c-ares" +version = "7.8.0" +source = "git+https://github.com/zh-jq/rust-c-ares.git?branch=compat#cafa83b6f643354ecf798acac35d813cf08f5871" +dependencies = [ + "bitflags 2.4.1", + "c-ares-sys", + "c-types", + "itertools", +] + +[[package]] +name = "c-ares-resolver" +version = "7.6.0" +source = "git+https://github.com/zh-jq/c-ares-resolver.git?branch=compat#13074d231d8ee6c805b27c5cefc008bf593bb607" +dependencies = [ + "c-ares", + "futures-channel", + "polling", +] + +[[package]] +name = "c-ares-sys" +version = "7.0.0" +source = "git+https://github.com/zh-jq/rust-c-ares.git?branch=compat#cafa83b6f643354ecf798acac35d813cf08f5871" +dependencies = [ + "c-types", + "cc", + "cfg-expr", + "cmake", + "fs_extra", + "jni-sys", + "libc", + "system-deps", +] + +[[package]] +name = "c-types" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234aaaa3125768163e9a8616140b5c4ea9a045757ad309cbd74166a862eeb12f" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "cadence-with-flush" version = "0.29.1" @@ -315,6 +361,16 @@ dependencies = [ "libc", ] +[[package]] +name = "cfg-expr" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -573,7 +629,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -674,6 +730,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.29" @@ -730,7 +792,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -1050,13 +1112,13 @@ version = "0.5.0" dependencies = [ "ahash", "anyhow", + "c-ares", + "c-ares-resolver", "g3-types", "hickory-proto", "hickory-resolver", "indexmap 2.0.2", "log", - "mini-c-ares", - "mini-c-ares-resolver", "rustls", "thiserror", "tokio", @@ -2045,6 +2107,25 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jni-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c30a312d782b8d56a1e0897d45c1af33f31f9b4a4d13d31207a8675e0223b818" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c199962dfd5610ced8eca382606e349f7940a4ac7d867b58a046123411cbb4" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "js-sys" version = "0.3.64" @@ -2146,49 +2227,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mini-c-ares" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b25251e31ed84ea3c264bf1c163ef553db7c7ac58af810050b9f5409192821" -dependencies = [ - "bitflags 2.4.1", - "itertools", - "libc", - "mini-c-ares-sys", -] - -[[package]] -name = "mini-c-ares-resolver" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9586ea48f4739975856279bc04db54dfff07db077c61c29650184c288c5cec3" -dependencies = [ - "futures-channel", - "mini-c-ares", - "polling", -] - -[[package]] -name = "mini-c-ares-src" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c386ba7b549fbd3ddef66e553097d111497494bcdb14011b4e957104e9ee761" -dependencies = [ - "cmake", -] - -[[package]] -name = "mini-c-ares-sys" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3fbe22b76124b943f57953752e326dca32875f39cc3a97dde9d6b7ccbb2acf" -dependencies = [ - "libc", - "mini-c-ares-src", - "pkg-config", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -2336,7 +2374,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -2416,7 +2454,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -2518,7 +2556,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -2530,7 +2568,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -2905,7 +2943,7 @@ checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -2919,6 +2957,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + [[package]] name = "sha-1" version = "0.10.1" @@ -3021,6 +3068,17 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.38" @@ -3032,6 +3090,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "system-deps" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af52f9402f94aac4948a2518b43359be8d9ce6cd9efc1c4de3b2f7b7e897d6" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + [[package]] name = "target-lexicon" version = "0.12.12" @@ -3095,7 +3166,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -3139,7 +3210,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -3191,6 +3262,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.0.2", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tongsuo" version = "0.10.57" @@ -3249,7 +3354,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -3345,6 +3450,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" + [[package]] name = "version_check" version = "0.9.4" @@ -3378,7 +3489,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3400,7 +3511,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3492,6 +3603,15 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "winnow" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +dependencies = [ + "memchr", +] + [[package]] name = "yaml-rust" version = "0.4.5" @@ -3518,7 +3638,7 @@ checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 060ca5394..6e4095fe1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -223,3 +223,5 @@ debug-assertions = false [patch.crates-io] console = { version = "0.15.7", git = "https://github.com/console-rs/console.git", rev = "51425fc" } ring = { version = "0.16.20", git = "https://github.com/zh-jq/ring-repack.git", branch = "patch-0.16" } +c-ares = { version = "7.8", git = "https://github.com/zh-jq/rust-c-ares.git", branch = "compat" } +c-ares-resolver = { version = "7.6", git = "https://github.com/zh-jq/c-ares-resolver.git", branch = "compat" } diff --git a/lib/g3-resolver/Cargo.toml b/lib/g3-resolver/Cargo.toml index d8161d3d3..75852f4f1 100644 --- a/lib/g3-resolver/Cargo.toml +++ b/lib/g3-resolver/Cargo.toml @@ -14,8 +14,8 @@ tokio-util = { workspace = true, features = ["time"]} log.workspace = true indexmap.workspace = true ahash.workspace = true -c-ares = { package = "mini-c-ares", version = "0.2.1", optional = true } -c-ares-resolver = { package = "mini-c-ares-resolver", version = "0.2", optional = true } +c-ares = { version = "7.8", optional = true, default-features = false, features = ["build-cmake"] } +c-ares-resolver = { version = "7.6", default-features = false, optional = true } hickory-resolver = { workspace = true, optional = true, features = ["tokio-runtime", "dns-over-rustls", "dns-over-https-rustls", "dns-over-quic", "dns-over-h3", "native-certs"] } hickory-proto = { workspace = true, optional = true } rustls = { workspace = true, optional = true }