@@ -338,6 +338,26 @@ Value getnettotals(const Array& params, bool fHelp)
338
338
return obj;
339
339
}
340
340
341
+ static Array GetNetworksInfo ()
342
+ {
343
+ Array networks;
344
+ for (int n=0 ; n<NET_MAX; ++n)
345
+ {
346
+ enum Network network = static_cast <enum Network>(n);
347
+ if (network == NET_UNROUTABLE)
348
+ continue ;
349
+ proxyType proxy;
350
+ Object obj;
351
+ GetProxy (network, proxy);
352
+ obj.push_back (Pair (" name" , GetNetworkName (network)));
353
+ obj.push_back (Pair (" limited" , IsLimited (network)));
354
+ obj.push_back (Pair (" reachable" , IsReachable (network)));
355
+ obj.push_back (Pair (" proxy" , proxy.IsValid () ? proxy.ToStringIPPort () : string ()));
356
+ networks.push_back (obj);
357
+ }
358
+ return networks;
359
+ }
360
+
341
361
Value getnetworkinfo (const Array& params, bool fHelp )
342
362
{
343
363
if (fHelp || params.size () != 0 )
@@ -351,7 +371,13 @@ Value getnetworkinfo(const Array& params, bool fHelp)
351
371
" \" localservices\" : \" xxxxxxxxxxxxxxxx\" , (string) the services we offer to the network\n "
352
372
" \" timeoffset\" : xxxxx, (numeric) the time offset\n "
353
373
" \" connections\" : xxxxx, (numeric) the number of connections\n "
354
- " \" proxy\" : \" host:port\" , (string, optional) the proxy used by the server\n "
374
+ " \" networks\" : [ (array) information per network\n "
375
+ " \" name\" : \" xxx\" , (string) network (ipv4, ipv6 or onion)\n "
376
+ " \" limited\" : xxx, (boolean) is the network limited using -onlynet?\n "
377
+ " \" reachable\" : xxx, (boolean) is the network reachable?\n "
378
+ " \" proxy\" : \" host:port\" (string) the proxy that is used for this network, or empty if none\n "
379
+ " },\n "
380
+ " ],\n "
355
381
" \" relayfee\" : x.xxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n "
356
382
" \" localaddresses\" : [, (array) list of local addresses\n "
357
383
" \" address\" : \" xxxx\" , (string) network address\n "
@@ -364,16 +390,13 @@ Value getnetworkinfo(const Array& params, bool fHelp)
364
390
+ HelpExampleRpc (" getnetworkinfo" , " " )
365
391
);
366
392
367
- proxyType proxy;
368
- GetProxy (NET_IPV4, proxy);
369
-
370
393
Object obj;
371
394
obj.push_back (Pair (" version" , (int )CLIENT_VERSION));
372
395
obj.push_back (Pair (" protocolversion" ,(int )PROTOCOL_VERSION));
373
396
obj.push_back (Pair (" localservices" , strprintf (" %016x" , nLocalServices)));
374
397
obj.push_back (Pair (" timeoffset" , GetTimeOffset ()));
375
398
obj.push_back (Pair (" connections" , (int )vNodes.size ()));
376
- obj.push_back (Pair (" proxy " , (proxy. IsValid () ? proxy. ToStringIPPort () : string () )));
399
+ obj.push_back (Pair (" networks " , GetNetworksInfo ( )));
377
400
obj.push_back (Pair (" relayfee" , ValueFromAmount (::minRelayTxFee.GetFeePerK ())));
378
401
Array localAddresses;
379
402
{
0 commit comments