pub struct SecretsHandler { /* private fields */ }Expand description
Handles secret placeholder substitution in TLS-intercepted plaintext.
Created from SecretsConfig and the destination SNI. Determines which
secrets are eligible for this connection based on host matching.
Implementations§
Source§impl SecretsHandler
impl SecretsHandler
Sourcepub fn new(config: &SecretsConfig, sni: &str, tls_intercepted: bool) -> Self
pub fn new(config: &SecretsConfig, sni: &str, tls_intercepted: bool) -> Self
Create a handler for a specific connection.
Filters secrets by host matching against the SNI. Only secrets
whose allowed_hosts match sni will be substituted.
tls_intercepted indicates whether this is a MITM connection
(true) or a bypass/plain connection (false).
Sourcepub fn substitute<'a>(
&mut self,
data: &'a [u8],
) -> Result<Cow<'a, [u8]>, ViolationAction>
pub fn substitute<'a>( &mut self, data: &'a [u8], ) -> Result<Cow<'a, [u8]>, ViolationAction>
Substitute secrets in plaintext data (guest → server direction).
Splits the HTTP message on \r\n\r\n to scope substitution:
headers: substitutes in the header portion (before boundary)basic_auth: substitutes in Authorization headers specificallyquery_params: substitutes in the request line (first line, query portion)body: substitutes in the body portion (after boundary)
Returns the violation action if a placeholder is detected going to a disallowed host.
Auto Trait Implementations§
impl Freeze for SecretsHandler
impl RefUnwindSafe for SecretsHandler
impl Send for SecretsHandler
impl Sync for SecretsHandler
impl Unpin for SecretsHandler
impl UnsafeUnpin for SecretsHandler
impl UnwindSafe for SecretsHandler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more