pub struct ProxyServiceBuilder<SV, C>{ /* private fields */ }Expand description
A builder for a Service that can be used to create a HttpProxy instance
The ProxyServiceBuilder can be used to construct a HttpProxy service with a custom name, connector, and custom session handler.
Implementations§
Source§impl<SV> ProxyServiceBuilder<SV, ()>
impl<SV> ProxyServiceBuilder<SV, ()>
Sourcepub fn new(conf: &Arc<ServerConf>, inner: SV) -> Self
pub fn new(conf: &Arc<ServerConf>, inner: SV) -> Self
Create a new ProxyServiceBuilder with the given ServerConf and ProxyHttp implementation.
The returned builder can be used to construct a HttpProxy service with a custom name, connector, and custom session handler.
The ProxyServiceBuilder will default to using the ProxyHttp implementation and no custom session handler.
Source§impl<SV, C> ProxyServiceBuilder<SV, C>
impl<SV, C> ProxyServiceBuilder<SV, C>
Sourcepub fn custom<C2: Connector>(
self,
connector: C2,
on_custom: ProcessCustomSession<SV, C2>,
) -> ProxyServiceBuilder<SV, C2>
pub fn custom<C2: Connector>( self, connector: C2, on_custom: ProcessCustomSession<SV, C2>, ) -> ProxyServiceBuilder<SV, C2>
Set a custom connector and custom session handler for the ProxyServiceBuilder.
The custom connector is used to establish a connection to the upstream server.
The custom session handler is used to handle custom protocol specific logic between the proxy and the upstream server.
Returns a new ProxyServiceBuilder with the custom connector and session handler.
Sourcepub fn server_options(self, options: HttpServerOptions) -> Self
pub fn server_options(self, options: HttpServerOptions) -> Self
Set the server options for the ProxyServiceBuilder.
Returns a new ProxyServiceBuilder with the server options set.
Sourcepub fn build(self) -> Service<HttpProxy<SV, C>>
pub fn build(self) -> Service<HttpProxy<SV, C>>
Builds a new Service from the ProxyServiceBuilder.
This function takes ownership of the ProxyServiceBuilder and returns a new Service with a fully initialized HttpProxy.
The returned Service is ready to be used by a pingora_core::server::Server.