diff --git a/src/handler/request_call.rs b/src/handler/request_call.rs index b91c7643e..68233c474 100644 --- a/src/handler/request_call.rs +++ b/src/handler/request_call.rs @@ -1,4 +1,4 @@ -pub use crate::node_info::{NodeAddress, NodeContact}; +pub use crate::node_info::{NodeContact}; use crate::{ packet::Packet, rpc::{Request, RequestBody}, diff --git a/src/kbucket/entry.rs b/src/kbucket/entry.rs index 1e0304048..7df9429af 100644 --- a/src/kbucket/entry.rs +++ b/src/kbucket/entry.rs @@ -26,7 +26,7 @@ pub use super::{ bucket::{ - AppliedPending, ConnectionState, InsertResult, Node, NodeStatus, MAX_NODES_PER_BUCKET, + AppliedPending, ConnectionState, InsertResult, Node, NodeStatus, }, key::*, ConnectionDirection, diff --git a/src/packet/mod.rs b/src/packet/mod.rs index f071263bd..ef7ad63c0 100644 --- a/src/packet/mod.rs +++ b/src/packet/mod.rs @@ -29,16 +29,25 @@ pub const MESSAGE_NONCE_LENGTH: usize = 12; /// The Id nonce length (in bytes). pub const ID_NONCE_LENGTH: usize = 16; +pub struct Nat; + +impl ProtocolIdentity<3> for Nat { + const PROTOCOL_ID_BYTES: [u8; 6] = *b"discv5"; + const PROTOCOL_VERSION_BYTES: [u8; 2] = 0x0001_u16.to_be_bytes(); + const IMPLEMENTATION_FEATURES: [u8; 3] = *b"nat"; +} pub struct DefaultProtocolId {} impl ProtocolIdentity for DefaultProtocolId { const PROTOCOL_ID_BYTES: [u8; 6] = *b"discv5"; const PROTOCOL_VERSION_BYTES: [u8; 2] = 0x0001_u16.to_be_bytes(); + const IMPLEMENTATION_FEATURES: [u8; 0] = *b""; } -pub trait ProtocolIdentity { +pub trait ProtocolIdentity: Sync + Send { const PROTOCOL_ID_BYTES: [u8; 6]; const PROTOCOL_VERSION_BYTES: [u8; 2]; + const IMPLEMENTATION_FEATURES: [u8; N]; } pub(crate) const MAX_PACKET_SIZE: usize = 1280;