diff --git a/src/config.rs b/src/config.rs index 64c7699..154318a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -173,6 +173,10 @@ fn load_config(path: &str) -> Result { name: name.to_string(), addr: format!("{}:{}", upstream_host, upsteam_port), protocol: upstream_url.scheme().to_string(), + addresses: Addr(Mutex::new(UpstreamAddress::new(format!( + "{}:{}", + upstream_host, upsteam_port + )))), ..Default::default() }), ); diff --git a/src/servers/upstream_address.rs b/src/servers/upstream_address.rs index 3220a12..4c34dbf 100644 --- a/src/servers/upstream_address.rs +++ b/src/servers/upstream_address.rs @@ -19,6 +19,13 @@ impl Display for UpstreamAddress { } impl UpstreamAddress { + pub fn new(address: String) -> Self { + UpstreamAddress { + address, + ..Default::default() + } + } + pub fn is_valid(&self) -> bool { if let Some(resolved) = self.resolved_time { if let Some(ttl) = self.ttl {