Struct BridgeIo
pub struct BridgeIo<Io1, Io2>(pub Io1, pub Io2);Expand description
A bidirectional bridge between two Io objects.
Often this is for Client-Server communication, but in a P2P like topology it can also be equal nodes.
ExtensionsRef and ExtensionsMut is implemented
in function of Io1 as it is assumed that in flows where
BridgeIo is used that we keep moving from “left” (Io1)
to “right” (Io2) until we start to actually relay bytes,
handshakes or any kind of data.
If you ever use Io2’s extensions you can do so explicitly.
Tuple Fields§
§0: Io1§1: Io2Trait Implementations§
§impl<Io1, Io2> ExtensionsMut for BridgeIo<Io1, Io2>where
Io1: ExtensionsMut,
impl<Io1, Io2> ExtensionsMut for BridgeIo<Io1, Io2>where
Io1: ExtensionsMut,
§fn extensions_mut(&mut self) -> &mut Extensions
fn extensions_mut(&mut self) -> &mut Extensions
Get mutable reference to the underlying
Extensions store§impl<Io1, Io2> ExtensionsRef for BridgeIo<Io1, Io2>where
Io1: ExtensionsRef,
impl<Io1, Io2> ExtensionsRef for BridgeIo<Io1, Io2>where
Io1: ExtensionsRef,
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Get reference to the underlying
Extensions store§impl<Ingress, Egress> PeekIoProvider for BridgeIo<Ingress, Egress>
impl<Ingress, Egress> PeekIoProvider for BridgeIo<Ingress, Egress>
§type Mapped<PeekedIngress: Io> = BridgeIo<PeekedIngress, Egress>
type Mapped<PeekedIngress: Io> = BridgeIo<PeekedIngress, Egress>
The mapped
Self type produced as a result of
mapping the PeekIo type.§fn peek_io_mut(
&mut self,
) -> &mut <BridgeIo<Ingress, Egress> as PeekIoProvider>::PeekIo
fn peek_io_mut( &mut self, ) -> &mut <BridgeIo<Ingress, Egress> as PeekIoProvider>::PeekIo
Retrieve a mutable reference to the Peekable type.
§fn map_peek_io<PeekedIngress, F>(
self,
map: F,
) -> <BridgeIo<Ingress, Egress> as PeekIoProvider>::Mapped<PeekedIngress>where
PeekedIngress: Io,
F: FnOnce(<BridgeIo<Ingress, Egress> as PeekIoProvider>::PeekIo) -> PeekedIngress,
fn map_peek_io<PeekedIngress, F>(
self,
map: F,
) -> <BridgeIo<Ingress, Egress> as PeekIoProvider>::Mapped<PeekedIngress>where
PeekedIngress: Io,
F: FnOnce(<BridgeIo<Ingress, Egress> as PeekIoProvider>::PeekIo) -> PeekedIngress,
Once peeking is finished one can reproduce
self
by mapping the Peeked Io type and produce a new type,
usually with the peeked data in-memory as prefix.§impl<Ingress, Egress, M> Service<BridgeIo<Ingress, Egress>> for HttpMitmRelay<M>where
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
M: Layer<HttpClientService<Body>> + Send + Sync + 'static + Clone,
<M as Layer<HttpClientService<Body>>>::Service: Service<Request, Output = Response> + Clone,
<<M as Layer<HttpClientService<Body>>>::Service as Service<Request>>::Error: Into<Box<dyn Error + Send + Sync>>,
impl<Ingress, Egress, M> Service<BridgeIo<Ingress, Egress>> for HttpMitmRelay<M>where
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
M: Layer<HttpClientService<Body>> + Send + Sync + 'static + Clone,
<M as Layer<HttpClientService<Body>>>::Service: Service<Request, Output = Response> + Clone,
<<M as Layer<HttpClientService<Body>>>::Service as Service<Request>>::Error: Into<Box<dyn Error + Send + Sync>>,
§async fn serve(
&self,
__arg1: BridgeIo<Ingress, Egress>,
) -> Result<<HttpMitmRelay<M> as Service<BridgeIo<Ingress, Egress>>>::Output, <HttpMitmRelay<M> as Service<BridgeIo<Ingress, Egress>>>::Error>
async fn serve( &self, __arg1: BridgeIo<Ingress, Egress>, ) -> Result<<HttpMitmRelay<M> as Service<BridgeIo<Ingress, Egress>>>::Output, <HttpMitmRelay<M> as Service<BridgeIo<Ingress, Egress>>>::Error>
Serve an output or an error for the given input
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Box this service to allow for dynamic dispatch.
§impl<I, F, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for Socks5MitmRelayService<I, F>where
I: Service<BridgeIo<Ingress, Egress>, Output = ()>,
<I as Service<BridgeIo<Ingress, Egress>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<BridgeIo<Ingress, Egress>, Output = ()>,
<F as Service<BridgeIo<Ingress, Egress>>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
impl<I, F, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for Socks5MitmRelayService<I, F>where
I: Service<BridgeIo<Ingress, Egress>, Output = ()>,
<I as Service<BridgeIo<Ingress, Egress>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<BridgeIo<Ingress, Egress>, Output = ()>,
<F as Service<BridgeIo<Ingress, Egress>>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
§async fn serve(
&self,
__arg1: BridgeIo<Ingress, Egress>,
) -> Result<<Socks5MitmRelayService<I, F> as Service<BridgeIo<Ingress, Egress>>>::Output, <Socks5MitmRelayService<I, F> as Service<BridgeIo<Ingress, Egress>>>::Error>
async fn serve( &self, __arg1: BridgeIo<Ingress, Egress>, ) -> Result<<Socks5MitmRelayService<I, F> as Service<BridgeIo<Ingress, Egress>>>::Output, <Socks5MitmRelayService<I, F> as Service<BridgeIo<Ingress, Egress>>>::Error>
Serve an output or an error for the given input
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Box this service to allow for dynamic dispatch.
§impl<Issuer, Inner, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for TlsMitmRelayService<Issuer, Inner>where
Issuer: BoringMitmCertIssuer,
<Issuer as BoringMitmCertIssuer>::Error: Into<Box<dyn Error + Send + Sync>>,
Inner: Service<BridgeIo<TlsStream<Ingress>, TlsStream<Egress>>, Output = ()>,
<Inner as Service<BridgeIo<TlsStream<Ingress>, TlsStream<Egress>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
impl<Issuer, Inner, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for TlsMitmRelayService<Issuer, Inner>where
Issuer: BoringMitmCertIssuer,
<Issuer as BoringMitmCertIssuer>::Error: Into<Box<dyn Error + Send + Sync>>,
Inner: Service<BridgeIo<TlsStream<Ingress>, TlsStream<Egress>>, Output = ()>,
<Inner as Service<BridgeIo<TlsStream<Ingress>, TlsStream<Egress>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
§type Error = TlsMitmRelayError
type Error = TlsMitmRelayError
The type of error returned by the service.
§async fn serve(
&self,
input: BridgeIo<Ingress, Egress>,
) -> Result<<TlsMitmRelayService<Issuer, Inner> as Service<BridgeIo<Ingress, Egress>>>::Output, <TlsMitmRelayService<Issuer, Inner> as Service<BridgeIo<Ingress, Egress>>>::Error>
async fn serve( &self, input: BridgeIo<Ingress, Egress>, ) -> Result<<TlsMitmRelayService<Issuer, Inner> as Service<BridgeIo<Ingress, Egress>>>::Output, <TlsMitmRelayService<Issuer, Inner> as Service<BridgeIo<Ingress, Egress>>>::Error>
Serve an output or an error for the given input
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Box this service to allow for dynamic dispatch.
§impl<S, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for WebSocketRelayService<S>where
S: Service<WebSocketRelayInput>,
<S as Service<WebSocketRelayInput>>::Output: Into<WebSocketRelayOutput>,
<S as Service<WebSocketRelayInput>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
impl<S, Ingress, Egress> Service<BridgeIo<Ingress, Egress>> for WebSocketRelayService<S>where
S: Service<WebSocketRelayInput>,
<S as Service<WebSocketRelayInput>>::Output: Into<WebSocketRelayOutput>,
<S as Service<WebSocketRelayInput>>::Error: Into<Box<dyn Error + Send + Sync>>,
Ingress: Io + Unpin + ExtensionsMut,
Egress: Io + Unpin + ExtensionsMut,
§type Error = Infallible
type Error = Infallible
The type of error returned by the service.
§async fn serve(
&self,
__arg1: BridgeIo<Ingress, Egress>,
) -> Result<<WebSocketRelayService<S> as Service<BridgeIo<Ingress, Egress>>>::Output, <WebSocketRelayService<S> as Service<BridgeIo<Ingress, Egress>>>::Error>
async fn serve( &self, __arg1: BridgeIo<Ingress, Egress>, ) -> Result<<WebSocketRelayService<S> as Service<BridgeIo<Ingress, Egress>>>::Output, <WebSocketRelayService<S> as Service<BridgeIo<Ingress, Egress>>>::Error>
Serve an output or an error for the given input
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Box this service to allow for dynamic dispatch.
§impl<S, T> Service<BridgeIo<S, T>> for IoForwardService
impl<S, T> Service<BridgeIo<S, T>> for IoForwardService
§async fn serve(
&self,
__arg1: BridgeIo<S, T>,
) -> Result<<IoForwardService as Service<BridgeIo<S, T>>>::Output, <IoForwardService as Service<BridgeIo<S, T>>>::Error>
async fn serve( &self, __arg1: BridgeIo<S, T>, ) -> Result<<IoForwardService as Service<BridgeIo<S, T>>>::Output, <IoForwardService as Service<BridgeIo<S, T>>>::Error>
Serve an output or an error for the given input
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Box this service to allow for dynamic dispatch.
Auto Trait Implementations§
impl<Io1, Io2> Freeze for BridgeIo<Io1, Io2>
impl<Io1, Io2> RefUnwindSafe for BridgeIo<Io1, Io2>where
Io1: RefUnwindSafe,
Io2: RefUnwindSafe,
impl<Io1, Io2> Send for BridgeIo<Io1, Io2>
impl<Io1, Io2> Sync for BridgeIo<Io1, Io2>
impl<Io1, Io2> Unpin for BridgeIo<Io1, Io2>
impl<Io1, Io2> UnsafeUnpin for BridgeIo<Io1, Io2>where
Io1: UnsafeUnpin,
Io2: UnsafeUnpin,
impl<Io1, Io2> UnwindSafe for BridgeIo<Io1, Io2>where
Io1: UnwindSafe,
Io2: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more