pub struct Host { /* private fields */ }Expand description
A comprehensive identity and state record for a network-reachable host.
A Host is the primary unit of work for the Zond scanner. It holds
multi-homed IP data, forensic hardware IDs, and a history of network
performance metrics.
Large metadata blocks (like OsFingerprint) are stored in Boxes to
minimize the overall stack size of the Host struct.
Implementations§
Source§impl Host
impl Host
Sourcepub fn new(primary_ip: IpAddr) -> Self
pub fn new(primary_ip: IpAddr) -> Self
Creates a new Host centered around a primary IP address.
The initial status is always HostStatus::Unknown.
Sourcepub fn primary_ip(&self) -> IpAddr
pub fn primary_ip(&self) -> IpAddr
Returns the primary IP address for this host.
Sourcepub fn status(&self) -> HostStatus
pub fn status(&self) -> HostStatus
Returns the current reachability status.
Sourcepub fn reasons(&self) -> &HashSet<StatusReason>
pub fn reasons(&self) -> &HashSet<StatusReason>
Returns all aggregated evidence for the current status.
Sourcepub fn os(&self) -> Option<&OsFingerprint>
pub fn os(&self) -> Option<&OsFingerprint>
Returns the identified operating system, if any.
Sourcepub fn hardware(&self) -> Option<&HardwareInfo>
pub fn hardware(&self) -> Option<&HardwareInfo>
Returns physical hardware information, if any.
Sourcepub fn telemetry(&self) -> &HostTelemetry
pub fn telemetry(&self) -> &HostTelemetry
Returns network performance and path telemetry.
Sourcepub fn network_roles(&self) -> &HashSet<NetworkRole>
pub fn network_roles(&self) -> &HashSet<NetworkRole>
Returns inferred roles based on network location or discovered services.
Sourcepub fn scripts(&self) -> Option<&HashMap<String, String>>
pub fn scripts(&self) -> Option<&HashMap<String, String>>
Returns the map of scan script results.
Sourcepub fn first_seen(&self) -> SystemTime
pub fn first_seen(&self) -> SystemTime
Returns the timestamp of the first discovery event.
Sourcepub fn last_seen(&self) -> SystemTime
pub fn last_seen(&self) -> SystemTime
Returns the timestamp of the most recent discovery or update event.
Sourcepub fn set_primary_ip(&mut self, ip: IpAddr)
pub fn set_primary_ip(&mut self, ip: IpAddr)
Updates the primary IP, ensures it exists in the ips set,
and bumps the last_seen timestamp.
Sourcepub fn add_ip(&mut self, ip: IpAddr) -> bool
pub fn add_ip(&mut self, ip: IpAddr) -> bool
Adds a new IP address to the host’s record and bumps last_seen.
Returns true if the IP was newly added.
Sourcepub fn extend_ips(&mut self, ips: impl IntoIterator<Item = IpAddr>)
pub fn extend_ips(&mut self, ips: impl IntoIterator<Item = IpAddr>)
Adds multiple IP addresses to the host’s record and bumps last_seen.
Sourcepub fn set_hostname(&mut self, hostname: Option<String>)
pub fn set_hostname(&mut self, hostname: Option<String>)
Sets the host’s hostname and bumps last_seen.
Sourcepub fn set_status(&mut self, status: HostStatus)
pub fn set_status(&mut self, status: HostStatus)
Updates the reachability status and bumps last_seen.
Sourcepub fn add_reason(&mut self, reason: StatusReason)
pub fn add_reason(&mut self, reason: StatusReason)
Adds a status reason and bumps last_seen.
Sourcepub fn set_os(&mut self, os: OsFingerprint)
pub fn set_os(&mut self, os: OsFingerprint)
Sets the OS fingerprint and bumps last_seen.
Sourcepub fn set_hardware(&mut self, hardware: HardwareInfo)
pub fn set_hardware(&mut self, hardware: HardwareInfo)
Sets the hardware info and bumps last_seen.
Sourcepub fn with_mac(self, mac: MacAddr) -> Self
pub fn with_mac(self, mac: MacAddr) -> Self
Builder method to set the hardware MAC and return Self.
Sourcepub fn with_rtt(self, rtt: Duration) -> Self
pub fn with_rtt(self, rtt: Duration) -> Self
Builder method to add a single RTT measurement and return Self.
Sourcepub fn set_rtts(&mut self, rtts: impl IntoIterator<Item = Duration>)
pub fn set_rtts(&mut self, rtts: impl IntoIterator<Item = Duration>)
Adds multiple RTT measurements and bumps last_seen.
Sourcepub fn add_network_role(&mut self, role: NetworkRole)
pub fn add_network_role(&mut self, role: NetworkRole)
Adds a network role and bumps last_seen.
Sourcepub fn add_script_result(&mut self, key: String, value: String)
pub fn add_script_result(&mut self, key: String, value: String)
Adds or updates a script result and bumps last_seen.
Sourcepub fn average_rtt(&self) -> Option<Duration>
pub fn average_rtt(&self) -> Option<Duration>
Returns the average recorded RTT.
Sourcepub fn mac(&self) -> Option<MacAddr>
pub fn mac(&self) -> Option<MacAddr>
Returns the most recent MAC address, if hardware info is available.
Sourcepub fn vendor(&self) -> Option<&str>
pub fn vendor(&self) -> Option<&str>
Returns the hardware vendor, if hardware info is available.
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Returns true if this host is confirmed to be on the network
(either fully responding or filtered).
Sourcepub fn ports(&self) -> impl Iterator<Item = &Port>
pub fn ports(&self) -> impl Iterator<Item = &Port>
Returns an iterator over all discovered ports in sorted order.
Sourcepub fn port_count(&self) -> usize
pub fn port_count(&self) -> usize
Returns the total number of recorded ports for this host.
Sourcepub fn add_port(&mut self, new_port: Port)
pub fn add_port(&mut self, new_port: Port)
Ingests a new port finding.
If the port is already known, it is merged with the existing record.
If the total port count exceeds MAX_PORTS_PER_HOST, the port is ignored
and the host is assigned the NetworkRole::Tarpit role.
Sourcepub fn merge(&mut self, other: Host)
pub fn merge(&mut self, other: Host)
Merges architectural findings from another Host record.
This is the core aggregation method of the library, used to combine results from multiple asynchronous scan stages into a single truth.
- Status is promoted based on semantic ordering.
- Telemetry and OS data are merged using their respective logic.
- Port caps are enforced during aggregation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Host
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnsafeUnpin for Host
impl UnwindSafe for Host
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> 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