pub struct Proxy { /* private fields */ }Expand description
PROXY listener.
Implementations§
Source§impl Proxy
impl Proxy
Sourcepub fn bind<A: Into<SocketAddr>>(
addr: A,
dispatcher: Arc<dyn Dispatcher>,
) -> Result<Self, NetError>
pub fn bind<A: Into<SocketAddr>>( addr: A, dispatcher: Arc<dyn Dispatcher>, ) -> Result<Self, NetError>
Bind a proxy listener to the given address.
Uses crate::net::listener::bind_dual_stack to honor v4 +
v6 wildcard semantics. The dispatcher is invoked for every
fully-parsed request from any accepted client.
§Errors
Forwarded from the underlying socket calls.
Sourcepub fn with_data_store(self, ds: DataStore) -> Self
pub fn with_data_store(self, ds: DataStore) -> Self
Override the datastore the per-client FSMs will parse.
Defaults to DataStore::Redis.
Sourcepub fn with_response_capacity(self, n: usize) -> Self
pub fn with_response_capacity(self, n: usize) -> Self
Override the response-channel capacity per client.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Local address of the listener.
Sourcepub fn listener(&self) -> &TcpListener
pub fn listener(&self) -> &TcpListener
Borrow the bound listener so callers can extract the fd-level socket handle when needed.
Sourcepub async fn run(
self,
cancel: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Result<(), NetError>
pub async fn run( self, cancel: Pin<Box<dyn Future<Output = ()> + Send>>, ) -> Result<(), NetError>
Drive the accept loop until the listener returns an error or the supplied cancel future resolves.
Each accepted socket is wrapped in a Conn tagged
ConnRole::Client and handed to a per-task client loop.
§Errors
Forwarded from the listener accept call.