pub struct RouterBuilder { /* private fields */ }Expand description
Builder for creating a Router for accepting protocols.
Implementations§
Source§impl RouterBuilder
impl RouterBuilder
Sourcepub fn new(endpoint: Endpoint) -> RouterBuilder
pub fn new(endpoint: Endpoint) -> RouterBuilder
Creates a new router builder using given Endpoint.
Sourcepub fn incoming_filter(
self,
filter: Arc<dyn Fn(&Incoming) -> IncomingFilterOutcome + Sync + Send>,
) -> RouterBuilder
pub fn incoming_filter( self, filter: Arc<dyn Fn(&Incoming) -> IncomingFilterOutcome + Sync + Send>, ) -> RouterBuilder
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>>,
) -> RouterBuilder
pub fn accept( self, alpn: impl AsRef<[u8]>, handler: impl Into<Box<dyn DynProtocolHandler>>, ) -> RouterBuilder
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 !RefUnwindSafe for RouterBuilder
impl !UnwindSafe for RouterBuilder
impl Freeze for RouterBuilder
impl Send for RouterBuilder
impl Sync for RouterBuilder
impl Unpin for RouterBuilder
impl UnsafeUnpin for RouterBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more