1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-09-25 14:19:45 +00:00

Accept wider range of IP for proxies and RTC relay

This commit is contained in:
2021-10-16 21:55:29 +02:00
parent c782f64602
commit 36bfe8e24e
4 changed files with 34 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ use crate::data::config::conf;
use crate::data::error::{ExecError, Res};
use crate::helpers::events_helper;
use crate::helpers::events_helper::Event;
use crate::utils::network_utils::match_ip;
struct RtcRelayActor {}
@@ -245,7 +246,7 @@ pub async fn open_ws(req: actix_web::HttpRequest,
let conf = conf().rtc_relay.as_ref().unwrap();
// Check remote IP address
if !ip.ip().to_string().eq(&conf.ip) {
if !match_ip(&conf.ip, ip.ip().to_string().as_str()) {
eprintln!("A relay from {} tried to connect to the server but the IP address is not authorized!", ip);
return Ok(actix_web::HttpResponse::Unauthorized().body("Access denied!"));
}