Skip to content

Commit

Permalink
bugfix: fix missed client_cache_size config item in SSLocalExtConfig,…
Browse files Browse the repository at this point in the history
… and update README
  • Loading branch information
chuxi committed Oct 8, 2023
1 parent ea7346c commit 7f797d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 10 additions & 0 deletions crates/shadowsocks-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ struct SSLocalExtConfig {
#[cfg(feature = "local-dns")]
#[serde(skip_serializing_if = "Option::is_none")]
remote_dns_port: Option<u16>,
#[cfg(feature = "local-dns")]
#[serde(skip_serializing_if = "Option::is_none")]
client_cache_size: Option<usize>,

/// Tunnel
#[cfg(feature = "local-tunnel")]
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.clone(),

Check warning on line 2469 in crates/shadowsocks-service/src/config.rs

View workflow job for this annotation

GitHub Actions / clippy-check (ubuntu-latest)

using `clone` on type `Option<usize>` which implements the `Copy` trait

warning: using `clone` on type `Option<usize>` which implements the `Copy` trait --> crates/shadowsocks-service/src/config.rs:2469:44 | 2469 | client_cache_size: local.client_cache_size.clone(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `local.client_cache_size` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 2469 in crates/shadowsocks-service/src/config.rs

View workflow job for this annotation

GitHub Actions / clippy-check (macos-latest)

using `clone` on type `Option<usize>` which implements the `Copy` trait

warning: using `clone` on type `Option<usize>` which implements the `Copy` trait --> crates/shadowsocks-service/src/config.rs:2469:44 | 2469 | client_cache_size: local.client_cache_size.clone(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `local.client_cache_size` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[warn(clippy::clone_on_copy)]` on by default
#[cfg(feature = "local-tun")]
tun_interface_name: local.tun_interface_name.clone(),
#[cfg(feature = "local-tun")]
Expand Down

0 comments on commit 7f797d0

Please sign in to comment.