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):
|
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
|
Uses no auth to allow Tor to reuse circuits naturally, avoiding
|
||||||
circuits. This ensures each connection gets a fresh circuit.
|
circuit exhaustion from IsolateSOCKSAuth behavior.
|
||||||
"""
|
"""
|
||||||
chars = string.ascii_lowercase + string.digits
|
return 'socks5://%s' % torhost
|
||||||
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)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user