zond_engine/info.rs
1// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
2//
3// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4// If a copy of the MPL was not distributed with this file, You can obtain one at
5// https://mozilla.org/MPL/2.0/.
6
7//! # Local System Information Service
8//!
9//! Implements the "System Info" use case.
10//!
11//! This service acts as a facade for gathering local machine statistics and
12//! configuration, useful for debugging or self-awareness context.
13
14use crate::core::models::localhost::{FirewallStatus, IpServiceGroup};
15use pnet::datalink::NetworkInterface;
16
17/// Retrieves a comprehensive snapshot of the local system's network state.
18pub fn get_system_info() -> anyhow::Result<SystemInfo> {
19 let services = crate::host_sys::get_local_services()?;
20 let firewall = crate::host_sys::get_firewall_status()?;
21 let interfaces = crate::host_sys::get_network_interfaces()?;
22
23 Ok(SystemInfo {
24 services,
25 firewall,
26 interfaces,
27 })
28}
29
30pub struct SystemInfo {
31 pub services: Vec<IpServiceGroup>,
32 pub firewall: FirewallStatus,
33 pub interfaces: Vec<NetworkInterface>,
34}