From 222adb38b3edb0100a1d5d723c33f4ff91010d02 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Sun, 12 May 2024 19:01:39 +0800 Subject: [PATCH] fix(local): reverted wrong assumption --- crates/shadowsocks-service/src/config.rs | 36 +++++++++--------------- src/service/local.rs | 10 +++++-- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 2b88ffa7488b..7db2de114483 100644 --- a/crates/shadowsocks-service/src/config.rs +++ b/crates/shadowsocks-service/src/config.rs @@ -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, @@ -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() { diff --git a/src/service/local.rs b/src/service/local.rs index cf873e14b329..a45664369790 100644 --- a/src/service/local.rs +++ b/src/service/local.rs @@ -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}, @@ -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")]