dont use tor for ip hosts

This commit is contained in:
j 2016-03-14 14:25:51 +01:00
parent 635e718708
commit a95960321a

View file

@ -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]))]