13 - Start bitcoind's with different proxy configurations 14 - Use addnode to initiate connections 15 - Verify that proxies are connected to, and the right connection command is given 16 - Proxy configurations to test on bitcoind side: 17 - `-proxy` (proxy everything) 18 - `-onion` (proxy just onions) 19 - `-proxyrandomize` Circuit randomization 20 - Proxy configurations to test on proxy side, 21 - support no authentication (other proxy) 22 - support no authentication + user/pass authentication (Tor) 25 - Create various proxies (as threads) 26 - Create bitcoinds that connect to them 27 - Manipulate the bitcoinds using addnode (onetry) an observe effects 29 addnode connect to IPv4 30 addnode connect to IPv6 31 addnode connect to onion 32 addnode connect to generic DNS name 42 self.
conf1.addr = (
'127.0.0.1', 13000 + (os.getpid() % 1000))
43 self.
conf1.unauth =
True 44 self.
conf1.auth =
False 47 self.
conf2.addr = (
'127.0.0.1', 14000 + (os.getpid() % 1000))
48 self.
conf2.unauth =
True 49 self.
conf2.auth =
True 53 self.
conf3.af = socket.AF_INET6
54 self.
conf3.addr = (
'::1', 15000 + (os.getpid() % 1000))
55 self.
conf3.unauth =
True 56 self.
conf3.auth =
True 58 print "Warning: testing without local IPv6 support" 72 [
'-listen',
'-debug=net',
'-debug=proxy',
'-proxy=%s:%i' % (self.
conf1.addr),
'-proxyrandomize=1'],
73 [
'-listen',
'-debug=net',
'-debug=proxy',
'-proxy=%s:%i' % (self.
conf1.addr),
'-onion=%s:%i' % (self.
conf2.addr),
'-proxyrandomize=0'],
74 [
'-listen',
'-debug=net',
'-debug=proxy',
'-proxy=%s:%i' % (self.
conf2.addr),
'-proxyrandomize=1'],
78 args[3] = [
'-listen',
'-debug=net',
'-debug=proxy',
'-proxy=[%s]:%i' % (self.
conf3.addr),
'-proxyrandomize=0',
'-noonion']
79 return start_nodes(4, self.options.tmpdir, extra_args=args)
81 def node_test(self, node, proxies, auth, test_onion=True):
84 node.addnode(
"15.61.23.23:1234",
"onetry")
85 cmd = proxies[0].queue.get()
86 assert(isinstance(cmd, Socks5Command))
98 node.addnode(
"[1233:3432:2434:2343:3234:2345:6546:4534]:5443",
"onetry")
99 cmd = proxies[1].queue.get()
100 assert(isinstance(cmd, Socks5Command))
103 assert_equal(cmd.addr, b
"1233:3432:2434:2343:3234:2345:6546:4534")
112 node.addnode(
"bitcoinostk4e4re.onion:8333",
"onetry")
113 cmd = proxies[2].queue.get()
114 assert(isinstance(cmd, Socks5Command))
124 node.addnode(
"node.noumenon:8333",
"onetry")
125 cmd = proxies[3].queue.get()
126 assert(isinstance(cmd, Socks5Command))
147 credentials = set((x.username,x.password)
for x
in rv)
154 def networks_dict(d):
156 for x
in d[
'networks']:
162 for net
in [
'ipv4',
'ipv6',
'onion']:
164 assert_equal(n0[net][
'proxy_randomize_credentials'],
True)
168 for net
in [
'ipv4',
'ipv6']:
170 assert_equal(n1[net][
'proxy_randomize_credentials'],
False)
172 assert_equal(n1[
'onion'][
'proxy_randomize_credentials'],
False)
176 for net
in [
'ipv4',
'ipv6',
'onion']:
178 assert_equal(n2[net][
'proxy_randomize_credentials'],
True)
183 for net
in [
'ipv4',
'ipv6']:
185 assert_equal(n3[net][
'proxy_randomize_credentials'],
False)
188 if __name__ ==
'__main__':
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None)
def node_test(self, node, proxies, auth, test_onion=True)
UniValue getnetworkinfo(const UniValue ¶ms, bool fHelp)
def assert_equal(thing1, thing2)