mirror of
https://github.com/Quad4-Software/Reticulum-Go
synced 2026-08-29 23:48:44 -04:00
25 lines
800 B
Python
25 lines
800 B
Python
# Classic RNS example pattern copied from upstream tutorials.
|
|
import time
|
|
import RNS
|
|
|
|
def official_example_spin(destination_hash):
|
|
if not RNS.Transport.has_path(destination_hash):
|
|
RNS.Transport.request_path(destination_hash)
|
|
while not RNS.Transport.has_path(destination_hash):
|
|
time.sleep(0.1)
|
|
|
|
def await_in_retry(destination_hash):
|
|
while True:
|
|
RNS.Transport.await_path(destination_hash, timeout=5)
|
|
|
|
def link_status_spin(link):
|
|
while link.status != RNS.Link.ACTIVE:
|
|
time.sleep(0.2)
|
|
|
|
def recall_too_early(destination_hash):
|
|
identity = RNS.Identity.recall(destination_hash)
|
|
RNS.Transport.await_path(destination_hash)
|
|
return identity
|
|
|
|
def shared_client():
|
|
reticulum = RNS.Reticulum(configdir="/tmp/x", require_shared_instance=True)
|