Changeset View
Changeset View
Standalone View
Standalone View
test/functional/proxy_test.py
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
RANGE_BEGIN = PORT_MIN + 2 * PORT_RANGE # Start after p2p and rpc ports | RANGE_BEGIN = PORT_MIN + 2 * PORT_RANGE # Start after p2p and rpc ports | ||||
class ProxyTest(BitcoinTestFramework): | class ProxyTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 4 | self.num_nodes = 4 | ||||
def setup_nodes(self): | def setup_nodes(self): | ||||
# We will start 3 socks proxies, and 3 nodes. | |||||
# Use rpc_port #3,#4, and ipv6 #5 for the socks proxies | |||||
# Use rpc_port 0,1,2 for the nodes rpc ports | |||||
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', self.rpc_port(4)) | ||||
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) | ||||
self.conf2 = Socks5Configuration() | self.conf2 = Socks5Configuration() | ||||
self.conf2.addr = ( | self.conf2.addr = ( | ||||
'127.0.0.1', RANGE_BEGIN + 1000 + (os.getpid() % 1000)) | '127.0.0.1', RANGE_BEGIN + 1000 + self.rpc_port(5)) | ||||
self.conf2.unauth = True | self.conf2.unauth = True | ||||
self.conf2.auth = True | self.conf2.auth = True | ||||
if self.have_ipv6: | if self.have_ipv6: | ||||
# ... 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', self.rpc_port(6)) | ||||
self.conf3.unauth = True | self.conf3.unauth = True | ||||
self.conf3.auth = True | self.conf3.auth = True | ||||
else: | else: | ||||
self.log.warning("Testing without local IPv6 support") | self.log.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) | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |