Struct kvarn_quinn::Connecting
source · 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>
Convert into a 0-RTT or 0.5-RTT connection at the cost of weakened security
Opens up the connection for use before the handshake finishes, allowing the API user to send data with 0-RTT encryption if the necessary key material is available. This is useful for reducing start-up latency by beginning transmission of application data without waiting for the handshake’s cryptographic security guarantees to be established.
When the ZeroRttAccepted
future completes, the connection has been fully established.
§Security
On outgoing connections, this enables transmission of 0-RTT data, which might be vulnerable to replay attacks, and should therefore never invoke non-idempotent operations.
On incoming connections, this enables transmission of 0.5-RTT data, which might be intercepted by a man-in-the-middle. If this occurs, the handshake will not complete successfully.
§Errors
Outgoing connections are only 0-RTT-capable when a cryptographic session ticket cached from
a previous connection to the same server is available, and includes a 0-RTT key. If no such
ticket is found, self
is returned unmodified.
For incoming connections, a 0.5-RTT connection will always be successfully constructed.
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
The dynamic type returned is determined by the configured
Session
. For the default rustls
session, the return value can
be downcast
to a
crypto::rustls::HandshakeData
.
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.
Retrieving the local IP address is currently supported on the following platforms:
- Linux
- FreeBSD
- macOS
On all non-supported platforms the local IP address will not be available,
and the method will return None
.
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
.