This commit is contained in:
rustdesk
2022-12-28 13:52:13 +08:00
parent 75f57cf0fc
commit 08b8f40397
10 changed files with 167 additions and 208 deletions

View File

@@ -130,7 +130,7 @@ impl AddrMangle {
pub fn decode(bytes: &[u8]) -> SocketAddr {
if bytes.len() > 16 {
if bytes.len() != 18 {
return Config::get_any_listen_addr_v6();
return Config::get_any_listen_addr(false);
}
#[allow(invalid_value)]
let mut tmp: [u8; 2] = unsafe { std::mem::MaybeUninit::uninit().assume_init() };
@@ -300,3 +300,10 @@ mod tests {
);
}
}
#[inline]
pub fn is_ipv4_str(id: &str) -> bool {
regex::Regex::new(r"^\d+\.\d+\.\d+\.\d+(:\d+)?$")
.unwrap()
.is_match(id)
}