Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/proxy_test.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
class ProxyTest(BitcoinTestFramework): | class ProxyTest(BitcoinTestFramework): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.num_nodes = 4 | self.num_nodes = 4 | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
def setup_nodes(self): | |||||
self.have_ipv6 = test_ipv6_local() | self.have_ipv6 = test_ipv6_local() | ||||
# Create two proxies on different ports | # Create two proxies on different ports | ||||
# ... one unauthenticated | # ... one unauthenticated | ||||
self.conf1 = Socks5Configuration() | self.conf1 = Socks5Configuration() | ||||
self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000)) | self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000)) | ||||
self.conf1.unauth = True | self.conf1.unauth = True | ||||
self.conf1.auth = False | self.conf1.auth = False | ||||
# ... one supporting authenticated and unauthenticated (Tor) | # ... one supporting authenticated and unauthenticated (Tor) | ||||
Show All 16 Lines | def setup_nodes(self): | ||||
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): | |||||
# 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', '-proxy=%s:%i' % | ['-listen', '-proxy=%s:%i' % | ||||
(self.conf1.addr), '-proxyrandomize=1'], | (self.conf1.addr), '-proxyrandomize=1'], | ||||
['-listen', '-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'], | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |