Magic DNS and easytier-web improvements (#856)

1. dns add macos system config
2. allow easytier-web serve dashboard and api in same port
This commit is contained in:
Sijie.Sun
2025-05-18 16:34:35 +08:00
committed by GitHub
parent 28fe6257be
commit 7c6daf7c56
7 changed files with 250 additions and 18 deletions
@@ -6,6 +6,8 @@ use winreg::RegKey;
use crate::common::ifcfg::RegistryManager;
use super::{OSConfig, SystemConfig};
pub fn is_windows_10_or_better() -> io::Result<bool> {
let hklm = winreg::enums::HKEY_LOCAL_MACHINE;
let key_path = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
@@ -150,6 +152,23 @@ impl WindowsDNSManager {
}
}
impl SystemConfig for WindowsDNSManager {
fn set_dns(&self, cfg: &OSConfig) -> io::Result<()> {
self.set_primary_dns(
&cfg.nameservers
.iter()
.map(|s| s.parse::<IpAddr>().unwrap())
.collect::<Vec<_>>(),
&cfg.match_domains,
)?;
Ok(())
}
fn close(&self) -> io::Result<()> {
Ok(())
}
}
#[cfg(test)]
mod tests {
use cidr::Ipv4Inet;