Merge e07cb445ac
into 314a2f62ec
commit
41f02ab18b
6
init.lua
6
init.lua
|
@ -223,8 +223,9 @@ end
|
||||||
|
|
||||||
function whiteip()
|
function whiteip()
|
||||||
if next(ipWhitelist) ~= nil then
|
if next(ipWhitelist) ~= nil then
|
||||||
|
clientIp = getClientIp()
|
||||||
for _,ip in pairs(ipWhitelist) do
|
for _,ip in pairs(ipWhitelist) do
|
||||||
if getClientIp()==ip then
|
if ip == clientIp or string.find(clientIp, ip) == 1 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -234,8 +235,9 @@ end
|
||||||
|
|
||||||
function blockip()
|
function blockip()
|
||||||
if next(ipBlocklist) ~= nil then
|
if next(ipBlocklist) ~= nil then
|
||||||
|
clientIp = getClientIp()
|
||||||
for _,ip in pairs(ipBlocklist) do
|
for _,ip in pairs(ipBlocklist) do
|
||||||
if getClientIp()==ip then
|
if ip == clientIp or string.find(clientIp, ip) == 1 then
|
||||||
ngx.exit(403)
|
ngx.exit(403)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue