Authored by chunhua.zhang

add

... ... @@ -2,10 +2,16 @@ require "resty.core"
local cjson = require "cjson"
local http_request = require "http_request"
local iptool=require "iptool"
local default_err_code=9999991
local default_err_msg="系统正忙,请稍后重试!"
-- read config
local common_config=lua_context.configs["common_conf"]
local limit_config=lua_context.configs["api_rate_limit_conf"]
local limit_ip_config=lua_context.configs["limit_ip_access"]
--- do limit using local cache
function limit(limit_key,max_limit,seconds)
... ... @@ -32,11 +38,6 @@ end
-------- function: doing rate limit -----
function rate_limit()
-- read config
local common_config=lua_context.configs["common_conf"]
local limit_config=lua_context.configs["api_rate_limit_conf"]
local limit_ip_config=lua_context.configs["limit_ip_access"]
if (not common_config) or (not limit_config) then
return
end
... ...