pub struct Connecting(/* private fields */);
Expand description
In-progress connection attempt future
Implementations§
Source§impl Connecting
impl Connecting
Sourcepub fn local_ip(&self) -> Option<IpAddr>
pub fn local_ip(&self) -> Option<IpAddr>
The local IP address which was used when the peer established the connection.
This can be different from the address the endpoint is bound to, in case
the endpoint is bound to a wildcard address like 0.0.0.0
or ::
.
This will return None
for clients, or when the platform does not
expose this information.
Sourcepub fn remote_address(&self) -> SocketAddr
pub fn remote_address(&self) -> SocketAddr
The peer’s UDP address.
Will panic if called after poll
has returned Ready
.
Sourcepub fn rtt(&self) -> Duration
pub fn rtt(&self) -> Duration
Current best estimate of this connection’s latency (round-trip-time).
Sourcepub fn stats(&self) -> ConnectionStats
pub fn stats(&self) -> ConnectionStats
Connection statistics.
Sourcepub fn congestion_state(&self) -> Box<dyn Controller>
pub fn congestion_state(&self) -> Box<dyn Controller>
Current state of the congestion control algorithm. (For debugging purposes)
Sourcepub fn peer_identity(&self) -> Option<Box<Vec<CertificateDer<'static>>>>
pub fn peer_identity(&self) -> Option<Box<Vec<CertificateDer<'static>>>>
Cryptographic identity of the peer.
Sourcepub fn export_keying_material(
&self,
output: &mut [u8],
label: &[u8],
context: &[u8],
) -> Result<(), ExportKeyingMaterialError>
pub fn export_keying_material( &self, output: &mut [u8], label: &[u8], context: &[u8], ) -> Result<(), ExportKeyingMaterialError>
Derive keying material from this connection’s TLS session secrets.
When both peers call this method with the same label
and context
arguments and output
buffers of equal length, they will get the
same sequence of bytes in output
. These bytes are cryptographically
strong and pseudorandom, and are suitable for use as keying material.
This function fails if called with an empty output
or called prior to
the handshake completing.
See RFC5705 for more information.
Sourcepub async fn handshake_data(
&mut self,
) -> Result<Box<HandshakeData>, ConnectionError>
Available on rustls
only.
pub async fn handshake_data( &mut self, ) -> Result<Box<HandshakeData>, ConnectionError>
rustls
only.Parameters negotiated during the handshake.
Sourcepub fn into_0rtt(self) -> Result<Connection, Self>
pub fn into_0rtt(self) -> Result<Connection, Self>
Convert 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 Connection::accepted_0rtt
method resolves when the handshake
does complete, at which point subsequently opened streams and written
data will have full cryptographic protection.
§Outgoing
For outgoing connections, the initial attempt to convert to a
Connection
which sends 0-RTT data will proceed if the
crypto::ClientConfig
attempts 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
Connection::accepted_0rtt
method–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
Connection::accepted_0rtt
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.
Trait Implementations§
Source§impl Debug for Connecting
impl Debug for Connecting
Source§impl Drop for Connecting
impl Drop for Connecting
Source§impl Future for Connecting
impl Future for Connecting
Source§type Output = Result<Connection, ConnectionError>
type Output = Result<Connection, ConnectionError>
Auto Trait Implementations§
impl Freeze for Connecting
impl RefUnwindSafe for Connecting
impl Send for Connecting
impl Sync for Connecting
impl Unpin for Connecting
impl UnwindSafe for Connecting
Blanket Implementations§
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> 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 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
>.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 more