diff --git a/examples/high_level.rs b/examples/high_level.rs index 12b4603..7bdf7e3 100644 --- a/examples/high_level.rs +++ b/examples/high_level.rs @@ -56,7 +56,7 @@ async fn main() { unreachable!() } -const HELLO: &'static [u8] = br#"HTTP/1.1 200 OK +const HELLO: &[u8] = br#"HTTP/1.1 200 OK Content-Length: 10 Content-Type: text/plain; charset=utf-8 diff --git a/examples/low_level.rs b/examples/low_level.rs index 7202e2e..fbbcc92 100644 --- a/examples/low_level.rs +++ b/examples/low_level.rs @@ -81,7 +81,7 @@ async fn serve(acceptor: AcmeAcceptor, rustls_config: Arc, port: u } } -const HELLO: &'static [u8] = br#"HTTP/1.1 200 OK +const HELLO: &[u8] = br#"HTTP/1.1 200 OK Content-Length: 10 Content-Type: text/plain; charset=utf-8 diff --git a/src/state.rs b/src/state.rs index 9dfdff3..3d54e8d 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,15 +1,3 @@ -use crate::acceptor::AcmeAcceptor; -use crate::acme::{ - Account, AcmeError, Auth, AuthStatus, Directory, Identifier, Order, OrderStatus, -}; -use crate::{AcmeConfig, Incoming, ResolvesServerCertAcme}; -use chrono::{DateTime, TimeZone, Utc}; -use futures::future::try_join_all; -use futures::{ready, FutureExt, Stream}; -use rcgen::{CertificateParams, DistinguishedName, RcgenError, PKCS_ECDSA_P256_SHA256}; -use rustls::sign::{any_ecdsa_type, CertifiedKey}; -use rustls::Certificate as RustlsCertificate; -use rustls::PrivateKey; use std::convert::Infallible; use std::fmt::Debug; use std::future::Future; @@ -17,12 +5,27 @@ use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; use std::time::Duration; + +use chrono::{DateTime, TimeZone, Utc}; +use futures::future::try_join_all; +use futures::{ready, FutureExt, Stream}; +use rcgen::{CertificateParams, DistinguishedName, RcgenError, PKCS_ECDSA_P256_SHA256}; +use rustls::sign::{any_ecdsa_type, CertifiedKey}; +use rustls::Certificate as RustlsCertificate; +use rustls::PrivateKey; use thiserror::Error; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::time::Sleep; use x509_parser::parse_x509_certificate; +use crate::acceptor::AcmeAcceptor; +use crate::acme::{ + Account, AcmeError, Auth, AuthStatus, Directory, Identifier, Order, OrderStatus, +}; +use crate::{AcmeConfig, Incoming, ResolvesServerCertAcme}; + type Timer = std::pin::Pin>; +type BoxFuture = Pin + Send>>; pub fn after(d: std::time::Duration) -> Timer { Box::pin(tokio::time::sleep(d)) @@ -33,10 +36,10 @@ pub struct AcmeState { resolver: Arc, account_key: Option>, - early_action: Option> + Send>>>, - load_cert: Option>, EC>> + Send>>>, - load_account: Option>, EA>> + Send>>>, - order: Option, OrderError>> + Send>>>, + early_action: Option>>, + load_cert: Option>, EC>>>, + load_account: Option>, EA>>>, + order: Option, OrderError>>>, backoff_cnt: usize, wait: Option, } @@ -178,6 +181,8 @@ impl AcmeState { let cert = CertifiedKey::new(cert_chain, pk); Ok((cert, validity)) } + + #[allow(clippy::result_large_err)] fn process_cert(&mut self, pem: Vec, cached: bool) -> Event { let (cert, validity) = match (Self::parse_cert(&pem), cached) { (Ok(r), _) => r,