Watch 1 Star 0 Fork 1

haixing / lua-limitLuaMIT

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
OpenRestry Lua 限流工具,支持 令牌桶限流、cookie 限流、日期范围限流、概率限流 spread retract

Clone or download
test_bucket.lua 479 Bytes
Copy Edit Web IDE Raw Blame History
haixing authored 2019-08-21 22:27 . init to gitee
local conf = {
default_rule = {
bucket = {
bucket_dict_name = "limit_srvs",
bucket_rate = 2,
bucket_burst = 1,
--bucket_target = ”ip“
bucket_target = "uri"
}
}
}
function message(limit, data)
ngx.say("reject by bucket")
ngx.exit(ngx.HTTP_OK)
end
-- 没有指定 who 方法,所以需要使用默认的 default_rule 规则链
local limit = require "limit":new(conf)
limit:execute()

Comment ( 0 )

Sign in for post a comment

Lua
1
https://gitee.com/mahaixing/lua-limit.git
git@gitee.com:mahaixing/lua-limit.git
mahaixing
lua-limit
lua-limit
master

Help Search