Start a node with rpcallow IP, and request getnetworkinfo at a non-localhost IP.
(self, allow_ips, rpchost, rpcport)
| 44 | self.stop_nodes() |
| 45 | |
| 46 | def run_allowip_test(self, allow_ips, rpchost, rpcport): |
| 47 | ''' |
| 48 | Start a node with rpcallow IP, and request getnetworkinfo |
| 49 | at a non-localhost IP. |
| 50 | ''' |
| 51 | self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport)) |
| 52 | node_args = \ |
| 53 | ['-disablewallet', '-nolisten'] + \ |
| 54 | ['-rpcallowip='+x for x in allow_ips] + \ |
| 55 | ['-rpcbind='+addr for addr in ['127.0.0.1', "%s:%d" % (rpchost, rpcport)]] # Bind to localhost as well so start_nodes doesn't hang |
| 56 | self.nodes[0].rpchost = None |
| 57 | self.start_nodes([node_args]) |
| 58 | # connect to node through non-loopback interface |
| 59 | node = get_rpc_proxy(rpc_url(self.nodes[0].datadir, 0, self.chain, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir) |
| 60 | node.getnetworkinfo() |
| 61 | self.stop_nodes() |
| 62 | |
| 63 | def run_test(self): |
| 64 | # due to OS-specific network stats queries, this test works only on Linux |
no test coverage detected