pull/108/merge
senchen 2016-09-06 13:34:14 +00:00 committed by GitHub
commit 41f02ab18b
1 changed files with 4 additions and 2 deletions

View File

@ -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