misc: simplify tor proxy URL to avoid circuit exhaustion
This commit is contained in:
11
misc.py
11
misc.py
@@ -187,12 +187,9 @@ def categorize_error(exc):
|
||||
|
||||
|
||||
def tor_proxy_url(torhost):
|
||||
"""Generate Tor SOCKS5 proxy URL with random credentials for circuit isolation.
|
||||
"""Generate Tor SOCKS5 proxy URL.
|
||||
|
||||
Tor treats different username:password as separate streams, using different
|
||||
circuits. This ensures each connection gets a fresh circuit.
|
||||
Uses no auth to allow Tor to reuse circuits naturally, avoiding
|
||||
circuit exhaustion from IsolateSOCKSAuth behavior.
|
||||
"""
|
||||
chars = string.ascii_lowercase + string.digits
|
||||
user = ''.join(random.choice(chars) for _ in range(8))
|
||||
passwd = ''.join(random.choice(chars) for _ in range(8))
|
||||
return 'socks5://%s:%s@%s' % (user, passwd, torhost)
|
||||
return 'socks5://%s' % torhost
|
||||
|
||||
Reference in New Issue
Block a user