rns 1.2.4__tar.gz → 1.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rns-1.2.4/rns.egg-info → rns-1.2.6}/PKG-INFO +1 -1
- {rns-1.2.4 → rns-1.2.6}/RNS/Discovery.py +47 -36
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/AutoInterface.py +5 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/BackboneInterface.py +81 -12
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/I2PInterface.py +11 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/Interface.py +115 -29
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/LocalInterface.py +6 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/RNodeMultiInterface.py +6 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/TCPInterface.py +11 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Packet.py +2 -1
- {rns-1.2.4 → rns-1.2.6}/RNS/Reticulum.py +122 -15
- {rns-1.2.4 → rns-1.2.6}/RNS/Transport.py +123 -61
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/client.py +6 -6
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/highlight.py +5 -4
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/pages.py +156 -55
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/server.py +194 -96
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/util.py +51 -4
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnid.py +269 -28
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnpath.py +2 -1
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnstatus.py +122 -53
- {rns-1.2.4 → rns-1.2.6}/RNS/__init__.py +95 -114
- rns-1.2.6/RNS/_version.py +1 -0
- {rns-1.2.4 → rns-1.2.6/rns.egg-info}/PKG-INFO +1 -1
- rns-1.2.4/RNS/_version.py +0 -1
- {rns-1.2.4 → rns-1.2.6}/CRNS/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/README.md +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Buffer.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Channel.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/AES.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/Ed25519.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/HKDF.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/HMAC.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/Hashes.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/PKCS7.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/Provider.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/Proxies.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/SHA256.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/SHA512.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/Token.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/X25519.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/aes/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/aes/aes128.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/aes/aes256.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/pure25519/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/pure25519/_ed25519.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/pure25519/basic.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/pure25519/ed25519_oop.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Cryptography/pure25519/eddsa.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Destination.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Identity.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/AX25KISSInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/Android/KISSInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/Android/RNodeInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/Android/SerialInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/Android/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/KISSInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/PipeInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/RNodeInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/SerialInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/UDPInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/WeaveInterface.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/util/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Interfaces/util/netinfo.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Link.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Resolver.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Resource.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rncp.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rngit/main.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnir.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnodeconf.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnpkg.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnprobe.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsd.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/_version.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/args.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/exception.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/helpers.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/initiator.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/listener.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/loop.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/process.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/protocol.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/retry.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/rnsh.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnsh/session.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/Utilities/rnx.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/configobj.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/__init__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/__version__.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/aiosam.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/exceptions.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/log.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/sam.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/tunnel.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/i2plib/utils.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/platformutils.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/RNS/vendor/umsgpack.py +0 -0
- {rns-1.2.4 → rns-1.2.6}/rns.egg-info/SOURCES.txt +0 -0
- {rns-1.2.4 → rns-1.2.6}/rns.egg-info/dependency_links.txt +0 -0
- {rns-1.2.4 → rns-1.2.6}/rns.egg-info/entry_points.txt +0 -0
- {rns-1.2.4 → rns-1.2.6}/rns.egg-info/requires.txt +0 -0
- {rns-1.2.4 → rns-1.2.6}/rns.egg-info/top_level.txt +0 -0
- {rns-1.2.4 → rns-1.2.6}/setup.cfg +0 -0
- {rns-1.2.4 → rns-1.2.6}/setup.py +0 -0
|
@@ -6,6 +6,7 @@ import random
|
|
|
6
6
|
import threading
|
|
7
7
|
import ipaddress
|
|
8
8
|
import subprocess
|
|
9
|
+
from threading import Lock
|
|
9
10
|
from .vendor import umsgpack as msgpack
|
|
10
11
|
|
|
11
12
|
NAME = 0xFF
|
|
@@ -86,6 +87,7 @@ class InterfaceAnnouncer():
|
|
|
86
87
|
RNS.trace_exception(e)
|
|
87
88
|
|
|
88
89
|
def sanitize(self, in_str):
|
|
90
|
+
if in_str == None: return None
|
|
89
91
|
sanitized = in_str.replace("\n", "")
|
|
90
92
|
sanitized = sanitized.replace("\r", "")
|
|
91
93
|
sanitized = sanitized.strip()
|
|
@@ -374,6 +376,8 @@ class InterfaceDiscovery():
|
|
|
374
376
|
AUTOCONNECT_TYPES = ["BackboneInterface", "TCPServerInterface"]
|
|
375
377
|
DISCOVERABLE_TYPES = ["BackboneInterface", "TCPServerInterface", "I2PInterface", "RNodeInterface", "WeaveInterface", "KISSInterface"]
|
|
376
378
|
|
|
379
|
+
discovery_lock = Lock()
|
|
380
|
+
|
|
377
381
|
def __init__(self, required_value=InterfaceAnnouncer.DEFAULT_STAMP_VALUE, callback=None, discover_interfaces=True):
|
|
378
382
|
if not required_value: required_value = InterfaceAnnouncer.DEFAULT_STAMP_VALUE
|
|
379
383
|
|
|
@@ -401,8 +405,10 @@ class InterfaceDiscovery():
|
|
|
401
405
|
discovery_sources = RNS.Reticulum.interface_discovery_sources()
|
|
402
406
|
for filename in os.listdir(self.storagepath):
|
|
403
407
|
try:
|
|
404
|
-
|
|
405
|
-
|
|
408
|
+
with self.discovery_lock:
|
|
409
|
+
filepath = os.path.join(self.storagepath, filename)
|
|
410
|
+
with open(filepath, "rb") as f: info = msgpack.unpackb(f.read())
|
|
411
|
+
|
|
406
412
|
should_remove = False
|
|
407
413
|
heard_delta = now-info["last_heard"]
|
|
408
414
|
info["name"] = InterfaceAnnounceHandler.sanitize_name(info["name"])
|
|
@@ -434,8 +440,8 @@ class InterfaceDiscovery():
|
|
|
434
440
|
if should_append: discovered_interfaces.append(info)
|
|
435
441
|
|
|
436
442
|
except Exception as e:
|
|
437
|
-
RNS.log(f"Error while loading discovered interface data: {e}", RNS.
|
|
438
|
-
RNS.log(f"The interface data file {os.path.join(self.storagepath, filename)} may be corrupt", RNS.
|
|
443
|
+
RNS.log(f"Error while loading discovered interface data: {e}", RNS.LOG_WARNING)
|
|
444
|
+
RNS.log(f"The interface data file {os.path.join(self.storagepath, filename)} may be corrupt", RNS.LOG_WARNING)
|
|
439
445
|
RNS.trace_exception(e)
|
|
440
446
|
|
|
441
447
|
discovered_interfaces.sort(key=lambda info: (info["status_code"], info["value"], info["last_heard"]), reverse=True)
|
|
@@ -453,41 +459,45 @@ class InterfaceDiscovery():
|
|
|
453
459
|
filename = RNS.hexrep(discovery_hash, delimit=False)
|
|
454
460
|
filepath = os.path.join(self.storagepath, filename)
|
|
455
461
|
RNS.log(f"Discovered {interface_type} {hops} hop{ms} away with stamp value {value}: {name}", RNS.LOG_DEBUG)
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
462
|
+
with self.discovery_lock:
|
|
463
|
+
if not os.path.isfile(filepath):
|
|
464
|
+
try:
|
|
465
|
+
with open(filepath, "wb") as f:
|
|
466
|
+
info["discovered"] = info["received"]
|
|
467
|
+
info["last_heard"] = info["received"]
|
|
468
|
+
info["heard_count"] = 0
|
|
469
|
+
f.write(msgpack.packb(info))
|
|
470
|
+
|
|
471
|
+
except Exception as e:
|
|
472
|
+
RNS.log(f"Error while persisting discovered interface data: {e}", RNS.LOG_ERROR)
|
|
473
|
+
RNS.trace_exception(e)
|
|
474
|
+
return
|
|
468
475
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
476
|
+
else:
|
|
477
|
+
discovered = None
|
|
478
|
+
heard_count = None
|
|
479
|
+
try:
|
|
480
|
+
try:
|
|
481
|
+
with open(filepath, "rb") as f:
|
|
482
|
+
last_info = msgpack.unpackb(f.read())
|
|
483
|
+
discovered = last_info["discovered"]
|
|
484
|
+
heard_count = last_info["heard_count"]
|
|
477
485
|
|
|
478
|
-
|
|
479
|
-
if heard_count == None: heard_count = 0
|
|
486
|
+
except Exception as e: RNS.log(f"Error while reading existing data for discovered interface, re-creating data", RNS.LOG_ERROR)
|
|
480
487
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
info["last_heard"] = info["received"]
|
|
484
|
-
info["heard_count"] = heard_count+1
|
|
485
|
-
f.write(msgpack.packb(info))
|
|
488
|
+
if discovered == None: discovered = info["received"]
|
|
489
|
+
if heard_count == None: heard_count = 0
|
|
486
490
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
+
with open(filepath, "wb") as f:
|
|
492
|
+
info["discovered"] = discovered
|
|
493
|
+
info["last_heard"] = info["received"]
|
|
494
|
+
info["heard_count"] = heard_count+1
|
|
495
|
+
f.write(msgpack.packb(info))
|
|
496
|
+
|
|
497
|
+
except Exception as e:
|
|
498
|
+
RNS.log(f"Error while persisting discovered interface data: {e}", RNS.LOG_ERROR)
|
|
499
|
+
RNS.trace_exception(e)
|
|
500
|
+
return
|
|
491
501
|
|
|
492
502
|
except Exception as e:
|
|
493
503
|
RNS.log(f"Error processing discovered interface data: {e}", RNS.LOG_ERROR)
|
|
@@ -658,10 +668,11 @@ class InterfaceDiscovery():
|
|
|
658
668
|
RNS.log(f"Auto-connecting discovered {interface_type} {interface_name}")
|
|
659
669
|
interface.autoconnect_hash = endpoint_hash
|
|
660
670
|
interface.autoconnect_source = info["network_id"]
|
|
671
|
+
mode = RNS.Interfaces.Interface.Interface.MODE_GATEWAY if RNS.Reticulum.transport_enabled() else None
|
|
661
672
|
ar_target = RNS.Reticulum.get_instance()._default_ar_target() if RNS.Reticulum.transport_enabled() else None
|
|
662
673
|
ar_penalty = RNS.Reticulum.get_instance()._default_ar_penalty() if RNS.Reticulum.transport_enabled() else None
|
|
663
674
|
ar_grace = RNS.Reticulum.get_instance()._default_ar_grace() if RNS.Reticulum.transport_enabled() else None
|
|
664
|
-
RNS.Reticulum.get_instance()._add_interface(interface, ifac_netname=ifac_netname, ifac_netkey=ifac_netkey, configured_bitrate=5E6,
|
|
675
|
+
RNS.Reticulum.get_instance()._add_interface(interface, mode=mode, ifac_netname=ifac_netname, ifac_netkey=ifac_netkey, configured_bitrate=5E6,
|
|
665
676
|
announce_rate_target=ar_target, announce_rate_grace=ar_grace, announce_rate_penalty=ar_penalty)
|
|
666
677
|
self.monitor_interface(interface)
|
|
667
678
|
|
|
@@ -539,6 +539,11 @@ class AutoInterface(Interface):
|
|
|
539
539
|
spawned_interface.ic_new_time = self.ic_new_time
|
|
540
540
|
spawned_interface.ic_burst_penalty = self.ic_burst_penalty
|
|
541
541
|
spawned_interface.ic_held_release_interval = self.ic_held_release_interval
|
|
542
|
+
|
|
543
|
+
spawned_interface.egress_control = self.egress_control
|
|
544
|
+
spawned_interface.ec_pr_freq = self.ec_pr_freq
|
|
545
|
+
spawned_interface.ic_pr_burst_freq_new = self.ic_pr_burst_freq_new
|
|
546
|
+
spawned_interface.ic_pr_burst_freq = self.ic_pr_burst_freq
|
|
542
547
|
|
|
543
548
|
spawned_interface.parent_interface = self
|
|
544
549
|
spawned_interface.bitrate = self.bitrate
|
|
@@ -156,6 +156,58 @@ class BackboneInterface(Interface):
|
|
|
156
156
|
else:
|
|
157
157
|
raise SystemError("Insufficient parameters to create listener")
|
|
158
158
|
|
|
159
|
+
|
|
160
|
+
__last_ic_burst_check = 0
|
|
161
|
+
__last_ic_burst_state = False
|
|
162
|
+
@property
|
|
163
|
+
def ic_burst_active(self):
|
|
164
|
+
if time.time() > self.__last_ic_burst_check + 2:
|
|
165
|
+
self.__last_ic_burst_state = any(i.ic_burst_active for i in self.spawned_interfaces)
|
|
166
|
+
|
|
167
|
+
return self.__last_ic_burst_state
|
|
168
|
+
|
|
169
|
+
@ic_burst_active.setter
|
|
170
|
+
def ic_burst_active(self, value): pass
|
|
171
|
+
|
|
172
|
+
__ic_burst_activated_check = 0
|
|
173
|
+
__ic_burst_activated = 0
|
|
174
|
+
@property
|
|
175
|
+
def ic_burst_activated(self):
|
|
176
|
+
if time.time() > self.__ic_burst_activated_check + 2:
|
|
177
|
+
activated = [i.ic_burst_activated for i in self.spawned_interfaces if i.ic_burst_active]
|
|
178
|
+
if activated: self.__ic_burst_activated = min(activated)
|
|
179
|
+
|
|
180
|
+
return self.__ic_burst_activated
|
|
181
|
+
|
|
182
|
+
@ic_burst_activated.setter
|
|
183
|
+
def ic_burst_activated(self, value): pass
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
__last_ic_pr_burst_check = 0
|
|
187
|
+
__last_ic_pr_burst_state = False
|
|
188
|
+
@property
|
|
189
|
+
def ic_pr_burst_active(self):
|
|
190
|
+
if time.time() > self.__last_ic_pr_burst_check + 2:
|
|
191
|
+
self.__last_ic_pr_burst_state = any(i.ic_pr_burst_active for i in self.spawned_interfaces)
|
|
192
|
+
|
|
193
|
+
return self.__last_ic_pr_burst_state
|
|
194
|
+
|
|
195
|
+
@ic_pr_burst_active.setter
|
|
196
|
+
def ic_pr_burst_active(self, value): pass
|
|
197
|
+
|
|
198
|
+
__ic_pr_burst_activated_check = 0
|
|
199
|
+
__ic_pr_burst_activated = 0
|
|
200
|
+
@property
|
|
201
|
+
def ic_pr_burst_activated(self):
|
|
202
|
+
if time.time() > self.__ic_pr_burst_activated_check + 2:
|
|
203
|
+
activated = [i.ic_pr_burst_activated for i in self.spawned_interfaces if i.ic_pr_burst_active]
|
|
204
|
+
if activated: self.__ic_pr_burst_activated = min(activated)
|
|
205
|
+
|
|
206
|
+
return self.__ic_pr_burst_activated
|
|
207
|
+
|
|
208
|
+
@ic_pr_burst_activated.setter
|
|
209
|
+
def ic_pr_burst_activated(self, value): pass
|
|
210
|
+
|
|
159
211
|
@staticmethod
|
|
160
212
|
def start():
|
|
161
213
|
if not BackboneInterface._job_active: threading.Thread(target=BackboneInterface.__job, daemon=True).start()
|
|
@@ -196,17 +248,17 @@ class BackboneInterface(Interface):
|
|
|
196
248
|
@staticmethod
|
|
197
249
|
def register_in(fileno):
|
|
198
250
|
if fileno < 0:
|
|
199
|
-
RNS.log(f"Attempt to register invalid file descriptor {fileno}", RNS.
|
|
251
|
+
RNS.log(f"Attempt to register invalid file descriptor {fileno}", RNS.LOG_WARNING)
|
|
200
252
|
return
|
|
201
253
|
|
|
202
254
|
try: BackboneInterface.epoll.register(fileno, select.EPOLLIN)
|
|
203
255
|
except Exception as e:
|
|
204
|
-
RNS.log(f"An error occurred while registering EPOLL_IN for file descriptor {fileno}: {e}", RNS.
|
|
256
|
+
RNS.log(f"An error occurred while registering EPOLL_IN for file descriptor {fileno}: {e}", RNS.LOG_WARNING)
|
|
205
257
|
|
|
206
258
|
@staticmethod
|
|
207
259
|
def deregister_fileno(fileno):
|
|
208
260
|
if fileno < 0:
|
|
209
|
-
RNS.log(f"Attempt to deregister invalid file descriptor {fileno}", RNS.
|
|
261
|
+
RNS.log(f"Attempt to deregister invalid file descriptor {fileno}", RNS.LOG_WARNING)
|
|
210
262
|
return
|
|
211
263
|
|
|
212
264
|
try: BackboneInterface.epoll.unregister(fileno)
|
|
@@ -288,7 +340,7 @@ class BackboneInterface(Interface):
|
|
|
288
340
|
except Exception as e: RNS.log(f"Error while removing spawned interface from {pif}: {e}", RNS.LOG_ERROR)
|
|
289
341
|
|
|
290
342
|
try: client_socket.close()
|
|
291
|
-
except Exception as e: RNS.log(f"Error while closing socket for {spawned_interface}: {e}", RNS.
|
|
343
|
+
except Exception as e: RNS.log(f"Error while closing socket for {spawned_interface}: {e}", RNS.LOG_WARNING)
|
|
292
344
|
spawned_interface.receive(b"")
|
|
293
345
|
|
|
294
346
|
spawned_interface.transmit_buffer = spawned_interface.transmit_buffer[written:]
|
|
@@ -320,18 +372,24 @@ class BackboneInterface(Interface):
|
|
|
320
372
|
elif fileno in BackboneInterface.listener_filenos:
|
|
321
373
|
owner_interface, server_socket = BackboneInterface.listener_filenos[fileno]
|
|
322
374
|
if fileno == server_socket.fileno() and (event & select.EPOLLIN):
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
375
|
+
try:
|
|
376
|
+
client_socket, address = server_socket.accept()
|
|
377
|
+
client_socket.setblocking(0)
|
|
378
|
+
if not owner_interface.incoming_connection(client_socket):
|
|
379
|
+
try: client_socket.close()
|
|
380
|
+
except Exception as e: RNS.log(f"Error while closing socket for failed incoming connection: {e}", RNS.LOG_WARNING)
|
|
381
|
+
|
|
382
|
+
except:
|
|
383
|
+
RNS.log(f"Accepting socket failed for incoming connection: {e}", RNS.LOG_WARNING)
|
|
326
384
|
try: client_socket.close()
|
|
327
|
-
except Exception as e: RNS.log(f"Error while closing socket for failed incoming
|
|
385
|
+
except Exception as e: RNS.log(f"Error while closing socket for failed incoming socket accept: {e}", RNS.LOG_WARNING)
|
|
328
386
|
|
|
329
387
|
elif fileno == server_socket.fileno() and (event & select.EPOLLHUP):
|
|
330
388
|
try: BackboneInterface.deregister_fileno(fileno)
|
|
331
389
|
except Exception as e: RNS.log(f"Error while deregistering listener file descriptor {fileno}: {e}", RNS.LOG_ERROR)
|
|
332
390
|
|
|
333
391
|
try: server_socket.close()
|
|
334
|
-
except Exception as e: RNS.log(f"Error while closing listener socket for {server_socket}: {e}", RNS.
|
|
392
|
+
except Exception as e: RNS.log(f"Error while closing listener socket for {server_socket}: {e}", RNS.LOG_WARNING)
|
|
335
393
|
|
|
336
394
|
except Exception as e:
|
|
337
395
|
RNS.log(f"BackboneInterface error: {e}", RNS.LOG_ERROR)
|
|
@@ -356,6 +414,11 @@ class BackboneInterface(Interface):
|
|
|
356
414
|
spawned_interface.ic_new_time = self.ic_new_time
|
|
357
415
|
spawned_interface.ic_burst_penalty = self.ic_burst_penalty
|
|
358
416
|
spawned_interface.ic_held_release_interval = self.ic_held_release_interval
|
|
417
|
+
|
|
418
|
+
spawned_interface.egress_control = self.egress_control
|
|
419
|
+
spawned_interface.ec_pr_freq = self.ec_pr_freq
|
|
420
|
+
spawned_interface.ic_pr_burst_freq_new = self.ic_pr_burst_freq_new
|
|
421
|
+
spawned_interface.ic_pr_burst_freq = self.ic_pr_burst_freq
|
|
359
422
|
|
|
360
423
|
spawned_interface.socket = socket
|
|
361
424
|
spawned_interface.target_ip = socket.getpeername()[0]
|
|
@@ -408,6 +471,12 @@ class BackboneInterface(Interface):
|
|
|
408
471
|
def sent_announce(self, from_spawned=False):
|
|
409
472
|
if from_spawned: self.oa_freq_deque.append(time.time())
|
|
410
473
|
|
|
474
|
+
def received_path_request(self, from_spawned=False):
|
|
475
|
+
if from_spawned: self.ip_freq_deque.append(time.time())
|
|
476
|
+
|
|
477
|
+
def sent_path_request(self, from_spawned=False):
|
|
478
|
+
if from_spawned: self.op_freq_deque.append(time.time())
|
|
479
|
+
|
|
411
480
|
def process_outgoing(self, data):
|
|
412
481
|
pass
|
|
413
482
|
|
|
@@ -578,8 +647,8 @@ class BackboneClientInterface(Interface):
|
|
|
578
647
|
|
|
579
648
|
except Exception as e:
|
|
580
649
|
if initial:
|
|
581
|
-
RNS.log("Initial connection for "+str(self)+" could not be established: "+str(e), RNS.
|
|
582
|
-
RNS.log("Leaving unconnected and retrying connection in "+str(BackboneClientInterface.RECONNECT_WAIT)+" seconds.", RNS.
|
|
650
|
+
RNS.log("Initial connection for "+str(self)+" could not be established: "+str(e), RNS.LOG_WARNING)
|
|
651
|
+
RNS.log("Leaving unconnected and retrying connection in "+str(BackboneClientInterface.RECONNECT_WAIT)+" seconds.", RNS.LOG_WARNING)
|
|
583
652
|
return False
|
|
584
653
|
|
|
585
654
|
else:
|
|
@@ -602,7 +671,7 @@ class BackboneClientInterface(Interface):
|
|
|
602
671
|
attempts += 1
|
|
603
672
|
|
|
604
673
|
if self.max_reconnect_tries != None and attempts > self.max_reconnect_tries:
|
|
605
|
-
RNS.log("Max reconnection attempts reached for "+str(self), RNS.
|
|
674
|
+
RNS.log("Max reconnection attempts reached for "+str(self), RNS.LOG_WARNING)
|
|
606
675
|
self.teardown()
|
|
607
676
|
break
|
|
608
677
|
|
|
@@ -957,6 +957,11 @@ class I2PInterface(Interface):
|
|
|
957
957
|
spawned_interface.ic_new_time = self.ic_new_time
|
|
958
958
|
spawned_interface.ic_burst_penalty = self.ic_burst_penalty
|
|
959
959
|
spawned_interface.ic_held_release_interval = self.ic_held_release_interval
|
|
960
|
+
|
|
961
|
+
spawned_interface.egress_control = self.egress_control
|
|
962
|
+
spawned_interface.ec_pr_freq = self.ec_pr_freq
|
|
963
|
+
spawned_interface.ic_pr_burst_freq_new = self.ic_pr_burst_freq_new
|
|
964
|
+
spawned_interface.ic_pr_burst_freq = self.ic_pr_burst_freq
|
|
960
965
|
|
|
961
966
|
spawned_interface.parent_interface = self
|
|
962
967
|
spawned_interface.online = True
|
|
@@ -1003,6 +1008,12 @@ class I2PInterface(Interface):
|
|
|
1003
1008
|
def sent_announce(self, from_spawned=False):
|
|
1004
1009
|
if from_spawned: self.oa_freq_deque.append(time.time())
|
|
1005
1010
|
|
|
1011
|
+
def received_path_request(self, from_spawned=False):
|
|
1012
|
+
if from_spawned: self.ip_freq_deque.append(time.time())
|
|
1013
|
+
|
|
1014
|
+
def sent_path_request(self, from_spawned=False):
|
|
1015
|
+
if from_spawned: self.op_freq_deque.append(time.time())
|
|
1016
|
+
|
|
1006
1017
|
def detach(self):
|
|
1007
1018
|
RNS.log("Detaching "+str(self), RNS.LOG_DEBUG)
|
|
1008
1019
|
self.i2p.stop()
|
|
@@ -55,8 +55,15 @@ class Interface:
|
|
|
55
55
|
|
|
56
56
|
# How many samples to use for announce
|
|
57
57
|
# frequency calculations
|
|
58
|
-
IA_FREQ_SAMPLES =
|
|
59
|
-
OA_FREQ_SAMPLES =
|
|
58
|
+
IA_FREQ_SAMPLES = 48
|
|
59
|
+
OA_FREQ_SAMPLES = 48
|
|
60
|
+
IP_FREQ_SAMPLES = 48
|
|
61
|
+
OP_FREQ_SAMPLES = 48
|
|
62
|
+
|
|
63
|
+
AR_MINFREQ_HZ = 0.1
|
|
64
|
+
PR_MINFREQ_HZ = 0.1
|
|
65
|
+
AR_FREQ_DECAY = 1/AR_MINFREQ_HZ
|
|
66
|
+
PR_FREQ_DECAY = 1/PR_MINFREQ_HZ
|
|
60
67
|
|
|
61
68
|
# Maximum amount of ingress limited announces
|
|
62
69
|
# to hold at any given time.
|
|
@@ -66,12 +73,17 @@ class Interface:
|
|
|
66
73
|
# considered to be newly created. Two
|
|
67
74
|
# hours by default.
|
|
68
75
|
IC_NEW_TIME = 2*60*60
|
|
69
|
-
IC_BURST_FREQ_NEW =
|
|
70
|
-
IC_BURST_FREQ =
|
|
71
|
-
|
|
76
|
+
IC_BURST_FREQ_NEW = 3
|
|
77
|
+
IC_BURST_FREQ = 10
|
|
78
|
+
IC_PR_BURST_FREQ_NEW = 3
|
|
79
|
+
IC_PR_BURST_FREQ = 8
|
|
80
|
+
IC_BURST_HOLD = 15
|
|
72
81
|
IC_BURST_PENALTY = 15
|
|
73
|
-
IC_HELD_RELEASE_INTERVAL =
|
|
74
|
-
IC_DEQUE_MIN_SAMPLE =
|
|
82
|
+
IC_HELD_RELEASE_INTERVAL = 5
|
|
83
|
+
IC_DEQUE_MIN_SAMPLE = 2
|
|
84
|
+
IC_BURST_MIN_SAMPLES = 6
|
|
85
|
+
EC_PR_FREQ = 5
|
|
86
|
+
EGRESS_CONTROL = False
|
|
75
87
|
|
|
76
88
|
# Default announce rate targets
|
|
77
89
|
DEFAULT_AR_TARGET = 3600
|
|
@@ -90,29 +102,38 @@ class Interface:
|
|
|
90
102
|
self.bitrate = 62500
|
|
91
103
|
self.HW_MTU = None
|
|
92
104
|
|
|
93
|
-
self.supports_discovery
|
|
94
|
-
self.discoverable
|
|
95
|
-
self.last_discovery_announce
|
|
96
|
-
self.bootstrap_only
|
|
97
|
-
self.parent_interface
|
|
98
|
-
self.spawned_interfaces
|
|
99
|
-
self.tunnel_id
|
|
100
|
-
self.ingress_control
|
|
101
|
-
self.phy_keepalive
|
|
102
|
-
|
|
103
|
-
self.
|
|
104
|
-
self.
|
|
105
|
-
self.
|
|
106
|
-
self.
|
|
107
|
-
self.
|
|
108
|
-
self.
|
|
109
|
-
self.
|
|
110
|
-
self.
|
|
111
|
-
self.
|
|
112
|
-
self.
|
|
105
|
+
self.supports_discovery = False
|
|
106
|
+
self.discoverable = False
|
|
107
|
+
self.last_discovery_announce = 0
|
|
108
|
+
self.bootstrap_only = False
|
|
109
|
+
self.parent_interface = None
|
|
110
|
+
self.spawned_interfaces = None
|
|
111
|
+
self.tunnel_id = None
|
|
112
|
+
self.ingress_control = True
|
|
113
|
+
self.phy_keepalive = False
|
|
114
|
+
|
|
115
|
+
self.ic_burst_active = False
|
|
116
|
+
self.ic_burst_activated = 0
|
|
117
|
+
self.ic_pr_burst_active = False
|
|
118
|
+
self.ic_pr_burst_activated = 0
|
|
119
|
+
self.ic_held_release = 0
|
|
120
|
+
self.ic_max_held_announces = RNS.Reticulum.get_instance()._default_ic_max_held_announces()
|
|
121
|
+
self.ic_burst_hold = RNS.Reticulum.get_instance()._default_ic_burst_hold()
|
|
122
|
+
self.ic_burst_freq_new = RNS.Reticulum.get_instance()._default_ic_burst_freq_new()
|
|
123
|
+
self.ic_burst_freq = RNS.Reticulum.get_instance()._default_ic_burst_freq()
|
|
124
|
+
self.ic_pr_burst_freq_new = RNS.Reticulum.get_instance()._default_ic_pr_burst_freq_new()
|
|
125
|
+
self.ic_pr_burst_freq = RNS.Reticulum.get_instance()._default_ic_pr_burst_freq()
|
|
126
|
+
self.ic_new_time = RNS.Reticulum.get_instance()._default_ic_new_time()
|
|
127
|
+
self.ic_burst_penalty = RNS.Reticulum.get_instance()._default_ic_burst_penalty()
|
|
128
|
+
self.ic_held_release_interval = RNS.Reticulum.get_instance()._default_ic_held_release_interval()
|
|
129
|
+
self.ec_pr_freq = RNS.Reticulum.get_instance()._default_ec_pr_freq()
|
|
130
|
+
self.egress_control = RNS.Reticulum.get_instance()._default_egress_control()
|
|
131
|
+
self.held_announces = {}
|
|
113
132
|
|
|
114
133
|
self.ia_freq_deque = deque(maxlen=Interface.IA_FREQ_SAMPLES)
|
|
115
134
|
self.oa_freq_deque = deque(maxlen=Interface.OA_FREQ_SAMPLES)
|
|
135
|
+
self.ip_freq_deque = deque(maxlen=Interface.IA_FREQ_SAMPLES)
|
|
136
|
+
self.op_freq_deque = deque(maxlen=Interface.OA_FREQ_SAMPLES)
|
|
116
137
|
|
|
117
138
|
def get_hash(self):
|
|
118
139
|
return RNS.Identity.full_hash(str(self).encode("utf-8"))
|
|
@@ -128,7 +149,7 @@ class Interface:
|
|
|
128
149
|
|
|
129
150
|
if self.ic_burst_active:
|
|
130
151
|
if ia_freq < freq_threshold and time.time() > self.ic_burst_activated+self.ic_burst_hold:
|
|
131
|
-
self.ic_burst_active = False
|
|
152
|
+
if len(self.ia_freq_deque) >= self.IC_BURST_MIN_SAMPLES: self.ic_burst_active = False
|
|
132
153
|
|
|
133
154
|
return True
|
|
134
155
|
|
|
@@ -143,6 +164,37 @@ class Interface:
|
|
|
143
164
|
|
|
144
165
|
else: return False
|
|
145
166
|
|
|
167
|
+
def should_ingress_limit_pr(self):
|
|
168
|
+
if self.ingress_control:
|
|
169
|
+
freq_threshold = self.ic_pr_burst_freq_new if self.age() < self.ic_new_time else self.ic_pr_burst_freq
|
|
170
|
+
ip_freq = self.incoming_pr_frequency()
|
|
171
|
+
|
|
172
|
+
if self.ic_pr_burst_active:
|
|
173
|
+
if ip_freq < freq_threshold and time.time() > self.ic_pr_burst_activated+self.ic_burst_hold:
|
|
174
|
+
self.ic_pr_burst_active = False
|
|
175
|
+
|
|
176
|
+
return True
|
|
177
|
+
|
|
178
|
+
else:
|
|
179
|
+
if ip_freq > freq_threshold:
|
|
180
|
+
self.ic_pr_burst_active = True
|
|
181
|
+
self.ic_pr_burst_activated = time.time()
|
|
182
|
+
return True
|
|
183
|
+
|
|
184
|
+
else: return False
|
|
185
|
+
|
|
186
|
+
else: return False
|
|
187
|
+
|
|
188
|
+
def should_egress_limit_pr(self):
|
|
189
|
+
if self.egress_control:
|
|
190
|
+
freq_threshold = self.ec_pr_freq
|
|
191
|
+
op_freq = self.outgoing_pr_frequency()
|
|
192
|
+
|
|
193
|
+
if op_freq > freq_threshold:
|
|
194
|
+
if len(self.op_freq_deque) >= self.IC_BURST_MIN_SAMPLES: return True
|
|
195
|
+
|
|
196
|
+
return False
|
|
197
|
+
|
|
146
198
|
def optimise_mtu(self):
|
|
147
199
|
if self.AUTOCONFIGURE_MTU:
|
|
148
200
|
if self.bitrate >= 1_000_000_000:
|
|
@@ -168,7 +220,7 @@ class Interface:
|
|
|
168
220
|
else:
|
|
169
221
|
self.HW_MTU = None
|
|
170
222
|
|
|
171
|
-
RNS.log(f"{self} hardware MTU set to {self.HW_MTU}", RNS.LOG_DEBUG)
|
|
223
|
+
RNS.log(f"{self} hardware MTU set to {self.HW_MTU}", RNS.LOG_DEBUG)
|
|
172
224
|
|
|
173
225
|
def age(self):
|
|
174
226
|
return time.time()-self.created
|
|
@@ -214,12 +266,23 @@ class Interface:
|
|
|
214
266
|
if hasattr(self, "parent_interface") and self.parent_interface != None:
|
|
215
267
|
self.parent_interface.sent_announce(from_spawned=True)
|
|
216
268
|
|
|
269
|
+
def received_path_request(self, from_spawned=False):
|
|
270
|
+
self.ip_freq_deque.append(time.time())
|
|
271
|
+
if hasattr(self, "parent_interface") and self.parent_interface != None:
|
|
272
|
+
self.parent_interface.received_path_request(from_spawned=True)
|
|
273
|
+
|
|
274
|
+
def sent_path_request(self, from_spawned=False):
|
|
275
|
+
self.op_freq_deque.append(time.time())
|
|
276
|
+
if hasattr(self, "parent_interface") and self.parent_interface != None:
|
|
277
|
+
self.parent_interface.sent_path_request(from_spawned=True)
|
|
278
|
+
|
|
217
279
|
def incoming_announce_frequency(self):
|
|
218
280
|
n = len(self.ia_freq_deque)
|
|
219
281
|
if not n > self.IC_DEQUE_MIN_SAMPLE: return 0
|
|
220
282
|
else:
|
|
221
283
|
oldest = self.ia_freq_deque[0]
|
|
222
284
|
span = time.time() - oldest
|
|
285
|
+
if span > self.AR_FREQ_DECAY: self.ia_freq_deque.popleft()
|
|
223
286
|
if span <= 0: return 0
|
|
224
287
|
hz = n / span
|
|
225
288
|
return hz
|
|
@@ -230,6 +293,29 @@ class Interface:
|
|
|
230
293
|
else:
|
|
231
294
|
oldest = self.oa_freq_deque[0]
|
|
232
295
|
span = time.time() - oldest
|
|
296
|
+
if span > self.AR_FREQ_DECAY: self.oa_freq_deque.popleft()
|
|
297
|
+
if span <= 0: return 0
|
|
298
|
+
hz = n / span
|
|
299
|
+
return hz
|
|
300
|
+
|
|
301
|
+
def incoming_pr_frequency(self):
|
|
302
|
+
n = len(self.ip_freq_deque)
|
|
303
|
+
if not n > self.IC_DEQUE_MIN_SAMPLE: return 0
|
|
304
|
+
else:
|
|
305
|
+
oldest = self.ip_freq_deque[0]
|
|
306
|
+
span = time.time() - oldest
|
|
307
|
+
if span > self.PR_FREQ_DECAY: self.ip_freq_deque.popleft()
|
|
308
|
+
if span <= 0: return 0
|
|
309
|
+
hz = n / span
|
|
310
|
+
return hz
|
|
311
|
+
|
|
312
|
+
def outgoing_pr_frequency(self):
|
|
313
|
+
n = len(self.op_freq_deque)
|
|
314
|
+
if not len(self.op_freq_deque) > 1: return 0
|
|
315
|
+
else:
|
|
316
|
+
oldest = self.op_freq_deque[0]
|
|
317
|
+
span = time.time() - oldest
|
|
318
|
+
if span > self.PR_FREQ_DECAY: self.op_freq_deque.popleft()
|
|
233
319
|
if span <= 0: return 0
|
|
234
320
|
hz = n / span
|
|
235
321
|
return hz
|
|
@@ -488,6 +488,12 @@ class LocalServerInterface(Interface):
|
|
|
488
488
|
def sent_announce(self, from_spawned=False):
|
|
489
489
|
if from_spawned: self.oa_freq_deque.append(time.time())
|
|
490
490
|
|
|
491
|
+
def received_path_request(self, from_spawned=False):
|
|
492
|
+
if from_spawned: self.ip_freq_deque.append(time.time())
|
|
493
|
+
|
|
494
|
+
def sent_path_request(self, from_spawned=False):
|
|
495
|
+
if from_spawned: self.op_freq_deque.append(time.time())
|
|
496
|
+
|
|
491
497
|
def __str__(self):
|
|
492
498
|
if self.socket_path: return "Shared Instance["+str(self.socket_path.replace("\0", ""))+"]"
|
|
493
499
|
else: return "Shared Instance["+str(self.bind_port)+"]"
|
|
@@ -549,6 +549,12 @@ class RNodeMultiInterface(Interface):
|
|
|
549
549
|
def sent_announce(self, from_spawned=False):
|
|
550
550
|
if from_spawned: self.oa_freq_deque.append(time.time())
|
|
551
551
|
|
|
552
|
+
def received_path_request(self, from_spawned=False):
|
|
553
|
+
if from_spawned: self.ip_freq_deque.append(time.time())
|
|
554
|
+
|
|
555
|
+
def sent_path_request(self, from_spawned=False):
|
|
556
|
+
if from_spawned: self.op_freq_deque.append(time.time())
|
|
557
|
+
|
|
552
558
|
def readLoop(self):
|
|
553
559
|
try:
|
|
554
560
|
in_frame = False
|
|
@@ -589,6 +589,11 @@ class TCPServerInterface(Interface):
|
|
|
589
589
|
spawned_interface.ic_burst_penalty = self.ic_burst_penalty
|
|
590
590
|
spawned_interface.ic_held_release_interval = self.ic_held_release_interval
|
|
591
591
|
|
|
592
|
+
spawned_interface.egress_control = self.egress_control
|
|
593
|
+
spawned_interface.ec_pr_freq = self.ec_pr_freq
|
|
594
|
+
spawned_interface.ic_pr_burst_freq_new = self.ic_pr_burst_freq_new
|
|
595
|
+
spawned_interface.ic_pr_burst_freq = self.ic_pr_burst_freq
|
|
596
|
+
|
|
592
597
|
spawned_interface.target_ip = handler.client_address[0]
|
|
593
598
|
spawned_interface.target_port = str(handler.client_address[1])
|
|
594
599
|
spawned_interface.parent_interface = self
|
|
@@ -634,6 +639,12 @@ class TCPServerInterface(Interface):
|
|
|
634
639
|
def sent_announce(self, from_spawned=False):
|
|
635
640
|
if from_spawned: self.oa_freq_deque.append(time.time())
|
|
636
641
|
|
|
642
|
+
def received_path_request(self, from_spawned=False):
|
|
643
|
+
if from_spawned: self.ip_freq_deque.append(time.time())
|
|
644
|
+
|
|
645
|
+
def sent_path_request(self, from_spawned=False):
|
|
646
|
+
if from_spawned: self.op_freq_deque.append(time.time())
|
|
647
|
+
|
|
637
648
|
def process_outgoing(self, data):
|
|
638
649
|
pass
|
|
639
650
|
|
|
@@ -117,7 +117,7 @@ class Packet:
|
|
|
117
117
|
__slots__ = "hops", "header", "header_type", "packet_type", "transport_type", "context", "context_flag", "destination"
|
|
118
118
|
__slots__ += "transport_id", "data", "flags", "raw", "packed", "sent", "create_receipt", "receipt", "fromPacked", "MTU"
|
|
119
119
|
__slots__ += "sent_at", "packet_hash", "ratchet_id", "attached_interface", "receiving_interface", "rssi", "snr", "q"
|
|
120
|
-
__slots__ += "ciphertext", "plaintext", "destination_hash", "destination_type", "link", "map_hash"
|
|
120
|
+
__slots__ += "ciphertext", "plaintext", "destination_hash", "destination_type", "link", "map_hash", "is_outbound_pr"
|
|
121
121
|
|
|
122
122
|
def __init__(self, destination, data, packet_type = DATA, context = NONE, transport_type = RNS.Transport.BROADCAST,
|
|
123
123
|
header_type = HEADER_1, transport_id = None, attached_interface = None, create_receipt = True, context_flag=FLAG_UNSET):
|
|
@@ -161,6 +161,7 @@ class Packet:
|
|
|
161
161
|
|
|
162
162
|
self.attached_interface = attached_interface
|
|
163
163
|
self.receiving_interface = None
|
|
164
|
+
self.is_outbound_pr = False
|
|
164
165
|
self.rssi = None
|
|
165
166
|
self.snr = None
|
|
166
167
|
self.q = None
|