Enum multistream_select::Version
source · [−]pub enum Version {
V1,
V1Lazy,
}
Expand description
Supported multistream-select versions.
Variants
V1
V1Lazy
A “lazy” variant of version 1 that is identical on the wire but whereby the dialer delays flushing protocol negotiation data in order to combine it with initial application data, thus performing 0-RTT negotiation.
This strategy is only applicable for the node with the role of “dialer”
in the negotiation and only if the dialer supports just a single
application protocol. In that case the dialer immedidately “settles”
on that protocol, buffering the negotiation messages to be sent
with the first round of application protocol data (or an attempt
is made to read from the Negotiated
I/O stream).
A listener will behave identically to V1
. This ensures interoperability with V1
.
Notably, it will immediately send the multistream header as well as the protocol
confirmation, resulting in multiple frames being sent on the underlying transport.
Nevertheless, if the listener supports the protocol that the dialer optimistically
settled on, it can be a 0-RTT negotiation.
Note:
V1Lazy
is specific torust-libp2p
. The wire protocol is identical toV1
and generally interoperable with peers only supportingV1
. Nevertheless, there is a pitfall that is rarely encountered: When nesting multiple protocol negotiations, the listener should either be known to support all of the dialer’s optimistically chosen protocols or there is must be no intermediate protocol without a payload and none of the protocol payloads must have the potential for being mistaken for a multistream-select protocol message. This avoids rare edge-cases whereby the listener may not recognize upgrade boundaries and erroneously process a request despite not supporting one of the intermediate protocols that the dialer committed to. See 1 and 2.
Trait Implementations
impl Copy for Version
impl Eq for Version
impl StructuralEq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more