pub trait ProxyBackend:
Send
+ Sync
+ 'static {
// Required method
fn execute(
&self,
request: ProxyRequest,
cancellation: &CancellationToken,
) -> Result<ProxyResponse, BackendError>;
// Provided methods
fn open_connect(
&self,
_request: ProxyRequest,
_cancellation: &CancellationToken,
) -> Result<ProxyConnectOpen, BackendError> { ... }
fn open_tunnel(
&self,
_request: ProxyRequest,
_cancellation: &CancellationToken,
) -> Result<ProxyTunnelOpen, BackendError> { ... }
}Required Methods§
Sourcefn execute(
&self,
request: ProxyRequest,
cancellation: &CancellationToken,
) -> Result<ProxyResponse, BackendError>
fn execute( &self, request: ProxyRequest, cancellation: &CancellationToken, ) -> Result<ProxyResponse, BackendError>
Executes one admitted request. Implementations must observe
cancellation and bound every network/storage wait so proxy shutdown
can join all work. Implementations must not panic: shipping profiles
abort on panic. Errors must remain payload-free at this boundary.
Provided Methods§
Sourcefn open_connect(
&self,
_request: ProxyRequest,
_cancellation: &CancellationToken,
) -> Result<ProxyConnectOpen, BackendError>
fn open_connect( &self, _request: ProxyRequest, _cancellation: &CancellationToken, ) -> Result<ProxyConnectOpen, BackendError>
Resolves the outer CONNECT before local TLS termination. The default preserves interception. Implementations may return passthrough only after making the same namespace and TLS policy decision used by normal gateway requests.
Sourcefn open_tunnel(
&self,
_request: ProxyRequest,
_cancellation: &CancellationToken,
) -> Result<ProxyTunnelOpen, BackendError>
fn open_tunnel( &self, _request: ProxyRequest, _cancellation: &CancellationToken, ) -> Result<ProxyTunnelOpen, BackendError>
Opens one admitted HTTP Upgrade tunnel. Implementations must apply the
same resolution, address, TLS, and DANE policy as Self::execute,
observe cancellation, and satisfy the bounded-I/O contract documented
on ProxyTunnel. The default fails closed for compatibility with
backends that only implement request/response traffic.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".