Update init.lua
parent
aaf0dfc2a9
commit
c63ec5e395
14
init.lua
14
init.lua
|
@ -13,9 +13,7 @@ WhiteCheck = optionIsOn(whiteModule)
|
|||
PathInfoFix = optionIsOn(PathInfoFix)
|
||||
attacklog = optionIsOn(attacklog)
|
||||
CCDeny = optionIsOn(CCDeny)
|
||||
CCrate = CCrate
|
||||
Redirect=optionIsOn(Redirect)
|
||||
ipWhitelist=ipWhitelist
|
||||
function getClientIp()
|
||||
IP = ngx.req.get_headers()["X-Real-IP"]
|
||||
if IP == nil then
|
||||
|
@ -202,3 +200,15 @@ function whiteip()
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function blockip()
|
||||
if next(ipBlocklist) ~= nil then
|
||||
for _,ip in pairs(ipBlocklist) do
|
||||
if getClientIp()==ip then
|
||||
ngx.exit(403)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue