mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
refactor: enhance DNS resolution check to support multiple domains across platforms
This commit is contained in:
parent
f88eea6be1
commit
80b13d1e8a
@ -323,17 +323,20 @@ class InternManager():
|
|||||||
def check_dns_resolve(self):
|
def check_dns_resolve(self):
|
||||||
"""
|
"""
|
||||||
Check if the system's current DNS server can resolve a domain name.
|
Check if the system's current DNS server can resolve a domain name.
|
||||||
|
Works on both Windows and Unix-like systems.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if the current DNS server can resolve a domain name,
|
bool: True if the current DNS server can resolve a domain name,
|
||||||
False if can't resolve or in case of errors
|
False if can't resolve or in case of errors
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
test_domains = ["github.com", "google.com", "microsoft.com", "amazon.com"]
|
||||||
try:
|
try:
|
||||||
resolver = dns.resolver.Resolver()
|
for domain in test_domains:
|
||||||
# Simple DNS resolution test - will raise an exception if it fails
|
# socket.gethostbyname() works consistently across all platforms
|
||||||
resolver.resolve("github.com")
|
os.socket.gethostbyname(domain)
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except (os.socket.gaierror, os.socket.error):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class OsSummary:
|
class OsSummary:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user