Update init.lua
parent
aaf0dfc2a9
commit
c63ec5e395
14
init.lua
14
init.lua
|
@ -13,9 +13,7 @@ WhiteCheck = optionIsOn(whiteModule)
|
||||||
PathInfoFix = optionIsOn(PathInfoFix)
|
PathInfoFix = optionIsOn(PathInfoFix)
|
||||||
attacklog = optionIsOn(attacklog)
|
attacklog = optionIsOn(attacklog)
|
||||||
CCDeny = optionIsOn(CCDeny)
|
CCDeny = optionIsOn(CCDeny)
|
||||||
CCrate = CCrate
|
|
||||||
Redirect=optionIsOn(Redirect)
|
Redirect=optionIsOn(Redirect)
|
||||||
ipWhitelist=ipWhitelist
|
|
||||||
function getClientIp()
|
function getClientIp()
|
||||||
IP = ngx.req.get_headers()["X-Real-IP"]
|
IP = ngx.req.get_headers()["X-Real-IP"]
|
||||||
if IP == nil then
|
if IP == nil then
|
||||||
|
@ -202,3 +200,15 @@ function whiteip()
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
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