From 9050d726dec66259787a64cc67a1c48e72ae561d Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Fri, 25 Feb 2022 14:31:42 +0800 Subject: [PATCH] customizing "system" DNS server with config key "dns" --- Cargo.toml | 2 +- README.md | 2 ++ crates/shadowsocks-service/src/config.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8ab33d75..0bd53050 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -173,4 +173,4 @@ daemonize = "0.4" byteorder = "1.3" env_logger = "0.9" byte_string = "1.0" -tokio = { version = "1", features = ["net", "time", "macros", "io-util"]} +tokio = { version = "1", features = ["net", "time", "macros", "io-util"] } diff --git a/README.md b/README.md index 4cf98f7d..198f2b51 100644 --- a/README.md +++ b/README.md @@ -590,6 +590,8 @@ Example configuration: // Value could be IP address of DNS server, for example, "8.8.8.8". // DNS client will automatically request port 53 with both TCP and UDP protocol. // + // - system, uses system provided API (`getaddrinfo` on *NIX) + // // It also allows some pre-defined well-known public DNS servers: // - google (TCP, UDP) // - cloudflare (TCP, UDP) diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 172ca076..2408107a 100644 --- a/crates/shadowsocks-service/src/config.rs +++ b/crates/shadowsocks-service/src/config.rs @@ -1736,6 +1736,8 @@ impl Config { /// 2. Pre-defined. Like `google`, `cloudflare` pub fn set_dns_formatted(&mut self, dns: &str) -> Result<(), Error> { self.dns = match dns { + "system" => DnsConfig::System, + #[cfg(feature = "trust-dns")] "google" => DnsConfig::TrustDns(ResolverConfig::google()),