Skip to content

Commit

Permalink
fix(local): reverted wrong assumption
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed May 12, 2024
1 parent 1a6335c commit 222adb3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
36 changes: 14 additions & 22 deletions crates/shadowsocks-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ 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 @@ -2551,27 +2558,12 @@ impl Config {
}

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);
}
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
10 changes: 8 additions & 2 deletions src/service/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ use shadowsocks_service::shadowsocks::relay::socks5::Address;
use shadowsocks_service::{
acl::AccessControl,
config::{
read_variable_field_value, Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType,
read_variable_field_value,
Config,
ConfigType,
LocalConfig,
LocalInstanceConfig,
ProtocolType,
ServerInstanceConfig,
},
local::{loadbalancing::PingBalancer, Server},
Expand All @@ -40,7 +45,8 @@ use shadowsocks_service::{
use crate::logging;
use crate::{
config::{Config as ServiceConfig, RuntimeMode},
monitor, vparser,
monitor,
vparser,
};

#[cfg(feature = "local-dns")]
Expand Down

0 comments on commit 222adb3

Please sign in to comment.