Commit 608a357c by gongyang

完成秒速白名单开发

parent 9b618922
Showing with 4 additions and 3 deletions
...@@ -199,16 +199,17 @@ if err == nil then ...@@ -199,16 +199,17 @@ if err == nil then
second_white_count = tonumber(red:get('waf_second_white_ip_time')) second_white_count = tonumber(red:get('waf_second_white_ip_time'))
--如果不存在则设为1 --如果不存在则设为1
timestamp_seconds = os.time() timestamp_seconds = ngx.var.time_local
ngx.say(timestamp_seconds) ngx.say(timestamp_seconds)
if red:get(timestamp_seconds) == ngx.null then if red:get(timestamp_seconds) == ngx.null then
red:set(timestamp_seconds,0) red:set(timestamp_seconds,0)
end end
red:incr(timestamp_seconds) red:incr(timestamp_seconds)
red:expire(timestamp_seconds , second_white_ip_expire_time) red:expire(timestamp_seconds , 10)
--如果超过次数就跳转至google验证页面,并且带上网址 --如果超过次数就跳转至google验证页面,并且带上网址
if tonumber(red:get(timestamp_seconds)) > second_white_count then if tonumber(red:get(timestamp_seconds)) >= second_white_count then
redirect.checkgoogle(red) redirect.checkgoogle(red)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment