Improved rnstatus output

This commit is contained in:
Mark Qvist 2022-05-25 14:21:04 +02:00
parent e00a758b2a
commit fc80dd2614

View File

@ -59,7 +59,7 @@ def program_setup(configdir, dispall=False, verbosity = 0):
for ifstat in stats["interfaces"]: for ifstat in stats["interfaces"]:
name = ifstat["name"] name = ifstat["name"]
if dispall or not (name.startswith("LocalInterface[") or name.startswith("TCPInterface[Client")): if dispall or not (name.startswith("LocalInterface[") or name.startswith("TCPInterface[Client") or name.startswith("I2PInterfacePeer[Connected peer")):
print("") print("")
if ifstat["status"]: if ifstat["status"]:
@ -91,6 +91,14 @@ def program_setup(configdir, dispall=False, verbosity = 0):
spec_str = " programs" spec_str = " programs"
clients_string = "Serving : "+str(cnum)+spec_str clients_string = "Serving : "+str(cnum)+spec_str
elif name.startswith("I2PInterface["):
cnum = max(clients-1,0)
if cnum == 1:
spec_str = " connected I2P endpoint"
else:
spec_str = " connected I2P endpoints"
clients_string = "Peers : "+str(cnum)+spec_str
else: else:
clients_string = "Clients : "+str(clients) clients_string = "Clients : "+str(clients)
@ -133,7 +141,7 @@ def program_setup(configdir, dispall=False, verbosity = 0):
print(" Traffic : {txb}\n {rxb}".format(rxb=size_str(ifstat["rxb"]), txb=size_str(ifstat["txb"]))) print(" Traffic : {txb}\n {rxb}".format(rxb=size_str(ifstat["rxb"]), txb=size_str(ifstat["txb"])))
if "transport_id" in stats and stats["transport_id"] != None: if "transport_id" in stats and stats["transport_id"] != None:
print("\n Reticulum Transport Instance "+RNS.prettyhexrep(stats["transport_id"])+" running") print("\n Reticulum Transport Instance "+RNS.prettyhexrep(stats["transport_id"])+" is running")
print("") print("")