From 97a2f7c306a36fffdc36997b5ef90d2d5e884db8 Mon Sep 17 00:00:00 2001 From: "VNT-[bot]" Date: Sat, 26 Apr 2025 10:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E7=BD=91=E7=BB=9C=E4=B8=8D=E7=BB=88?= =?UTF-8?q?=E6=AD=A2=E7=A8=8B=E5=BA=8F=E7=BB=A7=E7=BB=AD=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/core/mod.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/vnt/src/core/mod.rs b/vnt/src/core/mod.rs index a949008..0f56737 100644 --- a/vnt/src/core/mod.rs +++ b/vnt/src/core/mod.rs @@ -141,12 +141,30 @@ impl Config { server_address_str = s.to_string(); protocol = ConnectProtocol::TCP; } - server_address = address_choose(dns_query_all( + let address_result = dns_query_all( &server_address_str, name_servers.clone(), &LocalInterface::default(), - )?)?; + ); + match address_result { + Ok(address) => { + match address_choose(address) { + Ok(resolved_address) => { + server_address = resolved_address; + } + Err(e) => { + log::error!("Failed to choose address: {}", e); + println!("Failed to choose address: {}", e); + } + } + } + Err(e) => { + log::error!("DNS query failed: {}", e); + println!("DNS query failed: {}", e); + } + } } + #[cfg(feature = "port_mapping")] let port_mapping_list = crate::port_mapping::convert(port_mapping_list)?;