Improved comment clarity on DNS features

This commit is contained in:
SimplifiedPrivacy 2026-07-12 16:55:52 -04:00
parent 882f374937
commit cc61784502

View file

@ -40,8 +40,21 @@ def is_dns_problem(url: str) -> bool:
def dns_works_via_tor(domain, connection_observer, client_observer=None):
"""
Purpose:
Check if domain's resolver is blocking Tor by querying via proxychains.
Method:
Dynamically configures proxychains with the given port.
Uses this to query the DNS via dig.
Dependencies:
Proxychains being installed.
Called by:
step4_error_classifier's classify_request_error
Raises Errors?
False
"""
port_number = ConnectionService.get_random_available_port_number()
@ -87,15 +100,20 @@ socks5 127.0.0.1 {port_number}
print("running command...")
# Run dig through proxychains with the dynamic config
try:
result = subprocess.run(
['proxychains4', '-f', config_path, 'dig', domain, '+short'],
capture_output=True,
text=True,
timeout=10
)
print(f"result: {result}")
logger.debug(f"result: {result}")
except:
logger.error(f"[DNS PROBLEM] Proxychains not installed on this computer")
return False
output = result.stdout.strip()
print(f"output: {output}")
logger.debug(f"output of stripping the IP out of the result: {output}")
if not output or result.returncode != 0:
logger.debug(f"[DNS PROBLEM] {domain}: No response")