rns 1.2.7__tar.gz → 1.2.9__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.
Files changed (111) hide show
  1. {rns-1.2.7 → rns-1.2.9}/PKG-INFO +1 -1
  2. {rns-1.2.7 → rns-1.2.9}/RNS/Identity.py +11 -2
  3. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/client.py +41 -0
  4. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/pages.py +21 -10
  5. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/server.py +945 -129
  6. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/util.py +71 -24
  7. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnid.py +106 -13
  8. rns-1.2.9/RNS/_version.py +1 -0
  9. rns-1.2.9/RNS/vendor/validate.py +537 -0
  10. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/PKG-INFO +1 -1
  11. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/SOURCES.txt +1 -0
  12. {rns-1.2.7 → rns-1.2.9}/setup.py +4 -0
  13. rns-1.2.7/RNS/_version.py +0 -1
  14. {rns-1.2.7 → rns-1.2.9}/CRNS/__init__.py +0 -0
  15. {rns-1.2.7 → rns-1.2.9}/README.md +0 -0
  16. {rns-1.2.7 → rns-1.2.9}/RNS/Buffer.py +0 -0
  17. {rns-1.2.7 → rns-1.2.9}/RNS/Channel.py +0 -0
  18. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/AES.py +0 -0
  19. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/Ed25519.py +0 -0
  20. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/HKDF.py +0 -0
  21. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/HMAC.py +0 -0
  22. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/Hashes.py +0 -0
  23. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/PKCS7.py +0 -0
  24. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/Provider.py +0 -0
  25. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/Proxies.py +0 -0
  26. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/SHA256.py +0 -0
  27. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/SHA512.py +0 -0
  28. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/Token.py +0 -0
  29. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/X25519.py +0 -0
  30. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/__init__.py +0 -0
  31. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/aes/__init__.py +0 -0
  32. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/aes/aes128.py +0 -0
  33. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/aes/aes256.py +0 -0
  34. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/pure25519/__init__.py +0 -0
  35. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/pure25519/_ed25519.py +0 -0
  36. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/pure25519/basic.py +0 -0
  37. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/pure25519/ed25519_oop.py +0 -0
  38. {rns-1.2.7 → rns-1.2.9}/RNS/Cryptography/pure25519/eddsa.py +0 -0
  39. {rns-1.2.7 → rns-1.2.9}/RNS/Destination.py +0 -0
  40. {rns-1.2.7 → rns-1.2.9}/RNS/Discovery.py +0 -0
  41. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/AX25KISSInterface.py +0 -0
  42. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/Android/KISSInterface.py +0 -0
  43. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/Android/RNodeInterface.py +0 -0
  44. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/Android/SerialInterface.py +0 -0
  45. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/Android/__init__.py +0 -0
  46. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/AutoInterface.py +0 -0
  47. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/BackboneInterface.py +0 -0
  48. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/I2PInterface.py +0 -0
  49. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/Interface.py +0 -0
  50. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/KISSInterface.py +0 -0
  51. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/LocalInterface.py +0 -0
  52. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/PipeInterface.py +0 -0
  53. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/RNodeInterface.py +0 -0
  54. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/RNodeMultiInterface.py +0 -0
  55. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/SerialInterface.py +0 -0
  56. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/TCPInterface.py +0 -0
  57. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/UDPInterface.py +0 -0
  58. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/WeaveInterface.py +0 -0
  59. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/__init__.py +0 -0
  60. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/util/__init__.py +0 -0
  61. {rns-1.2.7 → rns-1.2.9}/RNS/Interfaces/util/netinfo.py +0 -0
  62. {rns-1.2.7 → rns-1.2.9}/RNS/Link.py +0 -0
  63. {rns-1.2.7 → rns-1.2.9}/RNS/Packet.py +0 -0
  64. {rns-1.2.7 → rns-1.2.9}/RNS/Resolver.py +0 -0
  65. {rns-1.2.7 → rns-1.2.9}/RNS/Resource.py +0 -0
  66. {rns-1.2.7 → rns-1.2.9}/RNS/Reticulum.py +0 -0
  67. {rns-1.2.7 → rns-1.2.9}/RNS/Transport.py +0 -0
  68. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/__init__.py +0 -0
  69. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rncp.py +0 -0
  70. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/__init__.py +0 -0
  71. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/highlight.py +0 -0
  72. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rngit/main.py +0 -0
  73. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnir.py +0 -0
  74. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnodeconf.py +0 -0
  75. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnpath.py +0 -0
  76. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnpkg.py +0 -0
  77. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnprobe.py +0 -0
  78. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsd.py +0 -0
  79. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/__init__.py +0 -0
  80. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/_version.py +0 -0
  81. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/args.py +0 -0
  82. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/exception.py +0 -0
  83. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/helpers.py +0 -0
  84. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/initiator.py +0 -0
  85. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/listener.py +0 -0
  86. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/loop.py +0 -0
  87. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/process.py +0 -0
  88. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/protocol.py +0 -0
  89. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/retry.py +0 -0
  90. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/rnsh.py +0 -0
  91. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnsh/session.py +0 -0
  92. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnstatus.py +0 -0
  93. {rns-1.2.7 → rns-1.2.9}/RNS/Utilities/rnx.py +0 -0
  94. {rns-1.2.7 → rns-1.2.9}/RNS/__init__.py +0 -0
  95. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/__init__.py +0 -0
  96. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/configobj.py +0 -0
  97. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/__init__.py +0 -0
  98. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/__version__.py +0 -0
  99. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/aiosam.py +0 -0
  100. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/exceptions.py +0 -0
  101. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/log.py +0 -0
  102. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/sam.py +0 -0
  103. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/tunnel.py +0 -0
  104. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/i2plib/utils.py +0 -0
  105. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/platformutils.py +0 -0
  106. {rns-1.2.7 → rns-1.2.9}/RNS/vendor/umsgpack.py +0 -0
  107. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/dependency_links.txt +0 -0
  108. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/entry_points.txt +0 -0
  109. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/requires.txt +0 -0
  110. {rns-1.2.7 → rns-1.2.9}/rns.egg-info/top_level.txt +0 -0
  111. {rns-1.2.7 → rns-1.2.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rns
3
- Version: 1.2.7
3
+ Version: 1.2.9
4
4
  Summary: Self-configuring, encrypted and resilient mesh networking stack for LoRa, packet radio, WiFi and everything in between
5
5
  Home-page: https://reticulum.network/
6
6
  Author: Mark Qvist
@@ -212,8 +212,17 @@ class Identity:
212
212
  RNS.log("Skipped recombining known destinations from disk, since an error occurred: "+str(e), RNS.LOG_WARNING)
213
213
 
214
214
  RNS.log("Saving "+str(len(Identity.known_destinations))+" known destinations to storage...", RNS.LOG_VERBOSE)
215
- with open(RNS.Reticulum.storagepath+"/known_destinations","wb") as file:
216
- umsgpack.dump(Identity.known_destinations.copy(), file)
215
+ temp_file = RNS.Reticulum.storagepath+f"/known_destinations.tmp.{time.time()}"
216
+
217
+ try:
218
+ with open(temp_file,"wb") as file: umsgpack.dump(Identity.known_destinations.copy(), file)
219
+ os.rename(temp_file, RNS.Reticulum.storagepath+f"/known_destinations")
220
+
221
+ except Exception as e:
222
+ RNS.log(f"Error while serializing and writing known destinations: {e}", RNS.LOG_ERROR)
223
+ try: os.unlink(temp_file)
224
+ except Exception as e: RNS.log(f"Could not clean up temporary file {temp_file}: {e}", RNS.LOG_WARNING)
225
+ raise e
217
226
 
218
227
  save_time = time.time() - save_start
219
228
  if save_time < 1: time_str = str(round(save_time*1000,2))+"ms"
@@ -101,6 +101,7 @@ class ReticulumGitClient():
101
101
  self.config = None
102
102
  self.ready = False
103
103
 
104
+ self.destination_aliases = {}
104
105
  self.remote_identity = None
105
106
  self.destination = None
106
107
  self.link = None
@@ -170,6 +171,18 @@ class ReticulumGitClient():
170
171
  section = self.config["client"]
171
172
  if "ref_batch_size" in section: self.ref_batch_size = max(0, min(1024, section.as_int("ref_batch_size")))
172
173
 
174
+ if "aliases" in self.config:
175
+ section = self.config["aliases"]
176
+ for alias in section:
177
+ alias_hexhash = section[alias]
178
+ len_ok = len(alias_hexhash) == RNS.Identity.TRUNCATED_HASHLENGTH//8*2
179
+ try: alias_hash = bytes.fromhex(alias_hexhash)
180
+ except: alias_hash = None
181
+ alias_exists = alias in self.destination_aliases
182
+ if not len_ok or not alias_hash: continue
183
+ if alias_exists: continue
184
+ self.destination_aliases[alias] = RNS.hexrep(alias_hash, delimit=False)
185
+
173
186
  if not os.path.isfile(self.identitypath):
174
187
  identity = RNS.Identity()
175
188
  identity.to_file(self.identitypath)
@@ -185,6 +198,19 @@ class ReticulumGitClient():
185
198
 
186
199
  else: self.identity = identity
187
200
 
201
+ self.destination_hexhash = self.__resolve_destination_alias(self.destination_hexhash)
202
+
203
+ def __resolve_destination_alias(self, alias):
204
+ def resolve(alias):
205
+ len_match = len(alias) == RNS.Identity.TRUNCATED_HASHLENGTH//8*2
206
+ try: hash_bytes = bytes.fromhex(alias)
207
+ except: hash_bytes = None
208
+ if len_match and hash_bytes: return alias
209
+ else: return self.destination_aliases[alias] if alias in self.destination_aliases else alias
210
+
211
+ resolved = resolve(alias)
212
+ return resolved
213
+
188
214
  def abort(self, reason=None, code=255):
189
215
  if not reason: reason = "Unknown reason"
190
216
  print(f"git-remote-rns failed: {reason}", file=sys.stderr)
@@ -656,6 +682,21 @@ __default_rngit_config__ = '''# This is the default rngit client config file.
656
682
 
657
683
  ref_batch_size = 25
658
684
 
685
+
686
+ [aliases]
687
+
688
+ # You can define aliases for commonly used destination
689
+ # hashes in this section. Each line must be in the format
690
+ # aliased_name = DESTINATION_HASH
691
+ #
692
+ # These hashes are used for resolving remote destinations.
693
+ # For rngit node permissions and identity resolution,
694
+ # aliases must be defined in ~/.rngit/config.
695
+
696
+ # my_node = 063d38912bffc850af4a1b8a270a9d85
697
+ # bobs_node = 714981d03e41deda0e4468cb274414cc
698
+
699
+
659
700
  [logging]
660
701
  # Valid log levels are 0 through 7:
661
702
  # 0: Log only critical information
@@ -437,6 +437,10 @@ class NomadNetworkNode():
437
437
 
438
438
  repo = self.get_accessible_repository(remote_identity, group_name, repo_name)
439
439
 
440
+ if not repo:
441
+ content = self.m_heading("Not Found", 1) + "\nThe requested repository was not found.\n"
442
+ return self.render_template(content, nav_content="".join(nav_parts), st=st)
443
+
440
444
  repo_source = ""; source_link = None
441
445
  if repo["fork"] or repo["mirror"]:
442
446
  if repo["fork"]: source_type = "fork"; source_url = repo["fork"]
@@ -457,15 +461,14 @@ class NomadNetworkNode():
457
461
  source_link = f"{mu_link}"
458
462
  except Exception as e: source_link = ""
459
463
 
464
+ synced_ago = max(0, time.time()-self.owner.last_upstream_sync(repo["path"]))
465
+ sync_time = RNS.prettytime(synced_ago, compact=True).split(" ")[0]
466
+ sync_str = f" `*{self.CLR_DIM_H}synced {sync_time} ago`f`*\n"
460
467
  source_desc = f"{source_type}ed from"
461
468
  source_indent = " "*(len(f"Node / {group_name} / {repo_name}")-len(source_desc))
462
469
  if source_link: source_url = source_link
463
- nav_parts.append(f"{self.CLR_DIM}{source_desc.capitalize()}{source_indent} {source_url}`f\n")
470
+ nav_parts.append(f"{self.CLR_DIM}{source_desc.capitalize()}{source_indent} {source_url}`f{sync_str}\n")
464
471
 
465
- if not repo:
466
- content = self.m_heading("Not Found", 1) + "\nThe requested repository was not found.\n"
467
- return self.render_template(content, nav_content="".join(nav_parts), st=st)
468
-
469
472
  description = self.get_repository_description(repo["path"])
470
473
  if description: description = f"{description}\n\n"
471
474
  else: description = ""
@@ -702,6 +705,7 @@ class NomadNetworkNode():
702
705
  content = self.m_heading("Invalid Path", 1) + "\n\nNo file path specified.\n"
703
706
  return self.render_template(content, st=st)
704
707
 
708
+ file_path = file_path.lstrip("./").replace("/./", "/")
705
709
  file_ext = os.path.splitext(file_path)[1].lower()
706
710
  renderable = file_ext in self.RENDERABLE_EXTS
707
711
  if not renderable: raw = True; render = False
@@ -860,7 +864,7 @@ class NomadNetworkNode():
860
864
  author = commit["author"]
861
865
  date = self.format_absolute_time(commit["timestamp"])+" - "+self.format_relative_time(commit["timestamp"])
862
866
 
863
- hash_link = self.m_link(short_hash, self.PATH_COMMIT, g=group_name, r=repo_name, h=commit["hash"])
867
+ hash_link = self.m_link(short_hash, self.PATH_COMMIT, g=group_name, r=repo_name, ref=ref, h=commit["hash"])
864
868
 
865
869
  content_parts.append(f"`F66d{hash_link}`f {self.m_escape(author)} {self.CLR_DIM}{date}`f\n")
866
870
  content_parts.append(f"{self.m_escape(subject)}\n\n")
@@ -887,6 +891,7 @@ class NomadNetworkNode():
887
891
  if not data or not type(data) == dict: data = {}
888
892
  group_name = data.get("var_g", "") if data else ""
889
893
  repo_name = data.get("var_r", "") if data else ""
894
+ ref = data.get("var_ref", "HEAD") if data else "HEAD"
890
895
  commit_hash = data.get("var_h", "") if data else ""
891
896
 
892
897
  if not group_name or not repo_name:
@@ -900,6 +905,12 @@ class NomadNetworkNode():
900
905
 
901
906
  repo_path = repo["path"]
902
907
 
908
+ # Validate ref exists
909
+ resolved_ref = self.resolve_ref(repo_path, ref)
910
+ if not resolved_ref:
911
+ content = self.m_heading("Ref Not Found", 1) + f"\n\nThe ref '{ref}' does not exist in this repository.\n"
912
+ return self.render_template(content, st=st)
913
+
903
914
  # Validate commit hash
904
915
  if not commit_hash or len(commit_hash) < 7:
905
916
  content = self.m_heading("Error", 2) + "\nNo valid commit hash specified.\n"
@@ -913,7 +924,7 @@ class NomadNetworkNode():
913
924
 
914
925
  # Breadcrumb navigation
915
926
  nav_parts = []
916
- breadcrumb = f"{self.m_link('Node', self.PATH_INDEX)} / {self.m_link(group_name, self.PATH_GROUP, g=group_name)} / {self.m_link(repo_name, self.PATH_REPO, g=group_name, r=repo_name)} / {resolved_hash[:7]}"
927
+ breadcrumb = f"{self.m_link('Node', self.PATH_INDEX)} / {self.m_link(group_name, self.PATH_GROUP, g=group_name)} / {self.m_link(repo_name, self.PATH_REPO, g=group_name, r=repo_name)} / {self.m_link('commits', self.PATH_COMMITS, g=group_name, r=repo_name, ref=ref)} / {resolved_hash[:7]}"
917
928
  nav_parts.append(">>\n" + breadcrumb + "\n")
918
929
  nav_content = "".join(nav_parts)
919
930
 
@@ -951,7 +962,7 @@ class NomadNetworkNode():
951
962
  if commit_info.get("parents"):
952
963
  parent_links = []
953
964
  for parent_hash in commit_info["parents"]:
954
- parent_link = self.m_link(parent_hash[:7], self.PATH_COMMIT, g=group_name, r=repo_name, h=parent_hash)
965
+ parent_link = self.m_link(parent_hash[:7], self.PATH_COMMIT, g=group_name, r=repo_name, ref=ref, h=parent_hash)
955
966
  parent_links.append(parent_link)
956
967
 
957
968
  content_parts.append(f"Parents: {' '.join(parent_links)}\n")
@@ -2461,7 +2472,7 @@ class NomadNetworkNode():
2461
2472
  line = "│"
2462
2473
  for val in data:
2463
2474
  upper_filled = val >= row_top
2464
- lower_filled = val >= row_mid
2475
+ lower_filled = val >= row_mid or row == 1 and val > 0
2465
2476
 
2466
2477
  if not upper_filled and not lower_filled: line += " "
2467
2478
  elif upper_filled: line += f"`FT{gradient_color(grad_top)}`BT{gradient_color(grad_mid)}▀`f`b"
@@ -2571,7 +2582,7 @@ class NomadNetworkNode():
2571
2582
  first = str(labels[0])[:12]
2572
2583
  last = str(labels[-1])[:12]
2573
2584
  mid_space = len(bottom) - len(first) - len(last)
2574
- lines.append(f"{self.CLR_DIM}{first}{" " * mid_space}{last}`f\n")
2585
+ lines.append(f"{self.CLR_DIM}{first}{' ' * mid_space}{last}`f\n")
2575
2586
 
2576
2587
  return "".join(lines)
2577
2588