pub struct Connecting { /* private fields */ }Expand description
In-progress connection attempt future
Implementations§
Source§impl Connecting
impl Connecting
Sourcepub fn into_0rtt(self) -> Result<(Connection, ZeroRttAccepted), Self>
pub fn into_0rtt(self) -> Result<(Connection, ZeroRttAccepted), Self>
Converts this Connecting into a 0-RTT or 0.5-RTT connection at the cost of weakened
security.
Returns Ok immediately if the local endpoint is able to attempt sending 0/0.5-RTT data.
If so, the returned Connection can be used to send application data without waiting for
the rest of the handshake to complete, at the cost of weakened cryptographic security
guarantees. The returned ZeroRttAccepted future resolves when the handshake does
complete, at which point subsequently opened streams and written data will have full
cryptographic protection.
Once the ZeroRttAccepted future completed, a full handshake has been carried through
and any data sent and any streams opened on the Connection will operate with the same
security as on normal 1-RTT connections.
§Outgoing
For outgoing connections, the initial attempt to convert to a Connection which sends
0-RTT data will attempt to resume a previous TLS session. However, the remote endpoint
may not actually accept the 0-RTT data–yet still accept the connection attempt in
general. This possibility is conveyed through the ZeroRttAccepted future–when the
handshake completes, it resolves to true if the 0-RTT data was accepted and false if it was
rejected. If it was rejected, the existence of streams opened and other application data
sent prior to the handshake completing will not be conveyed to the remote application, and
local operations on them will return ZeroRttRejected errors.
A server may reject 0-RTT data at its discretion, but accepting 0-RTT data requires the relevant resumption state to be stored in the server, which servers may limit or lose for various reasons including not persisting resumption state across server restarts.
§Incoming
For incoming connections, conversion to 0.5-RTT will always fully succeed. into_0rtt will
always return Ok and the ZeroRttAccepted will always resolve to true.
§Security
On outgoing connections, this enables transmission of 0-RTT data, which is vulnerable to replay attacks, and should therefore never invoke non-idempotent operations.
On incoming connections, this enables transmission of 0.5-RTT data, which may be sent before TLS client authentication has occurred, and should therefore not be used to send data for which client authentication is being used.
You can use RecvStream::is_0rtt to check whether a stream has been opened in 0-RTT
and thus whether parts of the stream are operating under this reduced security level.
Sourcepub async fn handshake_data(&mut self) -> Result<Box<dyn Any>, ConnectionError>
pub async fn handshake_data(&mut self) -> Result<Box<dyn Any>, ConnectionError>
Parameters negotiated during the handshake
Trait Implementations§
Source§impl Debug for Connecting
impl Debug for Connecting
Source§impl Future for Connecting
impl Future for Connecting
Source§type Output = Result<Connection, ConnectionError>
type Output = Result<Connection, ConnectionError>
impl<'pin> Unpin for Connectingwhere
PinnedFieldsOf<__Connecting<'pin>>: Unpin,
Auto Trait Implementations§
impl Freeze for Connecting
impl !RefUnwindSafe for Connecting
impl Send for Connecting
impl Sync for Connecting
impl !UnwindSafe for Connecting
Blanket Implementations§
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<F> FutureExt for F
impl<F> FutureExt for F
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
CancellationToken::run_until_cancelled,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken to complete. Read moreSource§fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
CancellationToken::run_until_cancelled_owned,
but with the advantage that it is easier to write fluent call chains,
and biased towards waiting for CancellationToken to complete. Read moreSource§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll will never again be called once it has
completed. This method can be used to turn any Future into a
FusedFuture. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
() on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = ()>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = Never>.