Skip to main content

osdns/
interface.rs

1use std::ffi::OsString;
2
3/// Information about a network interface, as reported by the active backend.
4///
5/// Returned by [`DnsManager::interfaces`](crate::DnsManager::interfaces).
6/// Read-only snapshot; `index` is the OS interface index (0 when the platform
7/// does not expose one, e.g. macOS service enumeration), `name` the OS name,
8/// `friendly_name` a human-readable name when available, `guid` the stable
9/// native identifier when available (Windows GUID, macOS service UUID).
10/// `is_up` reflects the backend's liveness signal and may be approximate.
11///
12/// Names and indexes are convenience selectors only. Their lifetime and
13/// rename/reuse semantics are backend-specific; durable recovery separately
14/// validates the native resource incarnation.
15#[derive(Debug, Clone, PartialEq, Eq)]
16#[non_exhaustive]
17pub struct InterfaceInfo {
18    /// OS interface index.
19    pub index: u32,
20    /// OS interface name.
21    pub name: OsString,
22    /// Human-friendly display name, when the platform provides one.
23    pub friendly_name: Option<String>,
24    /// Interface GUID, when the platform exposes one.
25    pub guid: Option<String>,
26    /// Whether the interface is currently up.
27    pub is_up: bool,
28}