diff --git a/oml/tor_request.py b/oml/tor_request.py index 3a7cf3d..a9ae455 100644 --- a/oml/tor_request.py +++ b/oml/tor_request.py @@ -11,7 +11,7 @@ import socket import settings import state -from utils import get_service_id, get_local_ipv4 +from utils import get_service_id logger = logging.getLogger(__name__) @@ -27,11 +27,7 @@ class InvalidCertificateException(http.client.HTTPException, urllib.error.URLErr (self._service_id, self._cert_service_id, self.reason)) def is_local(host): - local_net = get_local_ipv4() - if not local_net: - return False - local_net = '.'.join(local_net.split('.')[:-1]) + '.' - return host.startswith('127.0.0.1') or host.startswith(local_net) + return len([p for p in host.split(':')[0].split('.') if p.isdigit()]) == 4 def getaddrinfo(*args): return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]