pub enum Frame {
Open {
session: RelaySessionId,
service: String,
},
Data {
session: RelaySessionId,
from_opener: bool,
seq: u64,
bytes: Bytes,
},
Datagram {
session: RelaySessionId,
from_opener: bool,
bytes: Bytes,
},
Shutdown {
session: RelaySessionId,
from_opener: bool,
sent: u64,
},
Close {
session: RelaySessionId,
from_opener: bool,
},
}Expand description
The relay’s overlay wire message — the payload carried under a transport namespace.
One vocabulary for both kinds (TCP connections and UDP flows), differing only in how the bytes travel:
TCP Open(session, service) → Data(session, seq, bytes)* → Shutdown(session, sent)
→ Close(session)
UDP Open(session, service) → Datagram(session, bytes)* → Close(session)Law (no silent gap). A TCP direction’s Data frames carry seq = 0, 1, 2, … and its
Shutdown carries the number sent of them. The receiver writes bytes to its local socket
in seq order only, reordering at most REORDER_WINDOW frames ahead, so the local
stream is always a prefix of what the peer sent. A frame missing for REORDER_DEADLINE is
past the delivery bounds of its path, and one more than the window behind can never arrive
(the replay window refuses it), so either way the receiver resets the session: the peer gets
Close, and the local socket an abortive close. A Shutdown is applied only once every one
of its sent frames was written, so a lost last frame is a reset, never a clean end of
stream.
Open is always sent by the session’s opener. Data/Shutdown/Close flow in both
directions over the same opener-assigned id, so they carry from_opener — whether the
sender of this frame opened the session. The receiver flips it to recover its own
Initiator, so a peer’s session never collides with one of ours sharing the same id.
Variants§
Open
Open a session/flow to a named local service (always sent by the opener).
Fields
session: RelaySessionIdRelay session identifier (assigned by the opener).
Data
A segment of a TCP session’s byte stream, in its direction’s seq order.
Fields
session: RelaySessionIdRelay session the bytes belong to.
Datagram
One datagram of a UDP flow; datagrams carry no order and may be lost.
Fields
session: RelaySessionIdRelay flow the datagram belongs to.
Shutdown
Half-close: the sender has no more Data this direction (a TCP FIN). The receiver shuts
down its local write side once all sent segments are written, and keeps the reverse
direction open. Ignored by UDP (datagram flows have no half-close).
Fields
session: RelaySessionIdRelay session being half-closed.
Close
Close a session/flow (full teardown, both directions).
Fields
session: RelaySessionIdRelay session to close.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Frame
impl<'de> Deserialize<'de> for Frame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for Frame
impl Forget for Frame
impl Move for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.