Skip to content

Commit dd17bde

Browse files
committed
Remove ProxyConfig#enable field
1 parent 59612f3 commit dd17bde

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

network/src/network.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ impl NetworkState {
123123
config.peer_store_path(),
124124
));
125125
info!("Loaded the peer store.");
126-
if config.proxy_config.enable {
127-
proxy::check_proxy_url(&config.proxy_config.proxy_url)
128-
.map_err(|reason| Error::Config(reason))?;
126+
if let Some(ref proxy_url) = config.proxy_config.proxy_url {
127+
proxy::check_proxy_url(proxy_url).map_err(|reason| Error::Config(reason))?;
129128
}
130129

131130
let bootnodes = config.bootnodes();
@@ -998,14 +997,13 @@ impl NetworkService {
998997
if init.is_ready() {
999998
break;
1000999
}
1001-
let proxy_config_enable = config.proxy_config.enable;
1002-
1003-
if proxy_config_enable {
1004-
let proxy_config = ProxyConfig {
1005-
proxy_url: config.proxy_config.proxy_url.clone(),
1006-
};
1007-
service_builder = service_builder.tcp_proxy_config(Some(proxy_config));
1008-
}
1000+
let proxy_config_enable = config.proxy_config.proxy_url.is_some();
1001+
service_builder = service_builder.tcp_proxy_config(
1002+
config
1003+
.proxy_config
1004+
.proxy_url
1005+
.map(|proxy_url| ProxyConfig { proxy_url }),
1006+
);
10091007

10101008
match find_type(multi_addr) {
10111009
TransportType::Tcp => {

util/app-config/src/configs/network.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ pub struct Config {
103103
/// Proxy related config options
104104
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
105105
pub struct ProxyConfig {
106-
pub enable: bool,
107106
// like: socks5://username:[email protected]:1080
108-
pub proxy_url: String,
107+
pub proxy_url: Option<String>,
109108
}
110109

111110
/// Chain synchronization config options.

0 commit comments

Comments
 (0)