Skip to content

Commit

Permalink
move ocsp stapler to a separate crate
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-oracle committed May 24, 2024
1 parent 6067fe9 commit e761fd0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 529 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ maxminddb = "0.24"
mockall = "0.12"
moka = { version = "0.12", features = ["sync", "future"] }
num-bigint = { version = "0.4.5", features = ["serde"] }
ocsp-stapler = "0.1"
once_cell = "1.19"
prometheus = "0.13"
rand = "0.8"
Expand Down
11 changes: 10 additions & 1 deletion src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use derive_new::new;
use tokio_util::{sync::CancellationToken, task::TaskTracker};
use tracing::error;

use crate::http;
use crate::{http, tls::cert};

// Long running task that can be cancelled by a token
#[async_trait]
Expand Down Expand Up @@ -54,3 +54,12 @@ impl Run for http::Server {
self.serve(token).await
}
}

#[async_trait]
impl Run for ocsp_stapler::Stapler {
async fn run(&self, token: CancellationToken) -> Result<(), Error> {
token.cancelled().await;
self.stop().await;
Ok(())
}
}
4 changes: 2 additions & 2 deletions src/tls/cert/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod ocsp;
pub mod providers;
pub mod storage;

Expand All @@ -22,9 +21,10 @@ use x509_parser::prelude::*;

use crate::tasks::Run;
use providers::ProvidesCertificates;
pub use storage::Storage;
use storage::StoresCertificates;

pub use storage::Storage;

#[derive(Clone, Debug)]
pub struct CustomDomain {
name: String,
Expand Down
Loading

0 comments on commit e761fd0

Please sign in to comment.