mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 09:09:17 +00:00
use cfg_select in dns::system::get
This commit is contained in:
@@ -26,18 +26,17 @@ pub trait SystemConfigurator: Send + Sync {
|
|||||||
pub fn get(
|
pub fn get(
|
||||||
#[allow(unused_variables)] interface: &str,
|
#[allow(unused_variables)] interface: &str,
|
||||||
) -> Result<Option<Box<dyn SystemConfigurator>>, anyhow::Error> {
|
) -> Result<Option<Box<dyn SystemConfigurator>>, anyhow::Error> {
|
||||||
#[cfg(target_os = "windows")]
|
cfg_select! {
|
||||||
{
|
target_os = "windows" => {
|
||||||
use crate::dns::system::windows::WindowsDNSManager;
|
use crate::dns::system::windows::WindowsDNSManager;
|
||||||
return Ok(Some(WindowsDNSManager::new(interface)?.boxed()));
|
Ok(Some(WindowsDNSManager::new(interface)?.boxed()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_os = "macos", not(feature = "macos-ne")))]
|
all(target_os = "macos", not(feature = "macos-ne")) => {
|
||||||
{
|
use crate::dns::system::macos::DarwinConfigurator;
|
||||||
use crate::dns::system::macos::DarwinConfigurator;
|
Ok(Some(DarwinConfigurator::new().boxed()))
|
||||||
return Ok(Some(DarwinConfigurator::new().boxed()));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unreachable_code)]
|
_ => Ok(None)
|
||||||
Ok(None)
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user