ip黑白名单支持配置网段来过滤
							parent
							
								
									314a2f62ec
								
							
						
					
					
						commit
						b5505917bf
					
				
							
								
								
									
										6
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										6
									
								
								init.lua
								
								
								
								
							|  | @ -223,8 +223,9 @@ end | |||
| 
 | ||||
| function whiteip() | ||||
|     if next(ipWhitelist) ~= nil then | ||||
|         clientIp = getClientIp() | ||||
|         for _,ip in pairs(ipWhitelist) do | ||||
|             if getClientIp()==ip then | ||||
|             if ip == clientIp or string.find(clientIp, ip) then | ||||
|                 return true | ||||
|             end | ||||
|         end | ||||
|  | @ -234,8 +235,9 @@ end | |||
| 
 | ||||
| function blockip() | ||||
|      if next(ipBlocklist) ~= nil then | ||||
|         clientIp = getClientIp() | ||||
|          for _,ip in pairs(ipBlocklist) do | ||||
|              if getClientIp()==ip then | ||||
|             if ip == clientIp or string.find(clientIp, ip) then | ||||
|                  ngx.exit(403) | ||||
|                  return true | ||||
|              end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 陈文江
						陈文江