File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
crates/shadowsocks-service/src Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -596,7 +596,9 @@ Example configuration:
596
596
// Remote DNS address, DNS queries will be sent through ssserver to this address
597
597
" remote_dns_address" : " 8.8.8.8" ,
598
598
// OPTIONAL. Remote DNS's port, 53 by default
599
- " remote_dns_port" : 53
599
+ " remote_dns_port" : 53 ,
600
+ // OPTIONAL. DNS Client Cache (TCP & UDP sockets)
601
+ " client_cache_size" : 5
600
602
},
601
603
{
602
604
// Tun local server (feature = "local-tun")
Original file line number Diff line number Diff line change @@ -925,7 +925,7 @@ impl LocalConfig {
925
925
#[ cfg( feature = "local-dns" ) ]
926
926
remote_dns_addr : None ,
927
927
#[ cfg( feature = "local-dns" ) ]
928
- client_cache_size : Some ( 5 ) ,
928
+ client_cache_size : None ,
929
929
930
930
#[ cfg( feature = "local-tun" ) ]
931
931
tun_interface_name : None ,
@@ -1553,6 +1553,11 @@ impl Config {
1553
1553
} ) ;
1554
1554
}
1555
1555
1556
+ #[ cfg( feature = "local-dns" ) ]
1557
+ {
1558
+ local_config. client_cache_size = local. client_cache_size ;
1559
+ }
1560
+
1556
1561
#[ cfg( feature = "local-tun" ) ]
1557
1562
if let Some ( tun_interface_address) = local. tun_interface_address {
1558
1563
match tun_interface_address. parse :: < IpNet > ( ) {
@@ -2464,6 +2469,8 @@ impl fmt::Display for Config {
2464
2469
Address :: DomainNameAddress ( .., port) => Some ( * port) ,
2465
2470
} ,
2466
2471
} ,
2472
+ #[ cfg( feature = "local-dns" ) ]
2473
+ client_cache_size : local. client_cache_size . clone ( ) ,
2467
2474
#[ cfg( feature = "local-tun" ) ]
2468
2475
tun_interface_name : local. tun_interface_name . clone ( ) ,
2469
2476
#[ cfg( feature = "local-tun" ) ]
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ impl Server {
353
353
let mut server_builder = {
354
354
let local_addr = local_config. local_dns_addr . expect ( "missing local_dns_addr" ) ;
355
355
let remote_addr = local_config. remote_dns_addr . expect ( "missing remote_dns_addr" ) ;
356
- let client_cache_size = local_config. client_cache_size . unwrap ( ) ;
356
+ let client_cache_size = local_config. client_cache_size . unwrap_or_else ( 5 ) ;
357
357
358
358
DnsBuilder :: with_context (
359
359
context. clone ( ) ,
You can’t perform that action at this time.
0 commit comments