mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-05-21 15:24:49 -07:00
Cleanup
This commit is contained in:
@@ -24,7 +24,7 @@ APP_NAME = "rnstransport"
|
|||||||
|
|
||||||
class InterfaceAnnouncer():
|
class InterfaceAnnouncer():
|
||||||
JOB_INTERVAL = 60
|
JOB_INTERVAL = 60
|
||||||
DEFAULT_STAMP_VALUE = 20
|
DEFAULT_STAMP_VALUE = 14
|
||||||
WORKBLOCK_EXPAND_ROUNDS = 20
|
WORKBLOCK_EXPAND_ROUNDS = 20
|
||||||
|
|
||||||
DISCOVERABLE_INTERFACE_TYPES = ["BackboneInterface", "TCPServerInterface", "TCPClientInterface", "RNodeInterface", "I2PInterface", "KISSInterface"]
|
DISCOVERABLE_INTERFACE_TYPES = ["BackboneInterface", "TCPServerInterface", "TCPClientInterface", "RNodeInterface", "I2PInterface", "KISSInterface"]
|
||||||
@@ -125,7 +125,7 @@ class InterfaceAnnouncer():
|
|||||||
if not stamp: return None
|
if not stamp: return None
|
||||||
else:
|
else:
|
||||||
self.stamp_cache[infohash] = stamp
|
self.stamp_cache[infohash] = stamp
|
||||||
return packed+stamp
|
return bytes([0x00])+packed+stamp
|
||||||
|
|
||||||
class InterfaceAnnounceHandler:
|
class InterfaceAnnounceHandler:
|
||||||
def __init__(self, required_value=InterfaceAnnouncer.DEFAULT_STAMP_VALUE, callback=None):
|
def __init__(self, required_value=InterfaceAnnouncer.DEFAULT_STAMP_VALUE, callback=None):
|
||||||
@@ -143,7 +143,8 @@ class InterfaceAnnounceHandler:
|
|||||||
|
|
||||||
def received_announce(self, destination_hash, announced_identity, app_data):
|
def received_announce(self, destination_hash, announced_identity, app_data):
|
||||||
try:
|
try:
|
||||||
if app_data and len(app_data) > self.stamper.STAMP_SIZE:
|
if app_data and len(app_data) > self.stamper.STAMP_SIZE+1:
|
||||||
|
app_data = app_data[1:]
|
||||||
stamp = app_data[-self.stamper.STAMP_SIZE:]
|
stamp = app_data[-self.stamper.STAMP_SIZE:]
|
||||||
packed = app_data[:-self.stamper.STAMP_SIZE]
|
packed = app_data[:-self.stamper.STAMP_SIZE]
|
||||||
infohash = RNS.Identity.full_hash(packed)
|
infohash = RNS.Identity.full_hash(packed)
|
||||||
@@ -308,8 +309,7 @@ class InterfaceDiscovery():
|
|||||||
hops = info["hops"]; ms = "" if hops == 1 else "s"
|
hops = info["hops"]; ms = "" if hops == 1 else "s"
|
||||||
filename = RNS.hexrep(discovery_hash, delimit=False)
|
filename = RNS.hexrep(discovery_hash, delimit=False)
|
||||||
filepath = os.path.join(self.storagepath, filename)
|
filepath = os.path.join(self.storagepath, filename)
|
||||||
RNS.log(f"Discovered interface {RNS.prettyhexrep(discovery_hash)} {hops} hop{ms} away: {name}")
|
RNS.log(f"Discovered interface {RNS.prettyhexrep(discovery_hash)} {hops} hop{ms} away: {name}", RNS.LOG_DEBUG)
|
||||||
print(info["config_entry"])
|
|
||||||
if not os.path.isfile(filepath):
|
if not os.path.isfile(filepath):
|
||||||
try:
|
try:
|
||||||
with open(filepath, "wb") as f:
|
with open(filepath, "wb") as f:
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ instance_name = default
|
|||||||
# can configure the minimum required value to accept as
|
# can configure the minimum required value to accept as
|
||||||
# valid for discovered interfaces.
|
# valid for discovered interfaces.
|
||||||
|
|
||||||
# required_discovery_value = 20
|
# required_discovery_value = 14
|
||||||
|
|
||||||
|
|
||||||
# You can configure Reticulum to panic and forcibly close
|
# You can configure Reticulum to panic and forcibly close
|
||||||
|
|||||||
@@ -225,14 +225,14 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
|||||||
print(f"Last Heard : {last_heard_display}")
|
print(f"Last Heard : {last_heard_display}")
|
||||||
print(f"Location : {location}")
|
print(f"Location : {location}")
|
||||||
|
|
||||||
if "frequency" in i: print(f"Frequency : {i["frequency"]:,} Hz")
|
if "frequency" in i: print(f"Frequency : {i['frequency']:,} Hz")
|
||||||
if "bandwidth" in i: print(f"Bandwidth : {i["bandwidth"]:,} Hz")
|
if "bandwidth" in i: print(f"Bandwidth : {i['bandwidth']:,} Hz")
|
||||||
if "sf" in i: print(f"Sprd.Factor : {i["sf"]}")
|
if "sf" in i: print(f"Sprd.Factor : {i['sf']}")
|
||||||
if "cr" in i: print(f"Coding Rate : {i["cr"]}")
|
if "cr" in i: print(f"Coding Rate : {i['cr']}")
|
||||||
if "modulation" in i: print(f"Modulation : {i["modulation"]}")
|
if "modulation" in i: print(f"Modulation : {i['modulation']}")
|
||||||
if "reachable_on" in i: print(f"Address : {i["reachable_on"]}:{i["port"]}")
|
if "reachable_on" in i: print(f"Address : {i['reachable_on']}:{i['port']}")
|
||||||
|
|
||||||
print(f"Stamp Value : {i["value"]}")
|
print(f"Stamp Value : {i['value']}")
|
||||||
|
|
||||||
print(f"\nConfiguration Entry:")
|
print(f"\nConfiguration Entry:")
|
||||||
config_lines = i["config_entry"].split('\n')
|
config_lines = i["config_entry"].split('\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user