From bc51150e4756b8e2c70d5ba9c66f922fdbf0ca72 Mon Sep 17 00:00:00 2001 From: thecookingsenpai Date: Wed, 31 Jan 2024 18:25:20 +0100 Subject: [PATCH] failproof online check (fixes vpns and dns tunnels) --- app/utils/network.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/utils/network.py b/app/utils/network.py index 1a1c89c..1480c52 100644 --- a/app/utils/network.py +++ b/app/utils/network.py @@ -1,12 +1,14 @@ import socket as Socket - -def has_connection(host="8.8.8.8", port=53, timeout=3): + +def has_connection(host="google.it", port=80, timeout=3): """ + # REVIEW Was: Host: 8.8.8.8 (google-public-dns-a.google.com) OpenPort: 53/tcp Service: domain (DNS/TCP) """ + try: Socket.setdefaulttimeout(timeout) Socket.socket(Socket.AF_INET, Socket.SOCK_STREAM).connect((host, port))