diff --git a/acmed/src/acme_proto.rs b/acmed/src/acme_proto.rs index 8e471ac..cd680af 100644 --- a/acmed/src/acme_proto.rs +++ b/acmed/src/acme_proto.rs @@ -177,6 +177,9 @@ pub fn request_certificate( let crt = http::get_certificate(endpoint, root_certs, &data_builder, &crt_url)?; storage::write_certificate(cert, &crt.as_bytes())?; - cert.info(&format!("Certificate renewed (domains: {})", cert.domain_list())); + cert.info(&format!( + "Certificate renewed (domains: {})", + cert.domain_list() + )); Ok(()) } diff --git a/acmed/src/certificate.rs b/acmed/src/certificate.rs index 29f2d28..100dfe5 100644 --- a/acmed/src/certificate.rs +++ b/acmed/src/certificate.rs @@ -102,7 +102,10 @@ impl Certificate { fn is_expiring(&self, cert: &X509Certificate) -> Result { let expires_in = cert.expires_in()?; - self.debug(&format!("Certificate expires in {} days", expires_in.as_secs() / 86400)); + self.debug(&format!( + "Certificate expires in {} days", + expires_in.as_secs() / 86400 + )); // TODO: allow a custom duration (using time-parse ?) // 1814400 is 3 weeks (3 * 7 * 24 * 60 * 60) let renewal_time = Duration::new(1_814_400, 0); @@ -141,7 +144,10 @@ impl Certificate { } pub fn should_renew(&self) -> Result { - self.debug(&format!("Checking for renewal (domains: {})", self.domain_list())); + self.debug(&format!( + "Checking for renewal (domains: {})", + self.domain_list() + )); if !certificate_files_exists(&self) { self.debug("certificate does not exist: requesting one"); return Ok(true); diff --git a/acmed/src/endpoint.rs b/acmed/src/endpoint.rs index c5d97fd..ce7bc4a 100644 --- a/acmed/src/endpoint.rs +++ b/acmed/src/endpoint.rs @@ -20,7 +20,12 @@ pub struct Endpoint { } impl Endpoint { - pub fn new(name: &str, url: &str, tos_agreed: bool, limits: &[(usize, String)]) -> Result { + pub fn new( + name: &str, + url: &str, + tos_agreed: bool, + limits: &[(usize, String)], + ) -> Result { let rl = RateLimit::new(limits)?; Ok(Self { name: name.to_string(), @@ -99,7 +104,11 @@ impl RateLimit { fn request_allowed(&self) -> bool { for (max_allowed, duration) in self.limits.iter() { let max_date = Instant::now() - *duration; - let nb_req = self.query_log.iter().filter(move |x| **x > max_date).count(); + let nb_req = self + .query_log + .iter() + .filter(move |x| **x > max_date) + .count(); if nb_req >= *max_allowed { return false; }