mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-02 22:54:54 -04:00
Added announce rate information to rnpath utility, added exit codes and improved table lookup.
This commit is contained in:
parent
e825b0b8ff
commit
d66c31b4e9
2 changed files with 170 additions and 10 deletions
|
@ -883,6 +883,9 @@ class Reticulum:
|
|||
if path == "path_table":
|
||||
rpc_connection.send(self.get_path_table())
|
||||
|
||||
if path == "rate_table":
|
||||
rpc_connection.send(self.get_rate_table())
|
||||
|
||||
if path == "next_hop_if_name":
|
||||
rpc_connection.send(self.get_next_hop_if_name(call["destination_hash"]))
|
||||
|
||||
|
@ -995,6 +998,27 @@ class Reticulum:
|
|||
|
||||
return path_table
|
||||
|
||||
def get_rate_table(self):
|
||||
if self.is_connected_to_shared_instance:
|
||||
rpc_connection = multiprocessing.connection.Client(self.rpc_addr, authkey=self.rpc_key)
|
||||
rpc_connection.send({"get": "rate_table"})
|
||||
response = rpc_connection.recv()
|
||||
return response
|
||||
|
||||
else:
|
||||
rate_table = []
|
||||
for dst_hash in RNS.Transport.announce_rate_table:
|
||||
entry = {
|
||||
"hash": dst_hash,
|
||||
"last": RNS.Transport.announce_rate_table[dst_hash]["last"],
|
||||
"rate_violations": RNS.Transport.announce_rate_table[dst_hash]["rate_violations"],
|
||||
"blocked_until": RNS.Transport.announce_rate_table[dst_hash]["blocked_until"],
|
||||
"timestamps": RNS.Transport.announce_rate_table[dst_hash]["timestamps"],
|
||||
}
|
||||
rate_table.append(entry)
|
||||
|
||||
return rate_table
|
||||
|
||||
def drop_path(self, destination):
|
||||
if self.is_connected_to_shared_instance:
|
||||
rpc_connection = multiprocessing.connection.Client(self.rpc_addr, authkey=self.rpc_key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue