pub struct ServerReject {
pub marker: [u8; 4],
pub code: u8,
pub supported_version: u8,
}Expand description
Typed handshake rejection the server returns instead of silently dropping
the connection when it structurally cannot satisfy a ClientHello — today,
an unknown version. It gives a forward/backward-incompatible peer an
actionable signal (the version the server speaks) rather than a bare
connection reset.
Downgrade safety. The client surfaces a reject as a hard error and does not auto-retry at the advertised version. Auto-downgrading on an attacker-injected reject would defeat the transcript-bound downgrade resistance of Invariant 7 (the version is signed into the transcript). The reject is diagnostic only; protocol selection stays pinned.
Fields§
§marker: [u8; 4]Always SERVER_REJECT_MARKER; lets the client identify the frame.
code: u8Reject reason — see REJECT_UNSUPPORTED_VERSION.
supported_version: u8The PROTOCOL_VERSION this server speaks.
Implementations§
Source§impl ServerReject
impl ServerReject
Sourcepub fn unsupported_version() -> Self
pub fn unsupported_version() -> Self
Build the unsupported-version reject advertising this build’s
PROTOCOL_VERSION.
Sourcepub fn has_marker(&self) -> bool
pub fn has_marker(&self) -> bool
True iff the frame carries the reject marker — the client’s guard against treating a same-sized non-reject blob as a reject.
Trait Implementations§
Source§impl BorshDeserialize for ServerReject
impl BorshDeserialize for ServerReject
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for ServerReject
impl BorshSerialize for ServerReject
Source§impl Clone for ServerReject
impl Clone for ServerReject
Source§fn clone(&self) -> ServerReject
fn clone(&self) -> ServerReject
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerReject
impl Debug for ServerReject
impl Eq for ServerReject
Source§impl PartialEq for ServerReject
impl PartialEq for ServerReject
Source§fn eq(&self, other: &ServerReject) -> bool
fn eq(&self, other: &ServerReject) -> bool
self and other values to be equal, and is used by ==.