Updates and bug fixes #2

Merged
jjkiers merged 6 commits from new-rust-zig into main 2023-08-25 21:07:24 +00:00
2 changed files with 11 additions and 0 deletions
Showing only changes of commit cd35859c9b - Show all commits

View File

@ -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()
}),
);

View File

@ -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 {