diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 5f7e80faa36f..13026ba8eba8 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, diff --git a/crates/shadowsocks-service/src/local/http/http_client.rs b/crates/shadowsocks-service/src/local/http/http_client.rs index 2db5426a1585..07fab66ece6c 100644 --- a/crates/shadowsocks-service/src/local/http/http_client.rs +++ b/crates/shadowsocks-service/src/local/http/http_client.rs @@ -64,7 +64,7 @@ impl Timer for TokioTimer { fn reset(&self, sleep: &mut Pin>, new_deadline: Instant) { if let Some(sleep) = sleep.as_mut().downcast_mut_pin::() { - sleep.reset(new_deadline.into()) + sleep.reset(new_deadline) } } } @@ -105,6 +105,17 @@ impl Clone for HttpClient { } } +impl Default for HttpClient +where + B: Body + Send + Unpin + Debug + 'static, + B::Data: Send, + B::Error: Into>, +{ + fn default() -> Self { + HttpClient::new() + } +} + impl HttpClient where B: Body + Send + Unpin + Debug + 'static, diff --git a/crates/shadowsocks-service/src/local/online_config/mod.rs b/crates/shadowsocks-service/src/local/online_config/mod.rs index 09b2e9b7841c..31b891f2e4ca 100644 --- a/crates/shadowsocks-service/src/local/online_config/mod.rs +++ b/crates/shadowsocks-service/src/local/online_config/mod.rs @@ -164,7 +164,7 @@ impl OnlineConfigService { let parsed_body = match String::from_utf8(collected_body) { Ok(b) => b, - Err(..) => return Err(io::Error::new(io::ErrorKind::Other, "body contains non-utf8 bytes").into()), + Err(..) => return Err(io::Error::new(io::ErrorKind::Other, "body contains non-utf8 bytes")), }; let online_config = match Config::load_from_str(&parsed_body, ConfigType::OnlineConfig) { @@ -174,7 +174,7 @@ impl OnlineConfigService { "server-loader task failed to load from url: {}, error: {}", self.config_url, err ); - return Err(io::Error::new(io::ErrorKind::Other, err).into()); + return Err(io::Error::new(io::ErrorKind::Other, err)); } }; @@ -183,7 +183,7 @@ impl OnlineConfigService { "server-loader task failed to load from url: {}, error: {}", self.config_url, err ); - return Err(io::Error::new(io::ErrorKind::Other, err).into()); + return Err(io::Error::new(io::ErrorKind::Other, err)); } let after_read_time = Instant::now(); diff --git a/src/service/local.rs b/src/service/local.rs index d5bc5d58378d..78a0f8628108 100644 --- a/src/service/local.rs +++ b/src/service/local.rs @@ -24,7 +24,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}, @@ -39,7 +44,8 @@ use shadowsocks_service::{ use crate::logging; use crate::{ config::{Config as ServiceConfig, RuntimeMode}, - monitor, vparser, + monitor, + vparser, }; #[cfg(feature = "local-dns")]