pub struct MitmProxy<C> {
pub root_cert: Option<C>,
pub cert_cache: Option<Cache<String, CertifiedKeyDer>>,
}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.
cert_cache: Option<Cache<String, CertifiedKeyDer>>Cache to store generated certificates. If None, cache will not be used. If root_cert is None, cache will not be used.
The key of cache is hostname.
Implementations§
Source§impl<C> MitmProxy<C>
impl<C> MitmProxy<C>
Sourcepub async fn bind<A: ToSocketAddrs, S>(
self,
addr: A,
service: S,
) -> Result<impl Future<Output = ()>, Error>
pub async fn bind<A: ToSocketAddrs, S>( self, addr: A, service: S, ) -> Result<impl Future<Output = ()>, Error>
Bind to a socket address and return a future that runs the proxy server. URL for requests that passed to service are full URL including scheme.
Sourcepub fn wrap_service<S>(
proxy: Arc<Self>,
service: S,
) -> impl HttpService<Incoming, ResBody = BoxBody<<S::ResBody as Body>::Data, <S::ResBody as Body>::Error>, Future: Send>
pub fn wrap_service<S>( proxy: Arc<Self>, service: S, ) -> impl HttpService<Incoming, ResBody = BoxBody<<S::ResBody as Body>::Data, <S::ResBody as Body>::Error>, Future: Send>
Transform a service to a service that can be used in hyper server.
URL for requests that passed to service are full URL including scheme.
See examples/https.rs for usage.
If you want to serve simple HTTP proxy server, you can use bind method instead.
bind will call this method internally.