Initialize UpstreamAddress with actual address
Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
parent
7f399af713
commit
cd35859c9b
@ -173,6 +173,10 @@ fn load_config(path: &str) -> Result<ParsedConfig, ConfigError> {
|
||||
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()
|
||||
}),
|
||||
);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user