From b25e9e36af4d69f5579c514305ade9cfa24fd2c4 Mon Sep 17 00:00:00 2001 From: Hanwei Jin Date: Sun, 8 Oct 2023 23:52:13 +0800 Subject: [PATCH] bugfix: fix missed client_cache_size config item in SSLocalExtConfig (#1319) --- README.md | 2 ++ crates/shadowsocks-service/src/config.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index cd948d52356e..95a25862d873 100644 --- a/README.md +++ b/README.md @@ -597,6 +597,8 @@ Example configuration: "remote_dns_address": "8.8.8.8", // OPTIONAL. Remote DNS's port, 53 by default "remote_dns_port": 53, + // OPTIONAL. dns client cache size for fetching dns queries. + "client_cache_size": 5 }, { // Tun local server (feature = "local-tun") diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 61ebb13f43cb..49ee637bab76 100644 --- a/crates/shadowsocks-service/src/config.rs +++ b/crates/shadowsocks-service/src/config.rs @@ -260,6 +260,9 @@ struct SSLocalExtConfig { #[cfg(feature = "local-dns")] #[serde(skip_serializing_if = "Option::is_none")] remote_dns_port: Option, + #[cfg(feature = "local-dns")] + #[serde(skip_serializing_if = "Option::is_none")] + client_cache_size: Option, /// Tunnel #[cfg(feature = "local-tunnel")] @@ -1537,6 +1540,11 @@ impl Config { } } + #[cfg(feature = "local-dns")] + if let Some(client_cache_size) = local.client_cache_size { + local_config.client_cache_size = Some(client_cache_size); + } + #[cfg(feature = "local-dns")] if let Some(remote_dns_address) = local.remote_dns_address { let remote_dns_port = local.remote_dns_port.unwrap_or(53); @@ -2457,6 +2465,8 @@ impl fmt::Display for Config { Address::DomainNameAddress(.., port) => Some(*port), }, }, + #[cfg(feature = "local-dns")] + client_cache_size: local.client_cache_size, #[cfg(feature = "local-tun")] tun_interface_name: local.tun_interface_name.clone(), #[cfg(feature = "local-tun")]