(self)
| 46 | self.num_nodes = 4 |
| 47 | |
| 48 | def setup_nodes(self): |
| 49 | self.have_ipv6 = test_ipv6_local() |
| 50 | # Create two proxies on different ports |
| 51 | # ... one unauthenticated |
| 52 | self.conf1 = Socks5Configuration() |
| 53 | self.conf1.addr = ('127.0.0.1', RANGE_BEGIN + (os.getpid() % 1000)) |
| 54 | self.conf1.unauth = True |
| 55 | self.conf1.auth = False |
| 56 | # ... one supporting authenticated and unauthenticated (Tor) |
| 57 | self.conf2 = Socks5Configuration() |
| 58 | self.conf2.addr = ('127.0.0.1', RANGE_BEGIN + 1000 + (os.getpid() % 1000)) |
| 59 | self.conf2.unauth = True |
| 60 | self.conf2.auth = True |
| 61 | if self.have_ipv6: |
| 62 | # ... one on IPv6 with similar configuration |
| 63 | self.conf3 = Socks5Configuration() |
| 64 | self.conf3.af = socket.AF_INET6 |
| 65 | self.conf3.addr = ('::1', RANGE_BEGIN + 2000 + (os.getpid() % 1000)) |
| 66 | self.conf3.unauth = True |
| 67 | self.conf3.auth = True |
| 68 | else: |
| 69 | self.log.warning("Testing without local IPv6 support") |
| 70 | |
| 71 | self.serv1 = Socks5Server(self.conf1) |
| 72 | self.serv1.start() |
| 73 | self.serv2 = Socks5Server(self.conf2) |
| 74 | self.serv2.start() |
| 75 | if self.have_ipv6: |
| 76 | self.serv3 = Socks5Server(self.conf3) |
| 77 | self.serv3.start() |
| 78 | |
| 79 | # Note: proxies are not used to connect to local nodes |
| 80 | # this is because the proxy to use is based on CService.GetNetwork(), which return NET_UNROUTABLE for localhost |
| 81 | args = [ |
| 82 | ['-listen', '-proxy=%s:%i' % (self.conf1.addr),'-proxyrandomize=1'], |
| 83 | ['-listen', '-proxy=%s:%i' % (self.conf1.addr),'-onion=%s:%i' % (self.conf2.addr),'-proxyrandomize=0'], |
| 84 | ['-listen', '-proxy=%s:%i' % (self.conf2.addr),'-proxyrandomize=1'], |
| 85 | [] |
| 86 | ] |
| 87 | if self.have_ipv6: |
| 88 | args[3] = ['-listen', '-proxy=[%s]:%i' % (self.conf3.addr),'-proxyrandomize=0', '-noonion'] |
| 89 | self.add_nodes(self.num_nodes, extra_args=args) |
| 90 | self.start_nodes() |
| 91 | |
| 92 | def node_test(self, node, proxies, auth, test_onion=True): |
| 93 | rv = [] |
nothing calls this directly
no test coverage detected