comparison plugins/mod_limits.lua @ 14024:f65302ea37b0 13.0 13.0.3

mod_limits: Allow configuration of general 's2s' limit, and have s2sout inherit from s2sin Most people don't currently have a limit set for s2sout, as usually such sessions don't have significant incoming traffic. However, having limits in place is still sensible, especially with the rising use of bidi. The goal here is to switch people to a general 's2s' limit, which s2sin and s2sout both inherit from. Due to the widespread existence of 's2sin' in existing configurations, s2sout will inherit from that unless explicitly set.
author Matthew Wild <mwild1@gmail.com>
date Mon, 05 Jan 2026 11:35:32 +0000
parents c8d949cf6b09
children 4087c5b600b1
comparison
equal deleted inserted replaced
14018:7ffb2d3ab50b 14024:f65302ea37b0
42 local limits = { 42 local limits = {
43 c2s = { 43 c2s = {
44 bytes_per_second = 10 * 1024; 44 bytes_per_second = 10 * 1024;
45 burst_seconds = 2; 45 burst_seconds = 2;
46 }; 46 };
47 s2sin = { 47 s2s = {
48 bytes_per_second = 30 * 1024; 48 bytes_per_second = 30 * 1024;
49 burst_seconds = 2; 49 burst_seconds = 2;
50 }; 50 };
51 }; 51 };
52 52
53 for sess_type, sess_limits in pairs(limits_cfg) do 53 for sess_type, sess_limits in pairs(limits_cfg) do
54 limits[sess_type] = { 54 limits[sess_type] = {
55 bytes_per_second = parse_rate(sess_limits.rate, sess_type); 55 bytes_per_second = parse_rate(sess_limits.rate, sess_type);
56 burst_seconds = parse_burst(sess_limits.burst, sess_type); 56 burst_seconds = parse_burst(sess_limits.burst, sess_type);
57 }; 57 };
58 end
59
60 if not limits.s2sin and limits.s2s then
61 limits.s2sin = limits.s2s;
62 end
63 if not limits.s2sout then
64 limits.s2sout = limits.s2s or limits.s2sin;
58 end 65 end
59 66
60 local default_filter_set = {}; 67 local default_filter_set = {};
61 68
62 function default_filter_set.bytes_in(bytes, session) 69 function default_filter_set.bytes_in(bytes, session)