fix is_loopback

This commit is contained in:
rustdesk
2023-06-16 15:13:23 +08:00
parent c871978475
commit f1e941bf9f
2 changed files with 5 additions and 4 deletions

View File

@@ -374,8 +374,8 @@ async fn handle_connection(
key: &str,
ws: bool,
) {
let ip = addr.ip().to_string();
if !ws && ip == "127.0.0.1" {
let ip = hbb_common::try_into_v4(addr).ip();
if !ws && ip.is_loopback() {
let limiter = limiter.clone();
tokio::spawn(async move {
let mut stream = stream;
@@ -389,6 +389,7 @@ async fn handle_connection(
});
return;
}
let ip = ip.to_string();
if BLOCKLIST.read().await.get(&ip).is_some() {
log::info!("{} blocked", ip);
return;