use super::{TlsAcceptorData, TlsAcceptorService};
use rama_core::Layer;
#[derive(Debug, Clone)]
pub struct TlsAcceptorLayer {
data: TlsAcceptorData,
store_client_hello: bool,
}
impl TlsAcceptorLayer {
pub const fn new(data: TlsAcceptorData) -> Self {
Self {
data,
store_client_hello: false,
}
}
pub const fn with_store_client_hello(mut self, store: bool) -> Self {
self.store_client_hello = store;
self
}
pub fn set_store_client_hello(&mut self, store: bool) -> &mut Self {
self.store_client_hello = store;
self
}
}
impl<S> Layer<S> for TlsAcceptorLayer {
type Service = TlsAcceptorService<S>;
fn layer(&self, inner: S) -> Self::Service {
TlsAcceptorService::new(self.data.clone(), inner, self.store_client_hello)
}
fn into_layer(self, inner: S) -> Self::Service {
TlsAcceptorService::new(self.data, inner, self.store_client_hello)
}
}