mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-18 08:17:37 +00:00
returns error if dns resolved empty
This commit is contained in:
@@ -1184,17 +1184,7 @@ impl Config {
|
||||
}
|
||||
|
||||
#[cfg(feature = "local-dns")]
|
||||
if self.local_protocol == ProtocolType::Dns {
|
||||
if self.dns_bind_addr.is_none() || self.local_dns_addr.is_none() || self.remote_dns_addr.is_none() {
|
||||
let err = Error::new(
|
||||
ErrorKind::MissingField,
|
||||
"missing `dns_bind_addr`, `local_dns_addr` or `remote_dns_addr` in configuration",
|
||||
None,
|
||||
);
|
||||
return Err(err);
|
||||
}
|
||||
} else if self.dns_bind_addr.is_some() {
|
||||
// Run a DNS server in the same process
|
||||
if self.local_protocol == ProtocolType::Dns || self.dns_bind_addr.is_some() {
|
||||
if self.local_dns_addr.is_none() || self.remote_dns_addr.is_none() {
|
||||
let err = Error::new(
|
||||
ErrorKind::MissingField,
|
||||
|
||||
@@ -210,6 +210,11 @@ impl DnsResolve for DnsResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if vaddr.is_empty() {
|
||||
let err = io::Error::new(ErrorKind::InvalidData, "resolve empty");
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
Ok(vaddr)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user