pub struct IPv4NodeID {
pub node_id: Vec<u8>,
pub ipv4_addr: Ipv4Addr,
pub public_key: Vec<u8>,
pub signature: Vec<u8>,
pub timestamp_secs: u64,
pub salt: Vec<u8>,
}Expand description
IPv4-based node identity that binds node ID to actual network location Mirrors IPv6NodeID for security parity on IPv4 networks
Fields§
§node_id: Vec<u8>Derived node ID (SHA256 of ipv4_addr + public_key + salt + timestamp)
ipv4_addr: Ipv4AddrIPv4 address this node ID is bound to
public_key: Vec<u8>ML-DSA public key for signatures
signature: Vec<u8>Signature proving ownership of the IPv4 address and keys
timestamp_secs: u64Timestamp when this ID was generated (seconds since epoch)
salt: Vec<u8>Salt used in node ID generation (for freshness)
Implementations§
Source§impl IPv4NodeID
impl IPv4NodeID
Sourcepub fn generate(
ipv4_addr: Ipv4Addr,
secret: &MlDsaSecretKey,
public: &MlDsaPublicKey,
) -> Result<Self>
pub fn generate( ipv4_addr: Ipv4Addr, secret: &MlDsaSecretKey, public: &MlDsaPublicKey, ) -> Result<Self>
Generate a new IPv4-based node ID
Delegates to GenericIpNodeID for the core generation logic.
Sourcepub fn extract_subnet_24(&self) -> Ipv4Addr
pub fn extract_subnet_24(&self) -> Ipv4Addr
Extract /24 subnet from IPv4 address (Class C / most ISP allocations)
Sourcepub fn extract_subnet_16(&self) -> Ipv4Addr
pub fn extract_subnet_16(&self) -> Ipv4Addr
Extract /16 subnet from IPv4 address (Class B / large ISP allocations)
Sourcepub fn extract_subnet_8(&self) -> Ipv4Addr
pub fn extract_subnet_8(&self) -> Ipv4Addr
Extract /8 subnet from IPv4 address (Class A / regional allocations)
Sourcepub fn is_expired(&self, max_age: Duration) -> bool
pub fn is_expired(&self, max_age: Duration) -> bool
Check if the node ID has expired (older than max_age)
Trait Implementations§
Source§impl Clone for IPv4NodeID
impl Clone for IPv4NodeID
Source§fn clone(&self) -> IPv4NodeID
fn clone(&self) -> IPv4NodeID
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IPv4NodeID
impl Debug for IPv4NodeID
Source§impl<'de> Deserialize<'de> for IPv4NodeID
impl<'de> Deserialize<'de> for IPv4NodeID
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for IPv4NodeID
impl RefUnwindSafe for IPv4NodeID
impl Send for IPv4NodeID
impl Sync for IPv4NodeID
impl Unpin for IPv4NodeID
impl UnsafeUnpin for IPv4NodeID
impl UnwindSafe for IPv4NodeID
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.