mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-04 10:20:18 +00:00
failproof online check (fixes vpns and dns tunnels)
This commit is contained in:
parent
c153247918
commit
bc51150e47
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user