From 1a3bb84835da2459321a554c39de1084fcfb6c09 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 19 Sep 2024 15:33:20 +0300 Subject: [PATCH] rename `bruteforce_shield` into `ddos_shield` Signed-off-by: onur-ozkan --- mm2src/mm2_core/src/mm_ctx.rs | 6 +++--- mm2src/mm2_main/src/lp_healthcheck.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm2src/mm2_core/src/mm_ctx.rs b/mm2src/mm2_core/src/mm_ctx.rs index f2bbd5db83..55dbecf1f4 100644 --- a/mm2src/mm2_core/src/mm_ctx.rs +++ b/mm2src/mm2_core/src/mm_ctx.rs @@ -56,8 +56,8 @@ mod healthcheck_defaults { pub struct Healthcheck { /// Links the RPC context to the P2P context to handle health check responses. pub response_handler: AsyncMutex>>, - /// This is used to record healthcheck sender peers in an expirable manner to prevent brute-force attacks. - pub bruteforce_shield: AsyncMutex>, + /// This is used to record healthcheck sender peers in an expirable manner to prevent DDoS attacks. + pub ddos_shield: AsyncMutex>, pub config: HealthcheckConfig, } @@ -235,7 +235,7 @@ impl MmCtx { async_sqlite_connection: Constructible::default(), healthcheck: Healthcheck { response_handler: AsyncMutex::new(ExpirableMap::default()), - bruteforce_shield: AsyncMutex::new(ExpirableMap::default()), + ddos_shield: AsyncMutex::new(ExpirableMap::default()), config: HealthcheckConfig::default(), }, } diff --git a/mm2src/mm2_main/src/lp_healthcheck.rs b/mm2src/mm2_main/src/lp_healthcheck.rs index ffce972137..b7eddb3d70 100644 --- a/mm2src/mm2_main/src/lp_healthcheck.rs +++ b/mm2src/mm2_main/src/lp_healthcheck.rs @@ -300,9 +300,9 @@ pub(crate) async fn process_p2p_healthcheck_message(ctx: &MmArc, message: mm2_li let sender_peer = data.sender_peer().to_owned(); - let mut bruteforce_shield = ctx.healthcheck.bruteforce_shield.lock().await; - bruteforce_shield.clear_expired_entries(); - if bruteforce_shield + let mut ddos_shield = ctx.healthcheck.ddos_shield.lock().await; + ddos_shield.clear_expired_entries(); + if ddos_shield .insert( sender_peer.to_string(), (), @@ -313,7 +313,7 @@ pub(crate) async fn process_p2p_healthcheck_message(ctx: &MmArc, message: mm2_li log::warn!("Peer '{sender_peer}' exceeded the healthcheck blocking time, skipping their message."); return; } - drop(bruteforce_shield); + drop(ddos_shield); let ctx_c = ctx.clone();