diff --git a/src/modules/ratelimit/doc/ratelimit_admin.xml b/src/modules/ratelimit/doc/ratelimit_admin.xml index bdfec2b8ac6..911da3fdf15 100644 --- a/src/modules/ratelimit/doc/ratelimit_admin.xml +++ b/src/modules/ratelimit/doc/ratelimit_admin.xml @@ -283,8 +283,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") then the pipe will be identified based on the matched queue. If a pipe number is provided as a parameter, then the given pipe number will be used for identifying the ratelimit algorithm. - The pipe number must be provided via a pseudovariable. It is recommended to - provide the pipe number via an integer pseudovariable. + The pipe number must be provided as number or via a pseudovariable. The method will return an error code if the limit for the matched algorithm is reached. @@ -297,7 +296,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") - This function can be used from REQUEST_ROUTE. + This function can be used from ANY_ROUTE. <function>rl_check</function> usage @@ -308,7 +307,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; + } ... # use pipe no 1 for the current method # set int pvar to 1 @@ -317,30 +316,19 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; -... - # use pipe no 1 for the current method - # set str pvar to 1 - $var(p) = "1"; - if (!rl_check("$var(p)") { - append_to_reply("Retry-After: 5\r\n"); - sl_send_reply("503","Limiting"); - exit; - }; + } ...
- <function moreinfo="none">rl_check_pipe([pipe_no])</function> + <function moreinfo="none">rl_check_pipe(pipe_no)</function> - Check the current request against the matched ratelimit algorithm. If no - parameter is provided, the queue will be matched based on method type, and - then the pipe will be identified based on the matched queue. If a pipe number - is provided as a parameter, then the given pipe number will be used for - identifying the ratelimit algorithm. + Check the current request against the matched ratelimit algorithm of the + pipe provided as parameter. The parameter can be provided as + number or variable. The method will return an error code if the limit for the matched algorithm is reached. @@ -357,20 +345,13 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") <function>rl_check_pipe</function> usage -... - # perform queue/pipe match for current method - if (!rl_check_pipe()) { - append_to_reply("Retry-After: 5\r\n"); - sl_send_reply("503","Limiting"); - exit; - }; ... # use pipe no 1 for the current method if (!rl_check_pipe("1") { append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; + } ...