Comparison

plugins/mod_limits.lua @ 11554:db8e41eb6eff 0.11

mod_limits: Use default limits if none configured
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 May 2021 14:22:59 +0100
parent 11550:929de6ade6b6
child 11560:3bbb1af92514
comparison
equal deleted inserted replaced
11553:b0d8920ed5e5 11554:db8e41eb6eff
37 return n_burst or default_burst; 37 return n_burst or default_burst;
38 end 38 end
39 39
40 -- Process config option into limits table: 40 -- Process config option into limits table:
41 -- limits = { c2s = { bytes_per_second = X, burst_seconds = Y } } 41 -- limits = { c2s = { bytes_per_second = X, burst_seconds = Y } }
42 local limits = {}; 42 local limits = {
43 c2s = {
44 bytes_per_second = 10 * 1024;
45 burst_seconds = 2;
46 };
47 s2sin = {
48 bytes_per_second = 30 * 1024;
49 burst_seconds = 2;
50 };
51 };
43 52
44 for sess_type, sess_limits in pairs(limits_cfg) do 53 for sess_type, sess_limits in pairs(limits_cfg) do
45 limits[sess_type] = { 54 limits[sess_type] = {
46 bytes_per_second = parse_rate(sess_limits.rate, sess_type); 55 bytes_per_second = parse_rate(sess_limits.rate, sess_type);
47 burst_seconds = parse_burst(sess_limits.burst, sess_type); 56 burst_seconds = parse_burst(sess_limits.burst, sess_type);