mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-05 13:50:14 +00:00
Improved rnstatus output
This commit is contained in:
parent
5606b64317
commit
b3a439993d
@ -761,7 +761,7 @@ class Reticulum:
|
|||||||
response = rpc_connection.recv()
|
response = rpc_connection.recv()
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
stats = []
|
interfaces = []
|
||||||
for interface in RNS.Transport.interfaces:
|
for interface in RNS.Transport.interfaces:
|
||||||
ifstats = {}
|
ifstats = {}
|
||||||
|
|
||||||
@ -800,7 +800,12 @@ class Reticulum:
|
|||||||
ifstats["status"] = interface.online
|
ifstats["status"] = interface.online
|
||||||
ifstats["mode"] = interface.mode
|
ifstats["mode"] = interface.mode
|
||||||
|
|
||||||
stats.append(ifstats)
|
interfaces.append(ifstats)
|
||||||
|
|
||||||
|
stats = {}
|
||||||
|
stats["interfaces"] = interfaces
|
||||||
|
if Reticulum.transport_enabled():
|
||||||
|
stats["transport_id"] = RNS.Transport.identity.hash
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
@ -49,18 +49,19 @@ def size_str(num, suffix='B'):
|
|||||||
def program_setup(configdir, dispall=False, verbosity = 0):
|
def program_setup(configdir, dispall=False, verbosity = 0):
|
||||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
||||||
|
|
||||||
ifstats = None
|
stats = None
|
||||||
try:
|
try:
|
||||||
ifstats = reticulum.get_interface_stats()
|
stats = reticulum.get_interface_stats()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if ifstats != None:
|
if stats != None:
|
||||||
for ifstat in ifstats:
|
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")):
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
if ifstat["status"]:
|
if ifstat["status"]:
|
||||||
ss = "Up"
|
ss = "Up"
|
||||||
else:
|
else:
|
||||||
@ -117,6 +118,9 @@ 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:
|
||||||
|
print("\n Transport Instance "+RNS.prettyhexrep(stats["transport_id"])+" running")
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user