1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

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
      }
    }
  }
}
This commit is contained in:
Bram Matthys
2025-12-14 10:18:52 +01:00
parent c990848d2f
commit ded89d1935
+2 -4
View File
@@ -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);