mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Split protocol.rs into protocol/ directory, standardize imports, clean lib.rs
- Replace use super::*; in node/lifecycle.rs with explicit imports, remove 10 resulting unused imports from node/mod.rs - Split protocol.rs (1838 lines) into protocol/ directory: mod.rs (re-exports), error.rs, link.rs, tree.rs, filter.rs, discovery.rs, session.rs — each with co-located tests - Remove unused flat re-exports from lib.rs for internal utility modules (wire, index, rate_limit, icmp, noise, tun) - 316 tests pass, zero warnings
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//! Protocol error types.
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// Errors related to protocol message handling.
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ProtocolError {
|
||||
#[error("invalid message type: 0x{0:02x}")]
|
||||
InvalidMessageType(u8),
|
||||
|
||||
#[error("message too short: expected at least {expected}, got {got}")]
|
||||
MessageTooShort { expected: usize, got: usize },
|
||||
|
||||
#[error("message too long: max {max}, got {got}")]
|
||||
MessageTooLong { max: usize, got: usize },
|
||||
|
||||
#[error("invalid signature")]
|
||||
InvalidSignature,
|
||||
|
||||
#[error("unsupported protocol version: {0}")]
|
||||
UnsupportedVersion(u8),
|
||||
|
||||
#[error("malformed message: {0}")]
|
||||
Malformed(String),
|
||||
|
||||
#[error("hop limit exceeded")]
|
||||
HopLimitExceeded,
|
||||
|
||||
#[error("ttl expired")]
|
||||
TtlExpired,
|
||||
}
|
||||
Reference in New Issue
Block a user