pub struct HardwareInfo {
pub vendor: Option<Arc<str>>,
/* private fields */
}Expand description
Physical hardware identification and auditing data for a network host.
HardwareInfo tracks multiple MAC addresses to support multi-NIC hosts
and to detect “MAC hopping” on randomized devices.
Fields§
§vendor: Option<Arc<str>>The hardware vendor identified from the MAC OUI (e.g., “Apple”, “Dell”).
This field should ideally be shared via an Arc to minimize heap
allocations across thousands of identical host records.
Implementations§
Source§impl HardwareInfo
impl HardwareInfo
Sourcepub fn new(mac: MacAddr) -> Self
pub fn new(mac: MacAddr) -> Self
Creates a new HardwareInfo record for a specifically discovered MAC address.
The vendor is resolved automatically from the MAC’s OUI, if known.
Sourcepub fn add_mac(&mut self, mac: MacAddr)
pub fn add_mac(&mut self, mac: MacAddr)
Records a discovery event for a specific MAC address, updating its “last seen” timestamp.
If no vendor has been identified yet, this attempts to resolve one from the newly observed MAC’s OUI.
Sourcepub fn macs(&self) -> &BTreeMap<MacAddr, Instant>
pub fn macs(&self) -> &BTreeMap<MacAddr, Instant>
Returns a read-only view of all recorded MAC addresses and their last-seen timestamps.
Sourcepub fn most_recent_mac(&self) -> Option<MacAddr>
pub fn most_recent_mac(&self) -> Option<MacAddr>
Returns the MAC address that was most recently observed.
This is typically used to identify the primary hardware interface currently active on the network.
Sourcepub fn prune_stale_macs(&mut self, cutoff: Instant)
pub fn prune_stale_macs(&mut self, cutoff: Instant)
Removes all MAC address records that were last seen before the given cutoff.
This is a critical forensic cleanup step for long-running monitors in environments with aggressive MAC randomization, preventing memory exhaustion from “ghost” hardware records.
Sourcepub fn merge(&mut self, other: HardwareInfo)
pub fn merge(&mut self, other: HardwareInfo)
Merges architectural findings from another hardware record.
MAC addresses are interleaved, with the newest timestamp prevailing for each unique address to prevent timeline regressions.
Trait Implementations§
Source§impl Clone for HardwareInfo
impl Clone for HardwareInfo
Source§fn clone(&self) -> HardwareInfo
fn clone(&self) -> HardwareInfo
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 HardwareInfo
impl Debug for HardwareInfo
impl Eq for HardwareInfo
Source§impl PartialEq for HardwareInfo
impl PartialEq for HardwareInfo
impl StructuralPartialEq for HardwareInfo
Auto Trait Implementations§
impl Freeze for HardwareInfo
impl RefUnwindSafe for HardwareInfo
impl Send for HardwareInfo
impl Sync for HardwareInfo
impl Unpin for HardwareInfo
impl UnsafeUnpin for HardwareInfo
impl UnwindSafe for HardwareInfo
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more