MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / node_test

Method node_test

test/functional/feature_proxy.py:92–146  ·  view source on GitHub ↗
(self, node, proxies, auth, test_onion=True)

Source from the content-addressed store, hash-verified

90 self.start_nodes()
91
92 def node_test(self, node, proxies, auth, test_onion=True):
93 rv = []
94 # Test: outgoing IPv4 connection through node
95 node.addnode("15.61.23.23:1234", "onetry")
96 cmd = proxies[0].queue.get()
97 assert(isinstance(cmd, Socks5Command))
98 # Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
99 assert_equal(cmd.atyp, AddressType.DOMAINNAME)
100 assert_equal(cmd.addr, b"15.61.23.23")
101 assert_equal(cmd.port, 1234)
102 if not auth:
103 assert_equal(cmd.username, None)
104 assert_equal(cmd.password, None)
105 rv.append(cmd)
106
107 if self.have_ipv6:
108 # Test: outgoing IPv6 connection through node
109 node.addnode("[1233:3432:2434:2343:3234:2345:6546:4534]:5443", "onetry")
110 cmd = proxies[1].queue.get()
111 assert(isinstance(cmd, Socks5Command))
112 # Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
113 assert_equal(cmd.atyp, AddressType.DOMAINNAME)
114 assert_equal(cmd.addr, b"1233:3432:2434:2343:3234:2345:6546:4534")
115 assert_equal(cmd.port, 5443)
116 if not auth:
117 assert_equal(cmd.username, None)
118 assert_equal(cmd.password, None)
119 rv.append(cmd)
120
121 if test_onion:
122 # Test: outgoing onion connection through node
123 node.addnode("bitcoinostk4e4re.onion:8333", "onetry")
124 cmd = proxies[2].queue.get()
125 assert(isinstance(cmd, Socks5Command))
126 assert_equal(cmd.atyp, AddressType.DOMAINNAME)
127 assert_equal(cmd.addr, b"bitcoinostk4e4re.onion")
128 assert_equal(cmd.port, 8333)
129 if not auth:
130 assert_equal(cmd.username, None)
131 assert_equal(cmd.password, None)
132 rv.append(cmd)
133
134 # Test: outgoing DNS name connection through node
135 node.addnode("node.noumenon:8333", "onetry")
136 cmd = proxies[3].queue.get()
137 assert(isinstance(cmd, Socks5Command))
138 assert_equal(cmd.atyp, AddressType.DOMAINNAME)
139 assert_equal(cmd.addr, b"node.noumenon")
140 assert_equal(cmd.port, 8333)
141 if not auth:
142 assert_equal(cmd.username, None)
143 assert_equal(cmd.password, None)
144 rv.append(cmd)
145
146 return rv
147
148 def run_test(self):
149 # basic -proxy

Callers 1

run_testMethod · 0.95

Calls 2

assert_equalFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected