Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/proxy_test.py
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | def __init__(self): | ||||
# ... one on IPv6 with similar configuration | # ... one on IPv6 with similar configuration | ||||
self.conf3 = Socks5Configuration() | self.conf3 = Socks5Configuration() | ||||
self.conf3.af = socket.AF_INET6 | self.conf3.af = socket.AF_INET6 | ||||
self.conf3.addr = ( | self.conf3.addr = ( | ||||
'::1', RANGE_BEGIN + 2000 + (os.getpid() % 1000)) | '::1', RANGE_BEGIN + 2000 + (os.getpid() % 1000)) | ||||
self.conf3.unauth = True | self.conf3.unauth = True | ||||
self.conf3.auth = True | self.conf3.auth = True | ||||
else: | else: | ||||
print("Warning: testing without local IPv6 support") | self.log.info("Warning: testing without local IPv6 support") | ||||
self.serv1 = Socks5Server(self.conf1) | self.serv1 = Socks5Server(self.conf1) | ||||
self.serv1.start() | self.serv1.start() | ||||
self.serv2 = Socks5Server(self.conf2) | self.serv2 = Socks5Server(self.conf2) | ||||
self.serv2.start() | self.serv2.start() | ||||
if self.have_ipv6: | if self.have_ipv6: | ||||
self.serv3 = Socks5Server(self.conf3) | self.serv3 = Socks5Server(self.conf3) | ||||
self.serv3.start() | self.serv3.start() | ||||
def setup_nodes(self): | def setup_nodes(self): | ||||
# Note: proxies are not used to connect to local nodes | # Note: proxies are not used to connect to local nodes | ||||
# this is because the proxy to use is based on CService.GetNetwork(), | # this is because the proxy to use is based on CService.GetNetwork(), | ||||
# which return NET_UNROUTABLE for localhost | # which return NET_UNROUTABLE for localhost | ||||
args = [ | args = [ | ||||
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % | ['-listen', '-proxy=%s:%i' % | ||||
(self.conf1.addr), '-proxyrandomize=1'], | (self.conf1.addr), '-proxyrandomize=1'], | ||||
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % | ['-listen', '-proxy=%s:%i' % | ||||
(self.conf1.addr), '-onion=%s:%i' % (self.conf2.addr), '-proxyrandomize=0'], | (self.conf1.addr), '-onion=%s:%i' % (self.conf2.addr), '-proxyrandomize=0'], | ||||
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % | ['-listen', '-proxy=%s:%i' % | ||||
(self.conf2.addr), '-proxyrandomize=1'], | (self.conf2.addr), '-proxyrandomize=1'], | ||||
[] | [] | ||||
] | ] | ||||
if self.have_ipv6: | if self.have_ipv6: | ||||
args[3] = ['-listen', '-debug=net', '-debug=proxy', '-proxy=[%s]:%i' % | args[3] = ['-listen', '-proxy=[%s]:%i' % | ||||
(self.conf3.addr), '-proxyrandomize=0', '-noonion'] | (self.conf3.addr), '-proxyrandomize=0', '-noonion'] | ||||
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=args) | return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=args) | ||||
def node_test(self, node, proxies, auth, test_onion=True): | def node_test(self, node, proxies, auth, test_onion=True): | ||||
rv = [] | rv = [] | ||||
# Test: outgoing IPv4 connection through node | # Test: outgoing IPv4 connection through node | ||||
node.addnode("15.61.23.23:1234", "onetry") | node.addnode("15.61.23.23:1234", "onetry") | ||||
cmd = proxies[0].queue.get() | cmd = proxies[0].queue.get() | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |