#[repr(u16)]pub enum PexErrorCode {
BadMessage = 1,
UnsupportedVersion = 2,
RateViolation = 3,
Oversized = 4,
NetworkMismatch = 5,
ProtocolViolation = 6,
}Expand description
The advisory pex_error code table (SPEC §4.5). pex_error is best-effort and never requires a
reply; a receiver sends it alongside discarding a bad message / muting a direction.
Variants§
BadMessage = 1
1 — the message was not valid PEX JSON, or violated a structural MUST (e.g. a peer_id
appearing in both added and dropped).
UnsupportedVersion = 2
2 — the handshake version is not supported by the receiver.
RateViolation = 3
3 — data messages arrived faster than the enforced minimum interval (SPEC §6.4).
Oversized = 4
4 — a frame exceeded PEX_MAX_FRAME, or a list exceeded its cap (SPEC §7).
NetworkMismatch = 5
5 — the handshake network_id differs from the receiver’s.
ProtocolViolation = 6
6 — a state-machine violation (SPEC §5.3): data before handshake, a second snapshot, or a
delta before the snapshot.
Implementations§
Source§impl PexErrorCode
impl PexErrorCode
Sourcepub fn message(self) -> &'static str
pub fn message(self) -> &'static str
A short, stable human-readable message for the pex_error.message field.
Sourcepub fn is_strike(self) -> bool
pub fn is_strike(self) -> bool
Whether this code represents peer misbehavior that counts a strike toward muting (SPEC
§11.2): bad-message (1), rate (3), oversize (4), and protocol (6). Version (2) and
network (5) mismatch mute the direction immediately but are NOT misbehavior — the peer is
simply on a different version/network, and the underlying connection MUST NOT be torn down
for that reason alone (SPEC §5.2).
Trait Implementations§
Source§impl Clone for PexErrorCode
impl Clone for PexErrorCode
Source§fn clone(&self) -> PexErrorCode
fn clone(&self) -> PexErrorCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more