Added rnpath utility

This commit is contained in:
Mark Qvist 2021-09-24 12:42:24 +02:00
parent 8436bc5ba3
commit dc36644a1e
2 changed files with 109 additions and 0 deletions

View file

@ -1276,6 +1276,28 @@ class Transport:
else:
return Transport.PATHFINDER_M
@staticmethod
def next_hop(destination_hash):
"""
:param destination_hash: A destination hash as *bytes*.
:returns: The destination hash as *bytes* for the next hop to the specified destination, or *None* if the next hop is unknown.
"""
if destination_hash in Transport.destination_table:
return Transport.destination_table[destination_hash][1]
else:
return None
@staticmethod
def next_hop_interface(destination_hash):
"""
:param destination_hash: A destination hash as *bytes*.
:returns: The interface for the next hop to the specified destination, or *None* if the interface is unknown.
"""
if destination_hash in Transport.destination_table:
return Transport.destination_table[destination_hash][5]
else:
return None
@staticmethod
def request_path(destination_hash):
"""