diff --git a/Cargo.lock b/Cargo.lock index 56069c014810..3102cc778469 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -745,6 +745,15 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.1" @@ -947,6 +956,34 @@ dependencies = [ "tracing", ] +[[package]] +name = "h3" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6de6ca43eed186fd055214af06967b0a7a68336cefec7e8a4004e96efeaccb9e" +dependencies = [ + "bytes", + "fastrand 1.9.0", + "futures-util", + "http", + "tokio", + "tracing", +] + +[[package]] +name = "h3-quinn" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4a1a1763e4f3e82ee9f1ecf2cf862b22cc7316ebe14684e42f94532b5ec64d" +dependencies = [ + "bytes", + "futures", + "h3", + "quinn", + "quinn-proto", + "tokio-util", +] + [[package]] name = "hash32" version = "0.2.1" @@ -1002,11 +1039,14 @@ dependencies = [ "futures-io", "futures-util", "h2", + "h3", + "h3-quinn", "http", "idna", "ipnet", "native-tls", "once_cell", + "quinn", "rand", "rustls", "rustls-pemfile", @@ -1237,6 +1277,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "ioctl-sys" version = "0.8.0" @@ -1897,6 +1946,53 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c78e758510582acc40acb90458401172d41f1016f8c9dde89e49677afb7eec1" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +dependencies = [ + "bytes", + "libc", + "socket2 0.5.4", + "tracing", + "windows-sys 0.48.0", +] + [[package]] name = "quote" version = "1.0.33" @@ -2129,6 +2225,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2722,7 +2824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.0.1", "redox_syscall 0.3.5", "rustix", "windows-sys 0.48.0", diff --git a/crates/shadowsocks-service/Cargo.toml b/crates/shadowsocks-service/Cargo.toml index 1a865b3fadee..9e3d0cbf0023 100644 --- a/crates/shadowsocks-service/Cargo.toml +++ b/crates/shadowsocks-service/Cargo.toml @@ -57,6 +57,7 @@ dns-over-https = [ "hickory-resolver/dns-over-https", "hickory-resolver/dns-over-https-rustls", ] +dns-over-h3 = ["hickory-dns", "hickory-resolver/dns-over-h3"] # Enable DNS-relay local-dns = ["local", "hickory-dns"] diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 60a21d877c60..548cc31da7b2 100644 --- a/crates/shadowsocks-service/src/config.rs +++ b/crates/shadowsocks-service/src/config.rs @@ -68,14 +68,7 @@ use serde::{Deserialize, Serialize}; use shadowsocks::relay::socks5::Address; use shadowsocks::{ config::{ - ManagerAddr, - Mode, - ReplayAttackPolicy, - ServerAddr, - ServerConfig, - ServerUser, - ServerUserManager, - ServerWeight, + ManagerAddr, Mode, ReplayAttackPolicy, ServerAddr, ServerConfig, ServerUser, ServerUserManager, ServerWeight, }, crypto::CipherKind, plugin::PluginConfig, @@ -2093,6 +2086,12 @@ impl Config { #[cfg(feature = "hickory-dns")] "google" => DnsConfig::HickoryDns(ResolverConfig::google()), + #[cfg(all(feature = "hickory-dns", feature = "dns-over-tls"))] + "google_tls" => DnsConfig::HickoryDns(ResolverConfig::google_tls()), + #[cfg(all(feature = "hickory-dns", feature = "dns-over-https"))] + "google_https" => DnsConfig::HickoryDns(ResolverConfig::google_https()), + #[cfg(all(feature = "hickory-dns", feature = "dns-over-h3"))] + "google_h3" => DnsConfig::HickoryDns(ResolverConfig::google_h3()), #[cfg(feature = "hickory-dns")] "cloudflare" => DnsConfig::HickoryDns(ResolverConfig::cloudflare()),