Skip to main content

ProxyLayer

Trait ProxyLayer 

Source
pub trait ProxyLayer: Send + Sync {
    // Required methods
    fn on_request<'life0, 'async_trait>(
        &'life0 self,
        request: ProxyRequest,
    ) -> Pin<Box<dyn Future<Output = ProxyResult<LayerAction>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &str;

    // Provided method
    fn on_response<'life0, 'async_trait>(
        &'life0 self,
        response: ProxyResponse,
    ) -> Pin<Box<dyn Future<Output = ProxyResult<ProxyResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A single middleware layer in the proxy pipeline.

Layers form an onion: requests flow inward through on_request(), responses flow outward through on_response() in reverse order.

Required Methods§

Source

fn on_request<'life0, 'async_trait>( &'life0 self, request: ProxyRequest, ) -> Pin<Box<dyn Future<Output = ProxyResult<LayerAction>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process an incoming request. Return Forward to pass it on, or Respond to short-circuit with an immediate response.

Source

fn name(&self) -> &str

Human-readable name for logging.

Provided Methods§

Source

fn on_response<'life0, 'async_trait>( &'life0 self, response: ProxyResponse, ) -> Pin<Box<dyn Future<Output = ProxyResult<ProxyResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process a response before it’s sent back to the client. Called in reverse layer order.

Implementors§