pub enum ConnectionStatus {
CookieRequesting {
cookie_request_id: u64,
packet: StatusPacketWithTime,
},
HandshakeSending {
sent_nonce: Nonce,
packet: StatusPacketWithTime,
},
NotConfirmed {
sent_nonce: Nonce,
received_nonce: Nonce,
session_precomputed_key: PrecomputedKey,
packet: StatusPacketWithTime,
},
Established {
sent_nonce: Nonce,
received_nonce: Nonce,
session_precomputed_key: PrecomputedKey,
},
}
Expand description
Status of crypto connection.
Initial state is CookieRequesting
. In this status we send up to 8
CookieRequest
packets every second and waiting for a CookieResponse
packet.
After receiving a CookieResponse
packet we change the status to
HandshakeSending
in which we send up to 8 CryptoHandshake
packets every
second and waiting for CryptoHandshake
packet from the other side. When we
received CryptoHandshake
packet we change the status to NotConfirmed
and
continue sending CryptoHandshake
packets because we don’t know if the other
side received our CryptoHandshake
packet. Only after receiving first
CryptoData
packet we change status to Established
and stop sending
CryptoHandshake
packets. In this status connection is considered as fully
established.
It’s also possible that we received CryptoHandshake
packet but didn’t create
crypto connection yet. This means that we should skip first two states and use
NotConfirmed
state as initial. We can do it because CryptoHandshake
contains
Cookie
that we can use to send our CryptoHandshake
.
Variants§
CookieRequesting
We are sending cookie request packets and haven’t received cookie response yet.
Fields
ID used in the cookie request packets for this connection
packet: StatusPacketWithTime
Packet that should be sent every second
HandshakeSending
We are sending handshake packets and haven’t received handshake from the other side yet.
Fields
packet: StatusPacketWithTime
Packet that should be sent every second
NotConfirmed
A handshake packet has been received from the other side but no encrypted packets. Continue sending handshake packets because we can’t know if the other side has received them.
Fields
session_precomputed_key: PrecomputedKey
PrecomputedKey
for this session that is used to encrypt and
decrypt data packets
packet: StatusPacketWithTime
Packet that should be sent every second
Established
A valid encrypted packet has been received from the other side. Connection is fully established.
Trait Implementations§
Source§impl Clone for ConnectionStatus
impl Clone for ConnectionStatus
Source§fn clone(&self) -> ConnectionStatus
fn clone(&self) -> ConnectionStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ConnectionStatus
impl Debug for ConnectionStatus
Source§impl PartialEq for ConnectionStatus
impl PartialEq for ConnectionStatus
impl Eq for ConnectionStatus
impl StructuralPartialEq for ConnectionStatus
Auto Trait Implementations§
impl Freeze for ConnectionStatus
impl RefUnwindSafe for ConnectionStatus
impl Send for ConnectionStatus
impl Sync for ConnectionStatus
impl Unpin for ConnectionStatus
impl UnwindSafe for ConnectionStatus
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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