mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
failproof online check (fixes vpns and dns tunnels)
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import socket as Socket
|
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)
|
Host: 8.8.8.8 (google-public-dns-a.google.com)
|
||||||
OpenPort: 53/tcp
|
OpenPort: 53/tcp
|
||||||
Service: domain (DNS/TCP)
|
Service: domain (DNS/TCP)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Socket.setdefaulttimeout(timeout)
|
Socket.setdefaulttimeout(timeout)
|
||||||
Socket.socket(Socket.AF_INET, Socket.SOCK_STREAM).connect((host, port))
|
Socket.socket(Socket.AF_INET, Socket.SOCK_STREAM).connect((host, port))
|
||||||
|
|||||||
Reference in New Issue
Block a user