Mountain/Binary/Build/DnsCommands/dns_health_check.rs
1#![allow(non_snake_case)]
2
3//! `dns_health_check` Tauri command - thin wrapper over
4//! `dns_get_health_status` that flattens to a `bool` for
5//! automated monitoring.
6
7use tauri::State;
8
9use crate::Binary::Build::{DnsCommands::dns_get_health_status::dns_get_health_status, Scheme::DnsPort};
10
11#[tauri::command]
12pub fn dns_health_check(dns_port:State<DnsPort>) -> Result<bool, String> {
13 let health = dns_get_health_status(dns_port)?;
14
15 Ok(health.server_status == "running"
16 && health.zone_status == "active"
17 && health.forward_status == "active"
18 && health.last_error.is_none())
19}