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.
Auto Trait Implementations§
impl !Freeze for Proxy
impl !RefUnwindSafe for Proxy
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl UnsafeUnpin for Proxy
impl !UnwindSafe for Proxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.