Comparison

mod_muc_limits/README.md @ 6211:750d64c47ec6 draft default tip

Merge
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Tue, 18 Mar 2025 00:31:36 +0700
parent 6012:0206d32c56b7
comparison
equal deleted inserted replaced
6210:24316a399978 6211:750d64c47ec6
1 ---
2 labels:
3 - 'Stage-Beta'
4 summary: 'Impose rate-limits on a MUC'
5 ...
6
7 Introduction
8 ============
9
10 This module allows you to control the maximum rate of 'events' in a MUC
11 room. This makes it useful to prevent room floods (whether malicious or
12 accidental).
13
14 Details
15 =======
16
17 This module limits the following events:
18
19 - Room joins
20 - Nick changes
21 - Status changes
22 - Messages (including private messages)
23
24 The limit is for the room as a whole, not individual occupants in the
25 room. Users with an affiliation (members, admins and owners) are not
26 limited.
27
28 Configuration
29 =============
30
31 Add the module to the MUC host (not the global modules\_enabled):
32
33 ```lua
34 Component "conference.example.com" "muc"
35 modules_enabled = { "muc_limits" }
36 ```
37
38 You can define (globally or per-MUC component) the following options:
39
40 Name Default value Description
41 --------------------------- --------------- ----------------------------------------------------------
42 muc_event_rate 0.5 The maximum number of events per second.
43 muc_burst_factor 6 Allow temporary bursts of this multiple.
44 muc_max_nick_length 23 The maximum allowed length of user nicknames
45 muc_max_char_count 5664 The maximum allowed number of bytes in a message
46 muc_max_line_count 23 The maximum allowed number of lines in a message
47 muc_limit_base_cost 1 Base cost of sending a stanza
48 muc_line_count_multiplier 0.1 Additional cost of each newline in the body of a message
49
50 For more understanding of how these values are used, see the algorithm
51 section below.
52
53 Algorithm
54 =========
55
56 A certain number of events are allowed per second, given by
57 muc\_event\_rate. An event rate of 1 allows one event per second, and
58 event rate of 3 allows three events per second, and 0.5 allows one event
59 every two seconds, and so on.
60
61 Obviously MUC conversations are not exactly steady streams of events.
62 Sometimes multiple people will talk at once. This is handled by the
63 muc\_burst\_factor option.
64
65 A burst factor of 2 will allow 2 times as many events at once, for 2
66 seconds, before throttling will be triggered. A factor of 5, 5 times as
67 many events for 5 seconds.
68
69 When the limit is reached, an error response will be generated telling
70 the user the MUC is overactive, and asking them to try again.
71
72 Compatibility
73 =============
74
75 ------- -------
76 trunk* Works
77 0.12 Works
78 ------- -------
79
80 *as of 2024-10-22