From ded89d1935f51df3a825c5ab2857d665314384c2 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 14 Dec 2025 10:18:52 +0100 Subject: [PATCH] JSON-RPC: Make connthrottle.status use config::except and change "state". * I changed "state":"active" to "state":"monitoring" to make clear it is not throttling at that moment but actively monitoring the situation. * The config::except stuff was previously shown directly under config and only 3 particular items (that are most popular). Now we expand to sub-item "except" and use json_expand_security_group() to expand all the mask items, in a consistent way, just like for security groups. { "jsonrpc": "2.0", "method": "connthrottle.status", "id": 123, "result": { "enabled": true, "throttling_this_minute": false, "throttling_previous_minute": false, "state": "monitoring", "start_delay_remaining": 0, "reputation_gathering": false, "counters": { "local_count": 0, "global_count": 0 }, "stats_last_minute": { "rejected_clients": 0, "allowed_except": 0, "allowed_unknown_users": 0 }, "config": { "local_throttle_count": 20, "local_throttle_period": 60, "global_throttle_count": 30, "global_throttle_period": 60, "start_delay": 180, "except": { "identified": true, "reputation_score": 24 } } } } --- src/modules/connthrottle.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index 37add135a..53680b048 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -669,7 +669,7 @@ RPC_CALL_FUNC(rpc_connthrottle_status) else if (ucounter->throttling_this_minute) json_object_set_new(result, "state", json_string_unreal("throttling")); else - json_object_set_new(result, "state", json_string_unreal("active")); + json_object_set_new(result, "state", json_string_unreal("monitoring")); json_object_set_new(result, "start_delay_remaining", json_integer(start_delay_remaining)); json_object_set_new(result, "reputation_gathering", json_boolean(reputation_gathering)); @@ -698,9 +698,7 @@ RPC_CALL_FUNC(rpc_connthrottle_status) json_object_set_new(config, "global_throttle_count", json_integer(cfg.global.count)); json_object_set_new(config, "global_throttle_period", json_integer(cfg.global.period)); json_object_set_new(config, "start_delay", json_integer(cfg.start_delay)); - json_object_set_new(config, "except_reputation_score", json_integer(cfg.except ? cfg.except->reputation_score : 0)); - json_object_set_new(config, "except_sasl_bypass", json_boolean(cfg.except ? cfg.except->identified : 0)); - json_object_set_new(config, "except_webirc_bypass", json_boolean(cfg.except ? cfg.except->webirc : 0)); + json_expand_security_group(config, "except", cfg.except, 1); json_object_set_new(result, "config", config); rpc_response(client, request, result);