Skip to main content

Mountain/Binary/Build/DnsCommands/
dns_get_health_status.rs

1#![allow(non_snake_case)]
2
3//! `dns_get_health_status` Tauri command - aggregated server /
4//! zone / forward status snapshot.
5
6use tauri::State;
7
8use crate::Binary::Build::{DnsCommands::DnsHealthStatus::DnsHealthStatus, Scheme::DnsPort};
9
10#[tauri::command]
11pub fn dns_get_health_status(dns_port:State<DnsPort>) -> Result<DnsHealthStatus, String> {
12	let port = dns_port.0;
13
14	if port == 0 {
15		return Ok(DnsHealthStatus {
16			server_status:"stopped".to_string(),
17			zone_status:"inactive".to_string(),
18			forward_status:"inactive".to_string(),
19			last_error:Some("DNS server is not running".to_string()),
20		});
21	}
22
23	Ok(DnsHealthStatus {
24		server_status:"running".to_string(),
25		zone_status:"active".to_string(),
26		forward_status:"active".to_string(),
27		last_error:None,
28	})
29}