rns 1.2.6__tar.gz → 1.2.7__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.6 → rns-1.2.7}/PKG-INFO +1 -1
- {rns-1.2.6 → rns-1.2.7}/RNS/Discovery.py +1 -1
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/AutoInterface.py +2 -2
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/BackboneInterface.py +4 -5
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/I2PInterface.py +4 -5
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/LocalInterface.py +3 -4
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/RNodeMultiInterface.py +2 -3
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/TCPInterface.py +3 -4
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/WeaveInterface.py +2 -3
- {rns-1.2.6 → rns-1.2.7}/RNS/Reticulum.py +40 -20
- {rns-1.2.6 → rns-1.2.7}/RNS/Transport.py +23 -15
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rncp.py +8 -7
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/pages.py +305 -85
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/server.py +1186 -178
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/util.py +12 -1
- rns-1.2.7/RNS/_version.py +1 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/PKG-INFO +1 -1
- rns-1.2.6/RNS/_version.py +0 -1
- {rns-1.2.6 → rns-1.2.7}/CRNS/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/README.md +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Buffer.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Channel.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/AES.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/Ed25519.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/HKDF.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/HMAC.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/Hashes.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/PKCS7.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/Provider.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/Proxies.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/SHA256.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/SHA512.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/Token.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/X25519.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/aes/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/aes/aes128.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/aes/aes256.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/pure25519/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/pure25519/_ed25519.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/pure25519/basic.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/pure25519/ed25519_oop.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Cryptography/pure25519/eddsa.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Destination.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Identity.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/AX25KISSInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/Android/KISSInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/Android/RNodeInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/Android/SerialInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/Android/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/Interface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/KISSInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/PipeInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/RNodeInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/SerialInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/UDPInterface.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/util/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Interfaces/util/netinfo.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Link.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Packet.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Resolver.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Resource.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/client.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/highlight.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rngit/main.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnid.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnir.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnodeconf.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnpath.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnpkg.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnprobe.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsd.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/_version.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/args.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/exception.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/helpers.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/initiator.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/listener.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/loop.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/process.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/protocol.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/retry.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/rnsh.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnsh/session.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnstatus.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/Utilities/rnx.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/configobj.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/__init__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/__version__.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/aiosam.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/exceptions.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/log.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/sam.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/tunnel.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/i2plib/utils.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/platformutils.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/RNS/vendor/umsgpack.py +0 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/SOURCES.txt +0 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/dependency_links.txt +0 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/entry_points.txt +0 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/requires.txt +0 -0
- {rns-1.2.6 → rns-1.2.7}/rns.egg-info/top_level.txt +0 -0
- {rns-1.2.6 → rns-1.2.7}/setup.cfg +0 -0
- {rns-1.2.6 → rns-1.2.7}/setup.py +0 -0
{rns-1.2.6 → rns-1.2.7}/PKG-INFO
RENAMED
|
@@ -576,7 +576,7 @@ class InterfaceDiscovery():
|
|
|
576
576
|
|
|
577
577
|
def teardown_interface(self, interface):
|
|
578
578
|
interface.detach()
|
|
579
|
-
|
|
579
|
+
RNS.Transport.remove_interface(interface)
|
|
580
580
|
if interface in self.monitored_interfaces: self.monitored_interfaces.remove(interface)
|
|
581
581
|
|
|
582
582
|
def autoconnect_count(self):
|
|
@@ -574,7 +574,7 @@ class AutoInterface(Interface):
|
|
|
574
574
|
spawned_interface.mode = self.mode
|
|
575
575
|
spawned_interface.HW_MTU = self.HW_MTU
|
|
576
576
|
spawned_interface.online = True
|
|
577
|
-
RNS.Transport.
|
|
577
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
578
578
|
if addr in self.spawned_interfaces:
|
|
579
579
|
self.spawned_interfaces[addr].detach()
|
|
580
580
|
self.spawned_interfaces[addr].teardown()
|
|
@@ -666,7 +666,7 @@ class AutoInterfacePeer(Interface):
|
|
|
666
666
|
except Exception as e:
|
|
667
667
|
RNS.log(f"Could not remove {self} from parent interface on detach. The contained exception was: {e}", RNS.LOG_ERROR)
|
|
668
668
|
|
|
669
|
-
|
|
669
|
+
RNS.Transport.remove_interface(self)
|
|
670
670
|
|
|
671
671
|
class AutoInterfaceHandler(socketserver.BaseRequestHandler):
|
|
672
672
|
def __init__(self, callback, *args, **keys):
|
|
@@ -258,7 +258,7 @@ class BackboneInterface(Interface):
|
|
|
258
258
|
@staticmethod
|
|
259
259
|
def deregister_fileno(fileno):
|
|
260
260
|
if fileno < 0:
|
|
261
|
-
RNS.log(f"Attempt to deregister invalid file descriptor {fileno}", RNS.
|
|
261
|
+
RNS.log(f"Attempt to deregister invalid file descriptor {fileno}", RNS.LOG_DEBUG)
|
|
262
262
|
return
|
|
263
263
|
|
|
264
264
|
try: BackboneInterface.epoll.unregister(fileno)
|
|
@@ -454,7 +454,7 @@ class BackboneInterface(Interface):
|
|
|
454
454
|
spawned_interface.HW_MTU = self.HW_MTU
|
|
455
455
|
spawned_interface.online = True
|
|
456
456
|
RNS.log("Spawned new BackboneClient Interface: "+str(spawned_interface), RNS.LOG_VERBOSE)
|
|
457
|
-
RNS.Transport.
|
|
457
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
458
458
|
while spawned_interface in self.spawned_interfaces: self.spawned_interfaces.remove(spawned_interface)
|
|
459
459
|
self.spawned_interfaces.append(spawned_interface)
|
|
460
460
|
BackboneInterface.add_client_socket(socket, spawned_interface)
|
|
@@ -769,9 +769,8 @@ class BackboneClientInterface(Interface):
|
|
|
769
769
|
while self in self.parent_interface.spawned_interfaces:
|
|
770
770
|
self.parent_interface.spawned_interfaces.remove(self)
|
|
771
771
|
|
|
772
|
-
if self
|
|
773
|
-
|
|
774
|
-
RNS.Transport.interfaces.remove(self)
|
|
772
|
+
if not self.initiator:
|
|
773
|
+
RNS.Transport.remove_interface(self)
|
|
775
774
|
|
|
776
775
|
|
|
777
776
|
def __str__(self):
|
|
@@ -826,9 +826,8 @@ class I2PInterfacePeer(Interface):
|
|
|
826
826
|
while self in self.parent_interface.spawned_interfaces:
|
|
827
827
|
self.parent_interface.spawned_interfaces.remove(self)
|
|
828
828
|
|
|
829
|
-
if self
|
|
830
|
-
|
|
831
|
-
RNS.Transport.interfaces.remove(self)
|
|
829
|
+
if not self.initiator:
|
|
830
|
+
RNS.Transport.remove_interface(self)
|
|
832
831
|
|
|
833
832
|
|
|
834
833
|
def __str__(self):
|
|
@@ -940,7 +939,7 @@ class I2PInterface(Interface):
|
|
|
940
939
|
peer_interface.IN = True
|
|
941
940
|
peer_interface.parent_interface = self
|
|
942
941
|
peer_interface.parent_count = False
|
|
943
|
-
RNS.Transport.
|
|
942
|
+
RNS.Transport.add_interface(peer_interface)
|
|
944
943
|
|
|
945
944
|
def incoming_connection(self, handler):
|
|
946
945
|
RNS.log("Accepting incoming I2P connection", RNS.LOG_VERBOSE)
|
|
@@ -993,7 +992,7 @@ class I2PInterface(Interface):
|
|
|
993
992
|
spawned_interface.mode = self.mode
|
|
994
993
|
spawned_interface.HW_MTU = self.HW_MTU
|
|
995
994
|
RNS.log("Spawned new I2PInterface Peer: "+str(spawned_interface), RNS.LOG_VERBOSE)
|
|
996
|
-
RNS.Transport.
|
|
995
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
997
996
|
while spawned_interface in self.spawned_interfaces:
|
|
998
997
|
self.spawned_interfaces.remove(spawned_interface)
|
|
999
998
|
self.spawned_interfaces.append(spawned_interface)
|
|
@@ -347,8 +347,7 @@ class LocalClientInterface(Interface):
|
|
|
347
347
|
self.OUT = False
|
|
348
348
|
self.IN = False
|
|
349
349
|
|
|
350
|
-
|
|
351
|
-
RNS.Transport.interfaces.remove(self)
|
|
350
|
+
RNS.Transport.remove_interface(self)
|
|
352
351
|
|
|
353
352
|
if self in RNS.Transport.local_client_interfaces:
|
|
354
353
|
RNS.Transport.local_client_interfaces.remove(self)
|
|
@@ -458,7 +457,7 @@ class LocalServerInterface(Interface):
|
|
|
458
457
|
spawned_interface.socket_path = self.socket_path
|
|
459
458
|
|
|
460
459
|
if hasattr(self, "_force_bitrate"): spawned_interface._force_bitrate = self._force_bitrate
|
|
461
|
-
RNS.Transport.
|
|
460
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
462
461
|
RNS.Transport.local_client_interfaces.append(spawned_interface)
|
|
463
462
|
BackboneInterface.add_client_socket(client_socket, spawned_interface)
|
|
464
463
|
self.clients += 1
|
|
@@ -474,7 +473,7 @@ class LocalServerInterface(Interface):
|
|
|
474
473
|
spawned_interface.parent_interface = self
|
|
475
474
|
spawned_interface.bitrate = self.bitrate
|
|
476
475
|
if hasattr(self, "_force_bitrate"): spawned_interface._force_bitrate = self._force_bitrate
|
|
477
|
-
RNS.Transport.
|
|
476
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
478
477
|
RNS.Transport.local_client_interfaces.append(spawned_interface)
|
|
479
478
|
self.clients += 1
|
|
480
479
|
spawned_interface.read_loop()
|
|
@@ -375,7 +375,7 @@ class RNodeMultiInterface(Interface):
|
|
|
375
375
|
interface.mode = self.mode
|
|
376
376
|
interface.HW_MTU = self.HW_MTU
|
|
377
377
|
interface.detected = True
|
|
378
|
-
RNS.Transport.
|
|
378
|
+
RNS.Transport.add_interface(interface)
|
|
379
379
|
RNS.log("Spawned new RNode subinterface: "+str(interface), RNS.LOG_VERBOSE)
|
|
380
380
|
|
|
381
381
|
self.clients += 1
|
|
@@ -909,8 +909,7 @@ class RNodeMultiInterface(Interface):
|
|
|
909
909
|
def teardown_subinterfaces(self):
|
|
910
910
|
for interface in self.subinterfaces:
|
|
911
911
|
if interface != 0:
|
|
912
|
-
|
|
913
|
-
RNS.Transport.interfaces.remove(interface)
|
|
912
|
+
RNS.Transport.remove_interface(interface)
|
|
914
913
|
self.subinterfaces[interface.index] = 0
|
|
915
914
|
|
|
916
915
|
def should_ingress_limit(self):
|
|
@@ -436,9 +436,8 @@ class TCPClientInterface(Interface):
|
|
|
436
436
|
while self in self.parent_interface.spawned_interfaces:
|
|
437
437
|
self.parent_interface.spawned_interfaces.remove(self)
|
|
438
438
|
|
|
439
|
-
if self
|
|
440
|
-
|
|
441
|
-
RNS.Transport.interfaces.remove(self)
|
|
439
|
+
if not self.initiator:
|
|
440
|
+
RNS.Transport.remove_interface(self)
|
|
442
441
|
|
|
443
442
|
|
|
444
443
|
def __str__(self):
|
|
@@ -627,7 +626,7 @@ class TCPServerInterface(Interface):
|
|
|
627
626
|
spawned_interface.HW_MTU = self.HW_MTU
|
|
628
627
|
spawned_interface.online = True
|
|
629
628
|
RNS.log("Spawned new TCPClient Interface: "+str(spawned_interface), RNS.LOG_VERBOSE)
|
|
630
|
-
RNS.Transport.
|
|
629
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
631
630
|
while spawned_interface in self.spawned_interfaces:
|
|
632
631
|
self.spawned_interfaces.remove(spawned_interface)
|
|
633
632
|
self.spawned_interfaces.append(spawned_interface)
|
|
@@ -981,7 +981,7 @@ class WeaveInterface(Interface):
|
|
|
981
981
|
spawned_interface.mode = self.mode
|
|
982
982
|
spawned_interface.HW_MTU = self.HW_MTU
|
|
983
983
|
spawned_interface._online = True
|
|
984
|
-
RNS.Transport.
|
|
984
|
+
RNS.Transport.add_interface(spawned_interface)
|
|
985
985
|
if endpoint_addr in self.spawned_interfaces:
|
|
986
986
|
self.spawned_interfaces[endpoint_addr].detach()
|
|
987
987
|
self.spawned_interfaces[endpoint_addr].teardown()
|
|
@@ -1097,5 +1097,4 @@ class WeaveInterfacePeer(Interface):
|
|
|
1097
1097
|
except Exception as e:
|
|
1098
1098
|
RNS.log(f"Could not remove {self} from parent interface on detach. The contained exception was: {e}", RNS.LOG_ERROR)
|
|
1099
1099
|
|
|
1100
|
-
|
|
1101
|
-
RNS.Transport.interfaces.remove(self)
|
|
1100
|
+
RNS.Transport.remove_interface(self)
|
|
@@ -402,7 +402,7 @@ class Reticulum:
|
|
|
402
402
|
RNS.log("Existing shared instance required, but this instance started as shared instance. Aborting startup.", RNS.LOG_VERBOSE)
|
|
403
403
|
|
|
404
404
|
else:
|
|
405
|
-
RNS.Transport.
|
|
405
|
+
RNS.Transport.add_interface(interface)
|
|
406
406
|
self.shared_instance_interface = interface
|
|
407
407
|
self.is_shared_instance = True
|
|
408
408
|
RNS.log("Started shared instance interface: "+str(interface), RNS.LOG_DEBUG)
|
|
@@ -422,7 +422,7 @@ class Reticulum:
|
|
|
422
422
|
interface._force_bitrate = True
|
|
423
423
|
RNS.log(f"Forcing shared instance bitrate of {RNS.prettyspeed(interface.bitrate)}", RNS.LOG_WARNING)
|
|
424
424
|
interface.optimise_mtu()
|
|
425
|
-
RNS.Transport.
|
|
425
|
+
RNS.Transport.add_interface(interface)
|
|
426
426
|
self.is_shared_instance = False
|
|
427
427
|
self.is_standalone_instance = False
|
|
428
428
|
self.is_connected_to_shared_instance = True
|
|
@@ -915,7 +915,7 @@ class Reticulum:
|
|
|
915
915
|
interface.ifac_identity = RNS.Identity.from_bytes(interface.ifac_key)
|
|
916
916
|
interface.ifac_signature = interface.ifac_identity.sign(RNS.Identity.full_hash(interface.ifac_key))
|
|
917
917
|
|
|
918
|
-
RNS.Transport.
|
|
918
|
+
RNS.Transport.add_interface(interface)
|
|
919
919
|
interface.final_init()
|
|
920
920
|
|
|
921
921
|
interface = None
|
|
@@ -1077,7 +1077,7 @@ class Reticulum:
|
|
|
1077
1077
|
interface.ifac_identity = RNS.Identity.from_bytes(interface.ifac_key)
|
|
1078
1078
|
interface.ifac_signature = interface.ifac_identity.sign(RNS.Identity.full_hash(interface.ifac_key))
|
|
1079
1079
|
|
|
1080
|
-
RNS.Transport.
|
|
1080
|
+
RNS.Transport.add_interface(interface)
|
|
1081
1081
|
interface.final_init()
|
|
1082
1082
|
|
|
1083
1083
|
def _default_ar_target(self):
|
|
@@ -1234,28 +1234,43 @@ class Reticulum:
|
|
|
1234
1234
|
|
|
1235
1235
|
def _used_destination_data(self, destination_hash):
|
|
1236
1236
|
if self.is_connected_to_shared_instance:
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1237
|
+
try:
|
|
1238
|
+
rpc_connection = self.get_rpc_client()
|
|
1239
|
+
rpc_connection.send({"destination_data": "used", "destination_hash": destination_hash})
|
|
1240
|
+
response = rpc_connection.recv()
|
|
1241
|
+
return response
|
|
1242
|
+
|
|
1243
|
+
except Exception as e:
|
|
1244
|
+
RNS.log(f"Shared instance RPC failed while setting destination data use: {e}", RNS.LOG_ERROR)
|
|
1245
|
+
return False
|
|
1241
1246
|
|
|
1242
1247
|
else: return RNS.Identity._used_destination_data(destination_hash)
|
|
1243
1248
|
|
|
1244
1249
|
def _retain_destination_data(self, destination_hash):
|
|
1245
1250
|
if self.is_connected_to_shared_instance:
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1251
|
+
try:
|
|
1252
|
+
rpc_connection = self.get_rpc_client()
|
|
1253
|
+
rpc_connection.send({"destination_data": "retain", "destination_hash": destination_hash})
|
|
1254
|
+
response = rpc_connection.recv()
|
|
1255
|
+
return response
|
|
1256
|
+
|
|
1257
|
+
except Exception as e:
|
|
1258
|
+
RNS.log(f"Shared instance RPC failed while retaining destination data: {e}", RNS.LOG_ERROR)
|
|
1259
|
+
return False
|
|
1250
1260
|
|
|
1251
1261
|
else: return RNS.Identity._retain_destination_data(destination_hash)
|
|
1252
1262
|
|
|
1253
1263
|
def _unretain_destination_data(self, destination_hash):
|
|
1254
1264
|
if self.is_connected_to_shared_instance:
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1265
|
+
try:
|
|
1266
|
+
rpc_connection = self.get_rpc_client()
|
|
1267
|
+
rpc_connection.send({"destination_data": "unretain", "destination_hash": destination_hash})
|
|
1268
|
+
response = rpc_connection.recv()
|
|
1269
|
+
return response
|
|
1270
|
+
|
|
1271
|
+
except Exception as e:
|
|
1272
|
+
RNS.log(f"Shared instance RPC failed while unretaining destination data: {e}", RNS.LOG_ERROR)
|
|
1273
|
+
return False
|
|
1259
1274
|
|
|
1260
1275
|
else: return RNS.Identity._unretain_destination_data(destination_hash)
|
|
1261
1276
|
|
|
@@ -1264,10 +1279,15 @@ class Reticulum:
|
|
|
1264
1279
|
raise TypeError("Cannot retain identity, not a valid identity hash")
|
|
1265
1280
|
|
|
1266
1281
|
if self.is_connected_to_shared_instance:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1282
|
+
try:
|
|
1283
|
+
rpc_connection = self.get_rpc_client()
|
|
1284
|
+
rpc_connection.send({"identity_data": "retain", "identity_hash": identity_hash})
|
|
1285
|
+
response = rpc_connection.recv()
|
|
1286
|
+
return response
|
|
1287
|
+
|
|
1288
|
+
except Exception as e:
|
|
1289
|
+
RNS.log(f"Shared instance RPC failed while retaining identity: {e}", RNS.LOG_ERROR)
|
|
1290
|
+
return False
|
|
1271
1291
|
|
|
1272
1292
|
else: return RNS.Identity._retain_identity(identity_hash)
|
|
1273
1293
|
|
|
@@ -417,6 +417,18 @@ class Transport:
|
|
|
417
417
|
|
|
418
418
|
gc.collect()
|
|
419
419
|
|
|
420
|
+
@staticmethod
|
|
421
|
+
def add_interface(interface):
|
|
422
|
+
with Transport.interfaces_lock:
|
|
423
|
+
if not interface in Transport.interfaces:
|
|
424
|
+
Transport.interfaces.append(interface)
|
|
425
|
+
|
|
426
|
+
@staticmethod
|
|
427
|
+
def remove_interface(interface):
|
|
428
|
+
with Transport.interfaces_lock:
|
|
429
|
+
if interface in Transport.interfaces:
|
|
430
|
+
Transport.interfaces.remove(interface)
|
|
431
|
+
|
|
420
432
|
@staticmethod
|
|
421
433
|
def set_network_identity(identity):
|
|
422
434
|
if not Transport.network_identity:
|
|
@@ -1594,7 +1606,7 @@ class Transport:
|
|
|
1594
1606
|
RNS.log(f"Clamping link MTU to {RNS.prettysize(path_mtu)}", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
1595
1607
|
new_raw = new_raw[:-RNS.Link.LINK_MTU_SIZE]+clamped_mtu
|
|
1596
1608
|
except Exception as e:
|
|
1597
|
-
RNS.log(f"Dropping link request packet. The contained exception was: {e}", RNS.
|
|
1609
|
+
RNS.log(f"Dropping link request packet. The contained exception was: {e}", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
1598
1610
|
return
|
|
1599
1611
|
|
|
1600
1612
|
# Entry format is
|
|
@@ -2187,12 +2199,9 @@ class Transport:
|
|
|
2187
2199
|
else:
|
|
2188
2200
|
RNS.log("Invalid link request proof in transport for link "+RNS.prettyhexrep(packet.destination_hash)+", dropping proof.", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2189
2201
|
|
|
2190
|
-
except Exception as e:
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
RNS.log("Link request proof received on wrong interface, not transporting it.", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2194
|
-
else:
|
|
2195
|
-
RNS.log("Received link request proof with hop mismatch, not transporting it", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2202
|
+
except Exception as e: RNS.log("Could not transport link request proof. The contained exception was: "+str(e), RNS.LOG_DEBUG) if RNS.sl(LOG_DEBUG) else None
|
|
2203
|
+
else: RNS.log("Link request proof received on wrong interface, not transporting it.", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2204
|
+
else: RNS.log("Received link request proof with hop mismatch, not transporting it", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2196
2205
|
|
|
2197
2206
|
else:
|
|
2198
2207
|
# Check if we can deliver it to a local
|
|
@@ -2521,16 +2530,17 @@ class Transport:
|
|
|
2521
2530
|
def clean_announce_cache():
|
|
2522
2531
|
st = time.time()
|
|
2523
2532
|
target_path = os.path.join(RNS.Reticulum.cachepath, "announces")
|
|
2524
|
-
|
|
2525
|
-
with Transport.
|
|
2533
|
+
cached_announce_hashes = os.listdir(target_path)
|
|
2534
|
+
with Transport.path_table_lock: active_path_hashes = list(set([Transport.path_table[dst_hash][IDX_PT_PACKET] for dst_hash in Transport.path_table]))
|
|
2535
|
+
with Transport.tunnels_lock: tunnel_path_hashes = list(set([path_dict[dst_hash][IDX_PT_PACKET] for path_dict in [Transport.tunnels[tunnel_id][IDX_TT_PATHS] for tunnel_id in Transport.tunnels] for dst_hash in path_dict]))
|
|
2526
2536
|
removed = 0; total = 0
|
|
2527
|
-
for packet_hash in
|
|
2537
|
+
for packet_hash in cached_announce_hashes:
|
|
2528
2538
|
remove = False
|
|
2529
2539
|
full_path = os.path.join(target_path, packet_hash)
|
|
2530
2540
|
if os.path.isfile(full_path):
|
|
2531
2541
|
try: target_hash = bytes.fromhex(packet_hash)
|
|
2532
2542
|
except: remove = True
|
|
2533
|
-
if (not target_hash in
|
|
2543
|
+
if (not target_hash in active_path_hashes) and (not target_hash in tunnel_path_hashes): remove = True
|
|
2534
2544
|
if remove: os.unlink(full_path); removed += 1
|
|
2535
2545
|
total += 1
|
|
2536
2546
|
|
|
@@ -2892,10 +2902,8 @@ class Transport:
|
|
|
2892
2902
|
tag=tag_bytes)
|
|
2893
2903
|
|
|
2894
2904
|
else: RNS.log("Ignoring duplicate path request for "+RNS.prettyhexrep(destination_hash)+" with tag "+RNS.prettyhexrep(unique_tag), RNS.LOG_EXTREME) if RNS.sl(RNS.LOG_EXTREME) else None
|
|
2895
|
-
|
|
2896
2905
|
else: RNS.log("Ignoring tagless path request for "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2897
|
-
|
|
2898
|
-
except Exception as e: RNS.log("Error while handling path request. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
|
2906
|
+
except Exception as e: RNS.log(f"Error while handling path request. The contained exception was: {e}", RNS.LOG_ERROR)
|
|
2899
2907
|
|
|
2900
2908
|
@staticmethod
|
|
2901
2909
|
def path_request(destination_hash, is_from_local_client, attached_interface, requestor_transport_id=None, tag=None):
|
|
@@ -2936,7 +2944,7 @@ class Transport:
|
|
|
2936
2944
|
received_from = Transport.path_table[destination_hash][IDX_PT_RVCD_IF]
|
|
2937
2945
|
|
|
2938
2946
|
if packet == None:
|
|
2939
|
-
RNS.log("Could not retrieve announce packet from cache while answering path request for
|
|
2947
|
+
RNS.log(f"Could not retrieve announce packet from cache while answering path request for {RNS.prettyhexrep(destination_hash)}, ignoring path request", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
2940
2948
|
|
|
2941
2949
|
elif attached_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING and attached_interface == received_from:
|
|
2942
2950
|
RNS.log("Not answering path request on roaming-mode interface, since next hop is on same roaming-mode interface", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
|
|
@@ -163,11 +163,11 @@ def listen(configdir, identitypath = None, verbosity = 0, quietness = 0, allowed
|
|
|
163
163
|
except Exception as e:
|
|
164
164
|
raise ValueError("Invalid destination entered. Check your input.")
|
|
165
165
|
except Exception as e:
|
|
166
|
-
|
|
166
|
+
RNS.log(f"Could not apply allowed identity: {e}", RNS.LOG_ERROR)
|
|
167
167
|
RNS.exit(1)
|
|
168
168
|
|
|
169
169
|
if len(allowed_identity_hashes) < 1 and not disable_auth:
|
|
170
|
-
|
|
170
|
+
RNS.log("No allowed identities configured, rncp will not accept any files!", RNS.LOG_WARNING)
|
|
171
171
|
|
|
172
172
|
def fetch_request(path, data, request_id, link_id, remote_identity, requested_at):
|
|
173
173
|
global allow_fetch, fetch_jail, fetch_auto_compress
|
|
@@ -217,7 +217,7 @@ def listen(configdir, identitypath = None, verbosity = 0, quietness = 0, allowed
|
|
|
217
217
|
else:
|
|
218
218
|
destination.register_request_handler("fetch_file", response_generator=fetch_request, allow=RNS.Destination.ALLOW_LIST, allowed_list=allowed_identity_hashes)
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
RNS.log("rncp listening on "+RNS.prettyhexrep(destination.hash), RNS.LOG_INFO)
|
|
221
221
|
|
|
222
222
|
if announce >= 0:
|
|
223
223
|
def job():
|
|
@@ -271,15 +271,15 @@ def receive_resource_started(resource):
|
|
|
271
271
|
else:
|
|
272
272
|
id_str = ""
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
RNS.log("Starting resource transfer "+RNS.prettyhexrep(resource.hash)+id_str, RNS.LOG_INFO)
|
|
275
275
|
|
|
276
276
|
def receive_resource_concluded(resource):
|
|
277
277
|
global save_path, allow_overwrite_on_receive
|
|
278
278
|
if resource.status == RNS.Resource.COMPLETE:
|
|
279
|
-
|
|
279
|
+
RNS.log(f"Incoming resource {resource} completed", RNS.LOG_INFO)
|
|
280
280
|
|
|
281
281
|
if resource.metadata == None:
|
|
282
|
-
|
|
282
|
+
RNS.log("Invalid data received, ignoring resource", RNS.LOG_WARNING)
|
|
283
283
|
return
|
|
284
284
|
|
|
285
285
|
else:
|
|
@@ -306,13 +306,14 @@ def receive_resource_concluded(resource):
|
|
|
306
306
|
full_save_path = saved_filename+"."+str(counter)
|
|
307
307
|
|
|
308
308
|
shutil.move(resource.data.name, full_save_path)
|
|
309
|
+
RNS.log("Saved received file to "+full_save_path, RNS.LOG_NOTICE)
|
|
309
310
|
|
|
310
311
|
except Exception as e:
|
|
311
312
|
RNS.log(f"An error occurred while saving received resource: {e}", RNS.LOG_ERROR)
|
|
312
313
|
return
|
|
313
314
|
|
|
314
315
|
else:
|
|
315
|
-
|
|
316
|
+
RNS.log("Resource failed", RNS.LOG_INFO)
|
|
316
317
|
|
|
317
318
|
resource_done = False
|
|
318
319
|
current_resource = None
|