mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-07 04:59:49 +00:00
make dns Option
This commit is contained in:
@@ -452,7 +452,7 @@ struct Config {
|
||||
proxy_network: Option<Vec<ProxyNetworkConfig>>,
|
||||
|
||||
#[cfg(feature = "magic-dns")]
|
||||
dns: DnsConfig,
|
||||
dns: Option<DnsConfig>,
|
||||
|
||||
vpn_portal_config: Option<VpnPortalConfig>,
|
||||
|
||||
@@ -541,20 +541,12 @@ impl DnsConfigLoaderExt for TomlConfigLoader {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "magic-dns")] {
|
||||
fn get_dns(&self) -> DnsConfig {
|
||||
self.config.lock().unwrap().dns.clone()
|
||||
self.config.lock().unwrap().dns.clone().unwrap_or_default()
|
||||
}
|
||||
|
||||
fn set_dns(&self, dns: DnsConfig) {
|
||||
fn set_dns(&self, dns: Option<DnsConfig>) {
|
||||
self.config.lock().unwrap().dns = dns;
|
||||
}
|
||||
|
||||
fn get_fqdn(&self) -> String {
|
||||
self.config.lock().unwrap().dns.get_fqdn().to_string()
|
||||
}
|
||||
|
||||
fn set_fqdn(&self, fqdn: &str) {
|
||||
self.config.lock().unwrap().dns.set_fqdn(fqdn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,7 @@ impl DnsConfig {
|
||||
#[auto_impl::auto_impl(Box, &)]
|
||||
pub trait DnsConfigLoaderExt {
|
||||
fn get_dns(&self) -> DnsConfig;
|
||||
fn set_dns(&self, dns: DnsConfig);
|
||||
|
||||
fn get_fqdn(&self) -> String;
|
||||
fn set_fqdn(&self, fqdn: &str);
|
||||
fn set_dns(&self, dns: Option<DnsConfig>);
|
||||
}
|
||||
|
||||
pub type DnsExportConfig = GetExportConfigResponse;
|
||||
|
||||
@@ -39,7 +39,7 @@ pub async fn prepare_env_with_tld_dns_zone(
|
||||
if let Some(zone) = tld_dns_zone {
|
||||
dns_config.domain = zone.parse().expect("invalid test dns zone");
|
||||
}
|
||||
ctx.config.set_dns(dns_config);
|
||||
ctx.config.set_dns(Some(dns_config));
|
||||
|
||||
let (s, r) = create_packet_recv_chan();
|
||||
let peer_mgr = Arc::new(PeerManager::new(RouteAlgoType::Ospf, ctx, s));
|
||||
|
||||
Reference in New Issue
Block a user