Struct HttpDatagramRelay
pub struct HttpDatagramRelay { /* private fields */ }http and std only.Expand description
Forward a tunnel whose application explicitly selected HTTP Datagram semantics.
Reliable DATAGRAM capsules stay reliable unless Self::with_prefer_native
is set. Native datagrams use the next hop’s native carrier when available and
DATAGRAM capsules otherwise. Unknown capsule values stream within the configured
read bound; their integer headers are re-encoded minimally, as by
SessionSender::start_capsule.
While a capsule value is in progress, native input stays in the transport’s
bounded queue. No additional datagram queue or whole-capsule buffer is added.
A closed destination ends only its sending direction; its sibling can drain.
By default, inactivity ends a relay after two minutes, and once the input of one
direction ended the relay has five seconds to finish, the close of that direction
included: a peer that never lets a close end does not hold the relay. Both deadlines
are configurable.
Other errors and cancellation abort both I/Os when they publish their own AbortIo.
Ordinary byte tunnels should use IoForwardService instead.
Implementations§
§impl HttpDatagramRelay
impl HttpDatagramRelay
pub fn new(config: SessionConfig) -> HttpDatagramRelay
pub fn new(config: SessionConfig) -> HttpDatagramRelay
Use the supplied read/datagram/control limits and native send policy. Unknown capsules are always forwarded, rather than skipped as at an endpoint.
pub fn maybe_with_idle_timeout(
self,
timeout: Option<Duration>,
) -> HttpDatagramRelay
pub fn maybe_with_idle_timeout( self, timeout: Option<Duration>, ) -> HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn maybe_set_idle_timeout(
&mut self,
timeout: Option<Duration>,
) -> &mut HttpDatagramRelay
pub fn maybe_set_idle_timeout( &mut self, timeout: Option<Duration>, ) -> &mut HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn with_idle_timeout(self, timeout: Duration) -> HttpDatagramRelay
pub fn with_idle_timeout(self, timeout: Duration) -> HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut HttpDatagramRelay
pub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn without_idle_timeout(self) -> HttpDatagramRelay
pub fn without_idle_timeout(self) -> HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn unset_idle_timeout(&mut self) -> &mut HttpDatagramRelay
pub fn unset_idle_timeout(&mut self) -> &mut HttpDatagramRelay
Bound inactivity across both directions. Successful forwarding resets it;
discarded datagrams do not. Defaults to two minutes; None disables it.
pub fn maybe_with_close_timeout(
self,
timeout: Option<Duration>,
) -> HttpDatagramRelay
pub fn maybe_with_close_timeout( self, timeout: Option<Duration>, ) -> HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn maybe_set_close_timeout(
&mut self,
timeout: Option<Duration>,
) -> &mut HttpDatagramRelay
pub fn maybe_set_close_timeout( &mut self, timeout: Option<Duration>, ) -> &mut HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn with_close_timeout(self, timeout: Duration) -> HttpDatagramRelay
pub fn with_close_timeout(self, timeout: Duration) -> HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn set_close_timeout(&mut self, timeout: Duration) -> &mut HttpDatagramRelay
pub fn set_close_timeout(&mut self, timeout: Duration) -> &mut HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn without_close_timeout(self) -> HttpDatagramRelay
pub fn without_close_timeout(self) -> HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn unset_close_timeout(&mut self) -> &mut HttpDatagramRelay
pub fn unset_close_timeout(&mut self) -> &mut HttpDatagramRelay
Bound what is left of the relay once the input of one direction ended: the
close of that direction and the remaining one. Defaults to five seconds;
None allows it to drain without a close deadline.
pub fn with_prefer_native(self, prefer: bool) -> HttpDatagramRelay
pub fn with_prefer_native(self, prefer: bool) -> HttpDatagramRelay
Forward DATAGRAM capsules on the next hop’s native carrier when available,
dropping them like native datagrams when it refuses them. RFC 9297 §3.5
allows this re-encoding, which can lose or reorder datagrams.
Defaults to false.
pub fn set_prefer_native(&mut self, prefer: bool) -> &mut HttpDatagramRelay
pub fn set_prefer_native(&mut self, prefer: bool) -> &mut HttpDatagramRelay
Forward DATAGRAM capsules on the next hop’s native carrier when available,
dropping them like native datagrams when it refuses them. RFC 9297 §3.5
allows this re-encoding, which can lose or reorder datagrams.
Defaults to false.
pub fn with_scope(self, scope: impl Into<WeakScope>) -> HttpDatagramRelay
pub fn with_scope(self, scope: impl Into<WeakScope>) -> HttpDatagramRelay
Stop both streams at this scope’s hard phase; they keep relaying through its graceful phase. A relay that is closing holds the scope until it finished.
pub fn set_scope(
&mut self,
scope: impl Into<WeakScope>,
) -> &mut HttpDatagramRelay
pub fn set_scope( &mut self, scope: impl Into<WeakScope>, ) -> &mut HttpDatagramRelay
Stop both streams at this scope’s hard phase; they keep relaying through its graceful phase. A relay that is closing holds the scope until it finished.
Trait Implementations§
§impl Clone for HttpDatagramRelay
impl Clone for HttpDatagramRelay
§fn clone(&self) -> HttpDatagramRelay
fn clone(&self) -> HttpDatagramRelay
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HttpDatagramRelay
impl Debug for HttpDatagramRelay
§impl Default for HttpDatagramRelay
impl Default for HttpDatagramRelay
§fn default() -> HttpDatagramRelay
fn default() -> HttpDatagramRelay
§impl<L, R> Service<BridgeIo<L, R>> for HttpDatagramRelay
impl<L, R> Service<BridgeIo<L, R>> for HttpDatagramRelay
§type Output = DatagramRelayOutcome
type Output = DatagramRelayOutcome
§type Error = SessionError
type Error = SessionError
§fn serve(
&self,
_: BridgeIo<L, R>,
) -> impl Future<Output = Result<<HttpDatagramRelay as Service<BridgeIo<L, R>>>::Output, <HttpDatagramRelay as Service<BridgeIo<L, R>>>::Error>> + Send
fn serve( &self, _: BridgeIo<L, R>, ) -> impl Future<Output = Result<<HttpDatagramRelay as Service<BridgeIo<L, R>>>::Output, <HttpDatagramRelay as Service<BridgeIo<L, R>>>::Error>> + Send
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl !RefUnwindSafe for HttpDatagramRelay
impl !UnwindSafe for HttpDatagramRelay
impl Forget for HttpDatagramRelay
impl Freeze for HttpDatagramRelaywhere
*const [CapsuleType] is !null: Freeze,
PhantomData<[CapsuleType]>: Freeze,
*const ArcInner<Node> is !null: Freeze,
PhantomData<ArcInner<Node>>: Freeze,
*const ArcInner<Composite> is !null: Freeze,
PhantomData<ArcInner<Composite>>: Freeze,
impl Move for HttpDatagramRelay
impl Send for HttpDatagramRelay
impl Sync for HttpDatagramRelay
impl Unpin for HttpDatagramRelay
impl UnsafeUnpin for HttpDatagramRelaywhere
*const [CapsuleType] is !null: UnsafeUnpin,
PhantomData<[CapsuleType]>: UnsafeUnpin,
*const ArcInner<Node> is !null: UnsafeUnpin,
PhantomData<ArcInner<Node>>: UnsafeUnpin,
*const ArcInner<Composite> is !null: UnsafeUnpin,
PhantomData<ArcInner<Composite>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<Io, S> MakeMockServer<Io, ServerClone> for S
impl<Io, S> MakeMockServer<Io, ServerClone> for S
type Server = S
fn make_server(&self, _: &ConnectRequest) -> S
§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>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more