pub trait RequestHandler: Send + Sync {
// Required method
fn handle_request(
&self,
src_addr: SrcAddr,
req: &mut HttpRequest,
) -> impl Future<Output = Result<EndpointId, Deny>> + Send;
}Expand description
Routes HTTP requests to upstream iroh endpoints.
Implement this trait to control how requests are routed. The handler receives the client address and request, and may modify the request (e.g., adding headers) before returning the destination endpoint.
Required Methods§
Sourcefn handle_request(
&self,
src_addr: SrcAddr,
req: &mut HttpRequest,
) -> impl Future<Output = Result<EndpointId, Deny>> + Send
fn handle_request( &self, src_addr: SrcAddr, req: &mut HttpRequest, ) -> impl Future<Output = Result<EndpointId, Deny>> + Send
Determines the upstream endpoint for this request.
May modify req to add proxy headers or transform the request.
Return Deny to reject the request with an error response.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.