Skip to main content

Host

Struct Host 

Source
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

Source

pub fn new(primary_ip: IpAddr) -> Self

Creates a new Host centered around a primary IP address.

The initial status is always HostStatus::Unknown.

Source

pub fn primary_ip(&self) -> IpAddr

Returns the primary IP address for this host.

Source

pub fn ips(&self) -> &BTreeSet<IpAddr>

Returns all known IP addresses for this host.

Source

pub fn hostname(&self) -> Option<&str>

Returns the resolved hostname, if any.

Source

pub fn status(&self) -> HostStatus

Returns the current reachability status.

Source

pub fn reasons(&self) -> &HashSet<StatusReason>

Returns all aggregated evidence for the current status.

Source

pub fn os(&self) -> Option<&OsFingerprint>

Returns the identified operating system, if any.

Source

pub fn hardware(&self) -> Option<&HardwareInfo>

Returns physical hardware information, if any.

Source

pub fn telemetry(&self) -> &HostTelemetry

Returns network performance and path telemetry.

Source

pub fn network_roles(&self) -> &HashSet<NetworkRole>

Returns inferred roles based on network location or discovered services.

Source

pub fn scripts(&self) -> Option<&HashMap<String, String>>

Returns the map of scan script results.

Source

pub fn first_seen(&self) -> SystemTime

Returns the timestamp of the first discovery event.

Source

pub fn last_seen(&self) -> SystemTime

Returns the timestamp of the most recent discovery or update event.

Source

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.

Source

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.

Source

pub fn extend_ips(&mut self, ips: impl IntoIterator<Item = IpAddr>)

Adds multiple IP addresses to the host’s record and bumps last_seen.

Source

pub fn set_hostname(&mut self, hostname: Option<String>)

Sets the host’s hostname and bumps last_seen.

Source

pub fn set_status(&mut self, status: HostStatus)

Updates the reachability status and bumps last_seen.

Source

pub fn add_reason(&mut self, reason: StatusReason)

Adds a status reason and bumps last_seen.

Source

pub fn set_os(&mut self, os: OsFingerprint)

Sets the OS fingerprint and bumps last_seen.

Source

pub fn set_hardware(&mut self, hardware: HardwareInfo)

Sets the hardware info and bumps last_seen.

Source

pub fn with_mac(self, mac: MacAddr) -> Self

Builder method to set the hardware MAC and return Self.

Source

pub fn add_rtt(&mut self, rtt: Duration)

Adds a single RTT measurement and bumps last_seen.

Source

pub fn with_rtt(self, rtt: Duration) -> Self

Builder method to add a single RTT measurement and return Self.

Source

pub fn set_rtts(&mut self, rtts: impl IntoIterator<Item = Duration>)

Adds multiple RTT measurements and bumps last_seen.

Source

pub fn add_network_role(&mut self, role: NetworkRole)

Adds a network role and bumps last_seen.

Source

pub fn add_script_result(&mut self, key: String, value: String)

Adds or updates a script result and bumps last_seen.

Source

pub fn min_rtt(&self) -> Option<Duration>

Returns the minimum recorded RTT.

Source

pub fn max_rtt(&self) -> Option<Duration>

Returns the maximum recorded RTT.

Source

pub fn average_rtt(&self) -> Option<Duration>

Returns the average recorded RTT.

Source

pub fn mac(&self) -> Option<MacAddr>

Returns the most recent MAC address, if hardware info is available.

Source

pub fn vendor(&self) -> Option<&str>

Returns the hardware vendor, if hardware info is available.

Source

pub fn is_alive(&self) -> bool

Returns true if this host is confirmed to be on the network (either fully responding or filtered).

Source

pub fn ports(&self) -> impl Iterator<Item = &Port>

Returns an iterator over all discovered ports in sorted order.

Source

pub fn port_count(&self) -> usize

Returns the total number of recorded ports for this host.

Source

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.

Source

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§

Source§

impl Clone for Host

Source§

fn clone(&self) -> Host

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Host

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Host

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more