pub struct RouterBuilder { /* private fields */ }Expand description
Builder for creating a Router for accepting protocols.
Implementations§
Source§impl RouterBuilder
impl RouterBuilder
Sourcepub fn incoming_filter(self, filter: IncomingFilter) -> Self
pub fn incoming_filter(self, filter: IncomingFilter) -> Self
Sets a filter that decides whether to accept an incoming connection before the TLS handshake completes.
The filter is called with the raw Incoming for each connection attempt
and returns an IncomingFilterOutcome that determines what happens next.
Implementers have full access to the Incoming and can use any of its
methods (including Incoming::decrypt) to make their decision. Note that
decrypt() is relatively expensive, so filters should reject based on
cheaper signals (e.g. remote address) first.
Sourcepub fn accept(
self,
alpn: impl AsRef<[u8]>,
handler: impl Into<Box<dyn DynProtocolHandler>>,
) -> Self
pub fn accept( self, alpn: impl AsRef<[u8]>, handler: impl Into<Box<dyn DynProtocolHandler>>, ) -> Self
Configures the router to accept the ProtocolHandler when receiving a connection
with this alpn.
handler can either be a type that implements ProtocolHandler or a
Box<dyn DynProtocolHandler>.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RouterBuilder
impl !RefUnwindSafe for RouterBuilder
impl Send for RouterBuilder
impl Sync for RouterBuilder
impl Unpin for RouterBuilder
impl UnsafeUnpin for RouterBuilder
impl !UnwindSafe for RouterBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more