From 2695fd4eba25acbb1fc5fe37ab05b92e77cdcb79 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Sun, 20 Nov 2022 18:26:49 -0500 Subject: [PATCH] Support IPv6 whitelists and blacklists (#30) Support ipv6 --- pastey/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pastey/common.py b/pastey/common.py index 3c65137..5c1130e 100644 --- a/pastey/common.py +++ b/pastey/common.py @@ -15,7 +15,7 @@ def verify_whitelist(ip): # Check blacklist for network in config.blacklist_cidr: - if address in ipaddress.IPv4Network(network): + if address in ipaddress.ip_network(network): return False if not config.use_whitelist: @@ -23,7 +23,7 @@ def verify_whitelist(ip): # Check whitelist for network in config.whitelist_cidr: - if address in ipaddress.IPv4Network(network): + if address in ipaddress.ip_network(network): return True return False @@ -106,4 +106,4 @@ def build_url(request, path="/"): else: protocol = request.url.split('//')[0] if not config.force_https_links else "https:" - return protocol + "//" + domain + path \ No newline at end of file + return protocol + "//" + domain + path