mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
customizing "system" DNS server with config key "dns"
This commit is contained in:
@@ -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"] }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user