From c8a7ce5cdf8deb376752588ba1fd99675d8587e7 Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Thu, 18 Mar 2021 19:46:35 +0100 Subject: [PATCH] remove domain resolution for *_bind_addr --- src/util/config.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/util/config.rs b/src/util/config.rs index 313692fc5..6b449459a 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -11,7 +11,6 @@ pub struct Config { pub metadata_dir: PathBuf, pub data_dir: PathBuf, - #[serde(deserialize_with = "deserialize_addr")] pub rpc_bind_addr: SocketAddr, #[serde(deserialize_with = "deserialize_vec_addr")] @@ -50,14 +49,12 @@ pub struct TlsConfig { #[derive(Deserialize, Debug, Clone)] pub struct ApiConfig { - #[serde(deserialize_with = "deserialize_addr")] pub api_bind_addr: SocketAddr, pub s3_region: String, } #[derive(Deserialize, Debug, Clone)] pub struct WebConfig { - #[serde(deserialize_with = "deserialize_addr")] pub bind_addr: SocketAddr, pub root_domain: String, pub index: String, @@ -87,19 +84,6 @@ pub fn read_config(config_file: PathBuf) -> Result { Ok(toml::from_str(&config)?) } -fn deserialize_addr<'de, D>(deserializer: D) -> Result -where - D: de::Deserializer<'de>, -{ - use std::net::ToSocketAddrs; - - <&str>::deserialize(deserializer)? - .to_socket_addrs() - .map_err(|_| de::Error::custom("could not resolve to a socket address"))? - .next() - .ok_or(de::Error::custom("could not resolve to a socket address")) -} - fn deserialize_vec_addr<'de, D>(deserializer: D) -> Result, D::Error> where D: de::Deserializer<'de>,