Skip to content

Commit

Permalink
fix(shadowsocks-service): server instance specific ConnectOpts
Browse files Browse the repository at this point in the history
Per-server's specific outbound options should be set after cloning the
global connect opts.

- ref #1774
- ref #1491, #1493
  • Loading branch information
zonyitoo committed Nov 27, 2024
1 parent f525ada commit 4c4e3bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/shadowsocks-service/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ pub async fn run(config: Config) -> io::Result<()> {
server_builder.set_dns_resolver(r.clone());
}

let mut connect_opts = connect_opts.clone();
let accept_opts = accept_opts.clone();

#[cfg(any(target_os = "linux", target_os = "android"))]
if let Some(fwmark) = inst.outbound_fwmark {
connect_opts.fwmark = Some(fwmark);
Expand All @@ -117,8 +120,8 @@ pub async fn run(config: Config) -> io::Result<()> {
connect_opts.bind_interface = Some(bind_interface);
}

server_builder.set_connect_opts(connect_opts.clone());
server_builder.set_accept_opts(accept_opts.clone());
server_builder.set_connect_opts(connect_opts);
server_builder.set_accept_opts(accept_opts);

if let Some(c) = config.udp_max_associations {
server_builder.set_udp_capacity(c);
Expand Down

0 comments on commit 4c4e3bd

Please sign in to comment.