mitm_layer

Function mitm_layer 

Source
pub fn mitm_layer<F>(f: F) -> MitmLayer<F>
where F: FnMut(Request<Body>, ThirdWheel) -> Pin<Box<dyn Future<Output = Result<Response<Body>, Error>> + Send>> + Clone,
Expand description

A convenience function for generating man-in-the-middle services

This function generates a struct that implements the necessary traits to be used as a man-in-the-middle service and will suffice for many use cases.

let mitm = mitm_layer(|req: Request<Body>, mut third_wheel: ThirdWheel| third_wheel.call(req));
let mitm_proxy = MitmProxy::builder(mitm, ca).build();