diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index 77ae994e..f7225ab7 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -2043,7 +2043,8 @@ class Reticulum: "expires": RNS.Transport.path_table[dst_hash][3], "value": dst_value, "used": RNS.Transport.path_table[dst_hash][7], "lr_cost": lr_cost, "interface": str(RNS.Transport.path_table[dst_hash][5]), - "interface_hash": RNS.Transport.path_table[dst_hash][5].get_hash() } + "interface_hash": RNS.Transport.path_table[dst_hash][5].get_hash(), + "state": RNS.Transport.get_path_state(dst_hash) } path_table.append(entry) return path_table diff --git a/RNS/Transport.py b/RNS/Transport.py index 22febf1c..6573ca05 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -3863,6 +3863,10 @@ class Transport: return False + @staticmethod + def get_path_state(destination_hash): + return Transport.path_states.get(destination_hash, Transport.STATE_UNKNOWN) + @staticmethod def await_path(destination_hash, timeout=None, on_interface=None): """ diff --git a/RNS/Utilities/rnpath.py b/RNS/Utilities/rnpath.py index 4406a6b9..83d007a0 100644 --- a/RNS/Utilities/rnpath.py +++ b/RNS/Utilities/rnpath.py @@ -300,6 +300,11 @@ def program_setup(configdir, table, rates, drop, destination_hexhash, verbosity, if not path["value"]: continue if path["value"] < min_value: continue + if path["state"] == RNS.Transport.STATE_RESPONSIVE: state_str = " (R)" + elif path["state"] == RNS.Transport.STATE_UNRESPONSIVE: state_str = " (u)" + elif path["state"] == RNS.Transport.STATE_UNKNOWN: state_str = " (?)" + else: state_str = " (?)" + exp_str = RNS.timestamp_str(path["expires"]) if path["hops"] == 1: m_str = " " else: m_str = "s" @@ -310,7 +315,7 @@ def program_setup(configdir, table, rates, drop, destination_hexhash, verbosity, else: u_str = "" via_str = f" via {RNS.prettyhexrep(path['via'])}" if vias else "" exp_str = f" expires in {RNS.prettytime(path['expires']-now, compact=True)}" if expinfo else "" - print(f"{RNS.prettyhexrep(path['hash'])} {path['hops']:>3}h{via_str} on {path['interface']}{exp_str} (dv:{RNS.prettycost(path['value'])}/lc:{RNS.prettycost(path['lr_cost'])}){u_str}") + print(f"{RNS.prettyhexrep(path['hash'])} {path['hops']:>3}h{state_str}{via_str} on {path['interface']}{exp_str} (dv:{RNS.prettycost(path['value'])}/lc:{RNS.prettycost(path['lr_cost'])}){u_str}") if destination_hash != None and displayed == 0: print("No path known")