Revert "LogReader: fix issue when your dns resolves all requests" (#34229)

Revert "LogReader: fix issue when your dns resolves all requests (#34089)"

This reverts commit 7fc5040ed9.
pull/34234/head
Shane Smiskol 4 months ago committed by GitHub
parent d574513879
commit da2c70e097
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      tools/lib/filereader.py

@ -5,15 +5,12 @@ from urllib.parse import urlparse
from openpilot.tools.lib.url_file import URLFile from openpilot.tools.lib.url_file import URLFile
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/") DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
LOCAL_IPS = ["10.", "192.168.", *[f"172.{i}" for i in range(16, 32)]]
def internal_source_available(url=DATA_ENDPOINT): def internal_source_available(url=DATA_ENDPOINT):
try: try:
hostname = urlparse(url).hostname hostname = urlparse(url).hostname
port = urlparse(url).port or 80 port = urlparse(url).port or 80
if not socket.gethostbyname(hostname).startswith(LOCAL_IPS):
return False
with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s: with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
s.settimeout(0.5) s.settimeout(0.5)
s.connect((hostname, port)) s.connect((hostname, port))

Loading…
Cancel
Save