mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
test: extend the SOCKS5 Python proxy to actually connect to a destination
If requested, make the SOCKS5 Python proxy redirect each connection to a given destination. Actually act as a real proxy, connecting the client to a destination, except that the destination is not what the client asked for. This would enable us to "connect" to Tor addresses from the functional tests.
This commit is contained in:
@@ -167,3 +167,10 @@ def test_unix_socket():
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def format_addr_port(addr, port):
|
||||
'''Return either "addr:port" or "[addr]:port" based on whether addr looks like an IPv6 address.'''
|
||||
if ":" in addr:
|
||||
return f"[{addr}]:{port}"
|
||||
else:
|
||||
return f"{addr}:{port}"
|
||||
|
||||
Reference in New Issue
Block a user