diff --git a/RNS/Discovery.py b/RNS/Discovery.py index 2515a8e..2dc4eef 100644 --- a/RNS/Discovery.py +++ b/RNS/Discovery.py @@ -24,7 +24,7 @@ APP_NAME = "rnstransport" class InterfaceAnnouncer(): JOB_INTERVAL = 60 - DEFAULT_STAMP_VALUE = 20 + DEFAULT_STAMP_VALUE = 14 WORKBLOCK_EXPAND_ROUNDS = 20 DISCOVERABLE_INTERFACE_TYPES = ["BackboneInterface", "TCPServerInterface", "TCPClientInterface", "RNodeInterface", "I2PInterface", "KISSInterface"] @@ -125,7 +125,7 @@ class InterfaceAnnouncer(): if not stamp: return None else: self.stamp_cache[infohash] = stamp - return packed+stamp + return bytes([0x00])+packed+stamp class InterfaceAnnounceHandler: 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): 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:] packed = app_data[:-self.stamper.STAMP_SIZE] infohash = RNS.Identity.full_hash(packed) @@ -308,8 +309,7 @@ class InterfaceDiscovery(): hops = info["hops"]; ms = "" if hops == 1 else "s" filename = RNS.hexrep(discovery_hash, delimit=False) filepath = os.path.join(self.storagepath, filename) - RNS.log(f"Discovered interface {RNS.prettyhexrep(discovery_hash)} {hops} hop{ms} away: {name}") - print(info["config_entry"]) + RNS.log(f"Discovered interface {RNS.prettyhexrep(discovery_hash)} {hops} hop{ms} away: {name}", RNS.LOG_DEBUG) if not os.path.isfile(filepath): try: with open(filepath, "wb") as f: diff --git a/RNS/Utilities/rnsd.py b/RNS/Utilities/rnsd.py index b85513d..09f1af2 100755 --- a/RNS/Utilities/rnsd.py +++ b/RNS/Utilities/rnsd.py @@ -173,7 +173,7 @@ instance_name = default # can configure the minimum required value to accept as # valid for discovered interfaces. -# required_discovery_value = 20 +# required_discovery_value = 14 # You can configure Reticulum to panic and forcibly close diff --git a/RNS/Utilities/rnstatus.py b/RNS/Utilities/rnstatus.py index 96ee506..d5e79e8 100644 --- a/RNS/Utilities/rnstatus.py +++ b/RNS/Utilities/rnstatus.py @@ -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"Location : {location}") - if "frequency" in i: print(f"Frequency : {i["frequency"]:,} Hz") - if "bandwidth" in i: print(f"Bandwidth : {i["bandwidth"]:,} Hz") - if "sf" in i: print(f"Sprd.Factor : {i["sf"]}") - if "cr" in i: print(f"Coding Rate : {i["cr"]}") - if "modulation" in i: print(f"Modulation : {i["modulation"]}") - if "reachable_on" in i: print(f"Address : {i["reachable_on"]}:{i["port"]}") + if "frequency" in i: print(f"Frequency : {i['frequency']:,} Hz") + if "bandwidth" in i: print(f"Bandwidth : {i['bandwidth']:,} Hz") + if "sf" in i: print(f"Sprd.Factor : {i['sf']}") + if "cr" in i: print(f"Coding Rate : {i['cr']}") + if "modulation" in i: print(f"Modulation : {i['modulation']}") + 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:") config_lines = i["config_entry"].split('\n')