diff --git a/src/app.rs b/src/app.rs index c148f25..40f4360 100644 --- a/src/app.rs +++ b/src/app.rs @@ -53,19 +53,14 @@ impl ProxyApp { Ok(ips) => { let records = ips.as_lookup().records(); for record in records { - if let Some(rdata) = record.data() { - match rdata { - RData::A(a) => { - let ipv4_address = a.0.to_string(); - { - self.dns_resolver_cache_map.write().await - .insert(hostname.to_string(), ipv4_address.clone()); - } - log::info!("DNS found {} --> {}", hostname, ipv4_address); - return Some(ipv4_address); - } - _ => {} + if let Some(RData::A(a)) = record.data() { + let ipv4_address = a.0.to_string(); + { + self.dns_resolver_cache_map.write().await + .insert(hostname.to_string(), ipv4_address.clone()); } + log::info!("DNS found {} --> {}", hostname, ipv4_address); + return Some(ipv4_address); } } } diff --git a/src/cert.rs b/src/cert.rs index 5205b2f..2edd270 100644 --- a/src/cert.rs +++ b/src/cert.rs @@ -27,7 +27,7 @@ pub fn load_certificate(cert_fn: &str, key_fn: &str) -> Result<(Certificate, Str pub fn issue_certificate(intermediate_certificate: &Certificate, domain: &str) -> Result { let cert = new_end_entity(domain)?; - log::info!("New certificate for: {} -> {}", domain, hex::encode(&cert.get_key_identifier())); + log::info!("New certificate for: {} -> {}", domain, hex::encode(cert.get_key_identifier())); let cert_pem = cert.serialize_pem_with_signer(intermediate_certificate).map_err(|e| format!("Sign cert failed: {}", e))?; let key_pem = cert.serialize_private_key_pem(); Ok(Cert { @@ -79,7 +79,7 @@ fn new_end_entity(domain: &str) -> Result { params.extended_key_usages.push(ExtendedKeyUsagePurpose::ClientAuth); params.not_before = start; params.not_after = end; - Ok(Certificate::from_params(params).map_err(|e| format!("New cert failed: {}", e))?) + Certificate::from_params(params).map_err(|e| format!("New cert failed: {}", e)) } fn validity_period() -> Result<(OffsetDateTime, OffsetDateTime), String> { diff --git a/src/main.rs b/src/main.rs index 5fdd246..797a924 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,7 @@ fn build_services(server: &Server, proxy_config: &ProxyConfig) -> Vec