diff --git a/src/api/mod.rs b/src/api/mod.rs index d153df8..69204c3 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use reqwest::Url; use responses::{ AddChainRequest, @@ -11,18 +13,25 @@ pub mod endpoints; pub mod responses; pub struct CtApiClient { - inner_client: reqwest::Client, + inner_client: Arc, log_url: Url } impl CtApiClient { pub fn new(log_url: Url) -> reqwest::Result { Ok(Self { - inner_client: reqwest::Client::builder().https_only(true).build()?, + inner_client: Arc::new(reqwest::Client::builder().https_only(true).build()?), log_url }) } + pub fn new_with_client(log_url: Url, inner_client: Arc) -> Self { + Self { + inner_client, + log_url + } + } + /// Adds a standard x509 chain to the CT log. The log will then return /// information needed to construct a valid SCT entry, including timestamp, /// CT log signature, sct version, and any log operator extensions.