util: bypass tor for .local domains

This commit is contained in:
nahuhh
2024-11-13 21:49:40 +00:00
committed by tecnovert
parent b5f6eb6526
commit b484827c15

View File

@@ -15,9 +15,10 @@ from urllib.request import Request, urlopen
def is_private_ip_address(addr: str):
# Will return false for all URLs
if addr == 'localhost':
return True
if addr.endswith('.local'):
return True
try:
return ipaddress.ip_address(addr).is_private
except Exception: