mirror of
https://github.com/optim-enterprises-bv/Mailu.git
synced 2025-11-03 11:37:47 +00:00
Introduce AUTH_RATELIMIT_EXEMPTION
This disables rate limiting on specific CIDRs
This commit is contained in:
@@ -79,6 +79,12 @@ def extract_network_from_ip(ip):
|
||||
else:
|
||||
return str(n.supernet(prefixlen_diff=(128-int(app.config["AUTH_RATELIMIT_IP_V6_MASK"]))).network_address)
|
||||
|
||||
def is_exempt_from_ratelimits(ip):
|
||||
for range in [net.strip() for net in app.config['AUTH_RATELIMIT_EXEMPTION'].split(',')]:
|
||||
if ipaddress.ip_address(ip) in ipaddress.ip_network(ip, False):
|
||||
return False
|
||||
return True
|
||||
|
||||
# Application translation
|
||||
babel = flask_babel.Babel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user