Struct http_mitm_proxy::MitmProxy
source · pub struct MitmProxy<C> {
pub root_cert: Option<C>,
pub tls_connector: TlsConnector,
}Expand description
The main struct to run proxy server
Fields§
§root_cert: Option<C>Root certificate to sign fake certificates. You may need to trust this certificate on client application to use HTTPS.
If None, proxy will just tunnel HTTPS traffic and will not observe HTTPS traffic.
tls_connector: TlsConnectorTLS connector to connect from proxy to server.
Implementations§
source§impl<C> MitmProxy<C>
impl<C> MitmProxy<C>
pub fn new(root_cert: Option<C>, tls_connector: TlsConnector) -> Self
source§impl<C: Borrow<CertifiedKey> + Send + Sync + 'static> MitmProxy<C>
impl<C: Borrow<CertifiedKey> + Send + Sync + 'static> MitmProxy<C>
sourcepub async fn bind<A: ToSocketAddrs, B>(
self,
addr: A,
) -> Result<(impl Stream<Item = Communication<B>>, impl Future<Output = ()>), Error>
pub async fn bind<A: ToSocketAddrs, B>( self, addr: A, ) -> Result<(impl Stream<Item = Communication<B>>, impl Future<Output = ()>), Error>
Bind proxy server to address. You can observe communications between client and server by receiving stream. To run proxy server, you need to run returned future. This API design give you an ability to cancel proxy server when you want.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for MitmProxy<C>where
C: Freeze,
impl<C> RefUnwindSafe for MitmProxy<C>where
C: RefUnwindSafe,
impl<C> Send for MitmProxy<C>where
C: Send,
impl<C> Sync for MitmProxy<C>where
C: Sync,
impl<C> Unpin for MitmProxy<C>where
C: Unpin,
impl<C> UnwindSafe for MitmProxy<C>where
C: UnwindSafe,
Blanket Implementations§
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