Skip to content

Commit

Permalink
Remove ProxyConfig#enable field
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Dec 31, 2024
1 parent 59612f3 commit dd17bde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
20 changes: 9 additions & 11 deletions network/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ impl NetworkState {
config.peer_store_path(),
));
info!("Loaded the peer store.");
if config.proxy_config.enable {
proxy::check_proxy_url(&config.proxy_config.proxy_url)
.map_err(|reason| Error::Config(reason))?;
if let Some(ref proxy_url) = config.proxy_config.proxy_url {
proxy::check_proxy_url(proxy_url).map_err(|reason| Error::Config(reason))?;
}

let bootnodes = config.bootnodes();
Expand Down Expand Up @@ -998,14 +997,13 @@ impl NetworkService {
if init.is_ready() {
break;
}
let proxy_config_enable = config.proxy_config.enable;

if proxy_config_enable {
let proxy_config = ProxyConfig {
proxy_url: config.proxy_config.proxy_url.clone(),
};
service_builder = service_builder.tcp_proxy_config(Some(proxy_config));
}
let proxy_config_enable = config.proxy_config.proxy_url.is_some();
service_builder = service_builder.tcp_proxy_config(
config
.proxy_config
.proxy_url
.map(|proxy_url| ProxyConfig { proxy_url }),
);

match find_type(multi_addr) {
TransportType::Tcp => {
Expand Down
3 changes: 1 addition & 2 deletions util/app-config/src/configs/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ pub struct Config {
/// Proxy related config options
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct ProxyConfig {
pub enable: bool,
// like: socks5://username:[email protected]:1080
pub proxy_url: String,
pub proxy_url: Option<String>,
}

/// Chain synchronization config options.
Expand Down

0 comments on commit dd17bde

Please sign in to comment.