dont use tor for ip hosts
This commit is contained in:
parent
635e718708
commit
a95960321a
1 changed files with 2 additions and 6 deletions
|
@ -11,7 +11,7 @@ import socket
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
import state
|
import state
|
||||||
from utils import get_service_id, get_local_ipv4
|
from utils import get_service_id
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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))
|
(self._service_id, self._cert_service_id, self.reason))
|
||||||
|
|
||||||
def is_local(host):
|
def is_local(host):
|
||||||
local_net = get_local_ipv4()
|
return len([p for p in host.split(':')[0].split('.') if p.isdigit()]) == 4
|
||||||
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)
|
|
||||||
|
|
||||||
def getaddrinfo(*args):
|
def getaddrinfo(*args):
|
||||||
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
|
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
|
||||||
|
|
Loading…
Reference in a new issue