wip: implemented crypto reloader, as separated object from proxy itself

This commit is contained in:
Jun Kurihara 2023-11-24 19:17:02 +09:00
commit 5576389acb
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
13 changed files with 468 additions and 56 deletions

View file

@ -1,9 +1,14 @@
use crate::{certs::CryptoSource, constants::*, count::RequestCount};
use crate::{
constants::*,
count::RequestCount,
crypto::{CryptoSource, ServerCryptoBase},
};
use hot_reload::ReloaderReceiver;
use std::{net::SocketAddr, sync::Arc, time::Duration};
/// Global object containing proxy configurations and shared object like counters.
/// But note that in Globals, we do not have Mutex and RwLock. It is indeed, the context shared among async tasks.
pub struct Globals {
pub(crate) struct Globals {
/// Configuration parameters for proxy transport and request handlers
pub proxy_config: ProxyConfig,
/// Shared context - Counter for serving requests
@ -12,6 +17,8 @@ pub struct Globals {
pub runtime_handle: tokio::runtime::Handle,
/// Shared context - Notify object to stop async tasks
pub term_notify: Option<Arc<tokio::sync::Notify>>,
/// Shared context - Certificate reloader service receiver
pub cert_reloader_rx: Option<ReloaderReceiver<ServerCryptoBase>>,
}
/// Configuration parameters for proxy transport and request handlers