Skip to content

Commit

Permalink
fix(local): online_config checked only when feature enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed May 12, 2024
1 parent 200463d commit e0f25c6
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions crates/shadowsocks-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ use serde::{Deserialize, Serialize};
use shadowsocks::relay::socks5::Address;
use shadowsocks::{
config::{
ManagerAddr,
Mode,
ReplayAttackPolicy,
ServerAddr,
ServerConfig,
ServerSource,
ServerUser,
ServerUserManager,
ManagerAddr, Mode, ReplayAttackPolicy, ServerAddr, ServerConfig, ServerSource, ServerUser, ServerUserManager,
ServerWeight,
},
crypto::CipherKind,
Expand Down Expand Up @@ -2557,13 +2550,28 @@ impl Config {
}
}

if self.config_type.is_server() && self.server.is_empty() && self.online_config.is_none() {
let err = Error::new(
ErrorKind::MissingField,
"missing any valid servers in configuration",
None,
);
return Err(err);
if self.config_type.is_server() && self.server.is_empty() {
#[cfg(feature = "local-online-config")]
if self.online_config.is_none() {
// It's Ok if online_config is not None.
// servers could be fetch from online configuration delivery (SIP008)
let err = Error::new(
ErrorKind::MissingField,
"missing any valid servers in configuration",
None,
);
return Err(err);
}

#[cfg(not(feature = "local-online-config"))]
{
let err = Error::new(
ErrorKind::MissingField,
"missing any valid servers in configuration",
None,
);
return Err(err);
}
}

if self.config_type.is_manager() && self.manager.is_none() {
Expand Down

0 comments on commit e0f25c6

Please sign in to comment.