Added --print-identity option to rngit

This commit is contained in:
Mark Qvist committed 2026-04-27 11:44:57 +02:00
1 parent 043a5dc4e7
commit 55c95bf59a
5 files changed
+69 -20

No files matched your search

+22 -4
View File
@@ -42,7 +42,7 @@ from RNS._version import __version__
from RNS.Utilities.rngit import APP_NAME
from RNS.vendor.configobj import ConfigObj
def program_setup(configdir, rnsconfigdir=None, verbosity=0, quietness=0, service=False, interactive=False):
def program_setup(configdir, rnsconfigdir=None, verbosity=0, quietness=0, service=False, interactive=False, print_identity=False):
targetverbosity = verbosity-quietness
if service:
@@ -51,6 +51,8 @@ def program_setup(configdir, rnsconfigdir=None, verbosity=0, quietness=0, servic
else:
targetlogdest = RNS.LOG_STDOUT
if print_identity: git_node = ReticulumGitNode(configdir=configdir, print_identity=True)
reticulum = RNS.Reticulum(configdir=rnsconfigdir, verbosity=targetverbosity, logdest=targetlogdest)
RNS.log("Starting Reticulum Git Node...", RNS.LOG_NOTICE)
@@ -72,6 +74,7 @@ def main():
parser = argparse.ArgumentParser(description="Reticulum Git Repository Node")
parser.add_argument("--config", action="store", default=None, help="path to alternative config directory", type=str)
parser.add_argument("--rnsconfig", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
parser.add_argument('-p', '--print-identity', action='store_true', default=False, help="print identity and destination info and exit")
parser.add_argument('-s', '--service', action='store_true', default=False, help="rngit is running as a service and should log to file")
parser.add_argument('-i', '--interactive', action='store_true', default=False, help="drop into interactive shell after initialisation")
parser.add_argument('-v', '--verbose', action='count', default=0)
@@ -87,7 +90,7 @@ def main():
else: rnsconfigarg = None
program_setup(configdir = configarg, rnsconfigdir=rnsconfigarg, service=args.service, verbosity=args.verbose,
quietness=args.quiet, interactive=args.interactive)
quietness=args.quiet, interactive=args.interactive, print_identity=args.print_identity)
except KeyboardInterrupt:
print("")
@@ -122,7 +125,7 @@ class ReticulumGitNode():
IDX_REPOSITORY = 0x00
IDX_RESULT_CODE = 0x01
def __init__(self, configdir=None, verbosity=None):
def __init__(self, configdir=None, verbosity=None, print_identity=False):
self.identity = None
self.userdir = os.path.expanduser("~")
self.global_allow = RNS.Destination.ALLOW_ALL
@@ -166,10 +169,25 @@ class ReticulumGitNode():
self.__create_default_config()
RNS.log("Default config file created. Make any necessary changes in "+self.configdir+"/config and restart rngit.")
RNS.log("Exiting now")
return
exit(1)
self.__apply_config()
if print_identity:
client_identity_path = self.configdir+"/client_identity"
if not os.path.isfile(client_identity_path):
client_identity = RNS.Identity()
client_identity.to_file(client_identity_path)
RNS.log(f"Client identity generated and persisted to {client_identity_path}", RNS.LOG_VERBOSE)
else: client_identity = RNS.Identity.from_file(client_identity_path)
destination_hash = RNS.Destination.hash_from_name_and_identity(f"{APP_NAME}.repositories", self.identity)
print(f"Git Peer Identity : {RNS.prettyhexrep(client_identity.hash)}")
print(f"Repository Node Identity : {RNS.prettyhexrep(self.identity.hash)}")
print(f"Repositories Destination : {RNS.prettyhexrep(destination_hash)}")
exit(0)
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, APP_NAME, "repositories")
self.destination.set_link_established_callback(self.remote_connected)
self.register_request_handlers()
+16 -5
View File
@@ -701,10 +701,20 @@ Run ``rngit`` to start a repository node:
$ rngit
[Notice] Starting Reticulum Git Node...
[Notice] Reticulum Git Node listening on <4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e>
[Notice] Reticulum Git Node listening on <0d7334d411d00120cbad24edf355fdd2>
On the first run, ``rngit`` will create a default configuration file. You will then need to edit this, to point to your repository locations, configure access permissions, and perform any other necessary configuration.
View your identity and destination hashes:
.. code:: text
$ rngit --print-identity
Git Peer Identity : <959e10e5efc1bd9d97a4083babe51dea>
Repository Node Identity : <153cb870b4665b8c1c348896292b0bad>
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
You can run ``rngit`` in service mode with logging to file:
.. code:: text
@@ -715,13 +725,13 @@ Clone a repository from a remote ``rngit`` node:
.. code:: text
$ git clone rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
$ git clone rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
Add a Reticulum remote to an existing repository:
.. code:: text
$ git remote add some_remote rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
$ git remote add some_remote rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
Push changes to the Reticulum remote:
@@ -729,11 +739,11 @@ Push changes to the Reticulum remote:
$ git push some_remote master
Fetch changes from a remote repository:
Get changes from a remote repository:
.. code:: text
$ git fetch rns_remote
$ git pull rns_remote master
**Repository Structure**
@@ -765,6 +775,7 @@ Repository-specific ``.allowed`` files can be static text files or executable sc
--config CONFIG path to alternative config directory
--rnsconfig RNSCONFIG
path to alternative Reticulum config directory
-p, --print-identity print identity and destination info and exit
-s, --service rngit is running as a service and should log to file
-i, --interactive drop into interactive shell after initialisation
-v, --verbose increase verbosity
+1 -1
View File
@@ -1 +1 @@
Search.setIndex({"alltitles":{"A Carrier-Grade Fallacy":[[14,"a-carrier-grade-fallacy"]],"API Reference":[[8,null]],"ARM64":[[2,"arm64"]],"AX.25 KISS Interface":[[5,"ax-25-kiss-interface"]],"Adding Radio Interfaces":[[2,"adding-radio-interfaces"]],"An Explanation of Reticulum for Human Beings":[[1,null]],"Anchor In The Flow":[[14,"anchor-in-the-flow"]],"Android":[[2,"android"]],"Announce":[[0,"announce"]],"Announce Propagation Rules":[[11,"announce-propagation-rules"]],"Announce Rate Control":[[5,"announce-rate-control"]],"Announcing Presence":[[14,"announcing-presence"]],"Auto Interface":[[5,"auto-interface"]],"Automated List Sourcing":[[12,"automated-list-sourcing"]],"Backbone Interface":[[5,"backbone-interface"]],"Blackhole Management":[[12,"blackhole-management"]],"Bootstrapping Connectivity":[[2,"bootstrapping-connectivity"]],"Broadcast":[[0,"broadcast"]],"Buffer":[[0,"buffer"]],"Build Personal Infrastructure":[[2,"build-personal-infrastructure"]],"Building Networks":[[7,null]],"Channel":[[0,"channel"]],"Code Examples":[[0,null]],"Columba":[[9,"columba"]],"Combining Hardware Types":[[3,"combining-hardware-types"]],"Common Interface Options":[[5,"common-interface-options"]],"Communications Hardware":[[3,null]],"Concepts & Overview":[[7,"concepts-overview"]],"Conceptual Overview":[[11,"conceptual-overview"]],"Configuration & Data":[[12,"configuration-data"]],"Configuring Interfaces":[[5,null]],"Connect to the Distributed Backbone":[[2,"connect-to-the-distributed-backbone"]],"Connecting Remotes":[[5,"connecting-remotes"]],"Connecting Reticulum Instances Over the Internet":[[2,"connecting-reticulum-instances-over-the-internet"]],"Contributing to the Global Ret":[[2,"contributing-to-the-global-ret"]],"Cost Of A Byte":[[14,"cost-of-a-byte"]],"Creating RNodes":[[3,"creating-rnodes"]],"Creating a Network With Reticulum":[[2,"creating-a-network-with-reticulum"]],"Creating and Using Custom Interfaces":[[2,"creating-and-using-custom-interfaces"]],"Creating and Using a Network Identity":[[11,"creating-and-using-a-network-identity"]],"Cryptographic Primitives":[[11,"cryptographic-primitives"]],"Current Status":[[13,"current-status"]],"Current Usage":[[11,"current-usage"]],"Custom Interfaces":[[0,"custom-interfaces"],[5,"custom-interfaces"]],"Death To The Address":[[14,"death-to-the-address"]],"Debian Bookworm":[[2,"debian-bookworm"]],"Decentralization Or Uncentralizability?":[[14,"decentralization-or-uncentralizability"]],"Design Patterns For Post-IP Systems":[[14,"design-patterns-for-post-ip-systems"]],"Destination Naming":[[11,"destination-naming"]],"Destinations":[[11,"destinations"]],"Destinations, Not Addresses":[[7,"destinations-not-addresses"]],"Develop a Program with Reticulum":[[2,"develop-a-program-with-reticulum"]],"Discoverable Interfaces":[[5,"discoverable-interfaces"]],"Discovering Interfaces":[[12,"discovering-interfaces"]],"Discovery Parameters":[[5,"discovery-parameters"]],"Donations":[[10,"donations"]],"Echo":[[0,"echo"]],"Emergent Patterns":[[14,"emergent-patterns"]],"Enabling Discovery":[[5,"enabling-discovery"]],"Encryption Is Not A Feature":[[14,"encryption-is-not-a-feature"]],"Ethernet-based Hardware":[[3,"ethernet-based-hardware"]],"Ethics Of The Tool":[[14,"ethics-of-the-tool"]],"Example Configuration":[[5,"example-configuration"]],"Fabric Of The Independent":[[14,"fabric-of-the-independent"]],"Fallacy Of The Cloud":[[14,"fallacy-of-the-cloud"]],"Filetransfer":[[0,"filetransfer"]],"Finding Your Way":[[2,"finding-your-way"]],"Fixed Serial Port Names":[[12,"fixed-serial-port-names"]],"Flow & Time":[[14,"flow-time"]],"Future Implications":[[11,"future-implications"]],"Getting Further":[[11,"getting-further"]],"Getting Started Fast":[[2,null]],"Goals":[[11,"goals"]],"Heltec LoRa32 v2.0":[[3,"heltec-lora32-v2-0"]],"Heltec LoRa32 v3.0":[[3,"heltec-lora32-v3-0"]],"Heltec LoRa32 v4.0":[[3,"heltec-lora32-v4-0"]],"Heltec T114":[[3,"heltec-t114"]],"Heterogeneous Connectivity":[[7,"heterogeneous-connectivity"]],"Hostile Environments":[[14,"hostile-environments"]],"Hosting Public Entrypoints":[[2,"hosting-public-entrypoints"]],"I2P Interface":[[5,"i2p-interface"]],"Identification":[[0,"example-identify"]],"Identities":[[11,"understanding-identities"]],"Identity and Nomadism":[[14,"identity-and-nomadism"]],"Improving System Configuration":[[12,"improving-system-configuration"]],"Included Utility Programs":[[12,"included-utility-programs"]],"Indices and Tables":[[4,"indices-and-tables"]],"Installation":[[3,"installation"]],"Interface Access Codes":[[11,"interface-access-codes"]],"Interface Modes":[[5,"interface-modes"],[5,"interfaces-modes"]],"Interface Modules & Connectivity Resources":[[9,"interface-modules-connectivity-resources"]],"Interface Types and Devices":[[13,"interface-types-and-devices"]],"Introduction & Basic Functionality":[[11,"introduction-basic-functionality"]],"Introductory Considerations":[[7,"introductory-considerations"]],"KISS Interface":[[5,"kiss-interface"]],"LXMF":[[9,"lxmf"]],"LLine truncated
Search.setIndex({"alltitles":{"A Carrier-Grade Fallacy":[[14,"a-carrier-grade-fallacy"]],"API Reference":[[8,null]],"ARM64":[[2,"arm64"]],"AX.25 KISS Interface":[[5,"ax-25-kiss-interface"]],"Adding Radio Interfaces":[[2,"adding-radio-interfaces"]],"An Explanation of Reticulum for Human Beings":[[1,null]],"Anchor In The Flow":[[14,"anchor-in-the-flow"]],"Android":[[2,"android"]],"Announce":[[0,"announce"]],"Announce Propagation Rules":[[11,"announce-propagation-rules"]],"Announce Rate Control":[[5,"announce-rate-control"]],"Announcing Presence":[[14,"announcing-presence"]],"Auto Interface":[[5,"auto-interface"]],"Automated List Sourcing":[[12,"automated-list-sourcing"]],"Backbone Interface":[[5,"backbone-interface"]],"Blackhole Management":[[12,"blackhole-management"]],"Bootstrapping Connectivity":[[2,"bootstrapping-connectivity"]],"Broadcast":[[0,"broadcast"]],"Buffer":[[0,"buffer"]],"Build Personal Infrastructure":[[2,"build-personal-infrastructure"]],"Building Networks":[[7,null]],"Channel":[[0,"channel"]],"Code Examples":[[0,null]],"Columba":[[9,"columba"]],"Combining Hardware Types":[[3,"combining-hardware-types"]],"Common Interface Options":[[5,"common-interface-options"]],"Communications Hardware":[[3,null]],"Concepts & Overview":[[7,"concepts-overview"]],"Conceptual Overview":[[11,"conceptual-overview"]],"Configuration & Data":[[12,"configuration-data"]],"Configuring Interfaces":[[5,null]],"Connect to the Distributed Backbone":[[2,"connect-to-the-distributed-backbone"]],"Connecting Remotes":[[5,"connecting-remotes"]],"Connecting Reticulum Instances Over the Internet":[[2,"connecting-reticulum-instances-over-the-internet"]],"Contributing to the Global Ret":[[2,"contributing-to-the-global-ret"]],"Cost Of A Byte":[[14,"cost-of-a-byte"]],"Creating RNodes":[[3,"creating-rnodes"]],"Creating a Network With Reticulum":[[2,"creating-a-network-with-reticulum"]],"Creating and Using Custom Interfaces":[[2,"creating-and-using-custom-interfaces"]],"Creating and Using a Network Identity":[[11,"creating-and-using-a-network-identity"]],"Cryptographic Primitives":[[11,"cryptographic-primitives"]],"Current Status":[[13,"current-status"]],"Current Usage":[[11,"current-usage"]],"Custom Interfaces":[[0,"custom-interfaces"],[5,"custom-interfaces"]],"Death To The Address":[[14,"death-to-the-address"]],"Debian Bookworm":[[2,"debian-bookworm"]],"Decentralization Or Uncentralizability?":[[14,"decentralization-or-uncentralizability"]],"Design Patterns For Post-IP Systems":[[14,"design-patterns-for-post-ip-systems"]],"Destination Naming":[[11,"destination-naming"]],"Destinations":[[11,"destinations"]],"Destinations, Not Addresses":[[7,"destinations-not-addresses"]],"Develop a Program with Reticulum":[[2,"develop-a-program-with-reticulum"]],"Discoverable Interfaces":[[5,"discoverable-interfaces"]],"Discovering Interfaces":[[12,"discovering-interfaces"]],"Discovery Parameters":[[5,"discovery-parameters"]],"Donations":[[10,"donations"]],"Echo":[[0,"echo"]],"Emergent Patterns":[[14,"emergent-patterns"]],"Enabling Discovery":[[5,"enabling-discovery"]],"Encryption Is Not A Feature":[[14,"encryption-is-not-a-feature"]],"Ethernet-based Hardware":[[3,"ethernet-based-hardware"]],"Ethics Of The Tool":[[14,"ethics-of-the-tool"]],"Example Configuration":[[5,"example-configuration"]],"Fabric Of The Independent":[[14,"fabric-of-the-independent"]],"Fallacy Of The Cloud":[[14,"fallacy-of-the-cloud"]],"Filetransfer":[[0,"filetransfer"]],"Finding Your Way":[[2,"finding-your-way"]],"Fixed Serial Port Names":[[12,"fixed-serial-port-names"]],"Flow & Time":[[14,"flow-time"]],"Future Implications":[[11,"future-implications"]],"Getting Further":[[11,"getting-further"]],"Getting Started Fast":[[2,null]],"Goals":[[11,"goals"]],"Heltec LoRa32 v2.0":[[3,"heltec-lora32-v2-0"]],"Heltec LoRa32 v3.0":[[3,"heltec-lora32-v3-0"]],"Heltec LoRa32 v4.0":[[3,"heltec-lora32-v4-0"]],"Heltec T114":[[3,"heltec-t114"]],"Heterogeneous Connectivity":[[7,"heterogeneous-connectivity"]],"Hostile Environments":[[14,"hostile-environments"]],"Hosting Public Entrypoints":[[2,"hosting-public-entrypoints"]],"I2P Interface":[[5,"i2p-interface"]],"Identification":[[0,"example-identify"]],"Identities":[[11,"understanding-identities"]],"Identity and Nomadism":[[14,"identity-and-nomadism"]],"Improving System Configuration":[[12,"improving-system-configuration"]],"Included Utility Programs":[[12,"included-utility-programs"]],"Indices and Tables":[[4,"indices-and-tables"]],"Installation":[[3,"installation"]],"Interface Access Codes":[[11,"interface-access-codes"]],"Interface Modes":[[5,"interface-modes"],[5,"interfaces-modes"]],"Interface Modules & Connectivity Resources":[[9,"interface-modules-connectivity-resources"]],"Interface Types and Devices":[[13,"interface-types-and-devices"]],"Introduction & Basic Functionality":[[11,"introduction-basic-functionality"]],"Introductory Considerations":[[7,"introductory-considerations"]],"KISS Interface":[[5,"kiss-interface"]],"LXMF":[[9,"lxmf"]],"LLine truncated
+14 -5
View File
@@ -864,28 +864,36 @@ options:
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ rngit
[Notice] Starting Reticulum Git Node...
[Notice] Reticulum Git Node listening on &lt;4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e&gt;
[Notice] Reticulum Git Node listening on &lt;0d7334d411d00120cbad24edf355fdd2&gt;
</pre></div>
</div>
<p>On the first run, <code class="docutils literal notranslate"><span class="pre">rngit</span></code> will create a default configuration file. You will then need to edit this, to point to your repository locations, configure access permissions, and perform any other necessary configuration.</p>
<p>View your identity and destination hashes:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ rngit --print-identity
Git Peer Identity : &lt;959e10e5efc1bd9d97a4083babe51dea&gt;
Repository Node Identity : &lt;153cb870b4665b8c1c348896292b0bad&gt;
Repositories Destination : &lt;0d7334d411d00120cbad24edf355fdd2&gt;
</pre></div>
</div>
<p>You can run <code class="docutils literal notranslate"><span class="pre">rngit</span></code> in service mode with logging to file:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ rngit -s
</pre></div>
</div>
<p>Clone a repository from a remote <code class="docutils literal notranslate"><span class="pre">rngit</span></code> node:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git clone rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git clone rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
</pre></div>
</div>
<p>Add a Reticulum remote to an existing repository:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git remote add some_remote rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git remote add some_remote rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
</pre></div>
</div>
<p>Push changes to the Reticulum remote:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git push some_remote master
</pre></div>
</div>
<p>Fetch changes from a remote repository:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git fetch rns_remote
<p>Get changes from a remote repository:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>$ git pull rns_remote master
</pre></div>
</div>
<p><strong>Repository Structure</strong></p>
@@ -910,6 +918,7 @@ options:
--config CONFIG path to alternative config directory
--rnsconfig RNSCONFIG
path to alternative Reticulum config directory
-p, --print-identity print identity and destination info and exit
-s, --service rngit is running as a service and should log to file
-i, --interactive drop into interactive shell after initialisation
-v, --verbose increase verbosity
+16 -5
View File
@@ -701,10 +701,20 @@ Run ``rngit`` to start a repository node:
$ rngit
[Notice] Starting Reticulum Git Node...
[Notice] Reticulum Git Node listening on <4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e>
[Notice] Reticulum Git Node listening on <0d7334d411d00120cbad24edf355fdd2>
On the first run, ``rngit`` will create a default configuration file. You will then need to edit this, to point to your repository locations, configure access permissions, and perform any other necessary configuration.
View your identity and destination hashes:
.. code:: text
$ rngit --print-identity
Git Peer Identity : <959e10e5efc1bd9d97a4083babe51dea>
Repository Node Identity : <153cb870b4665b8c1c348896292b0bad>
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
You can run ``rngit`` in service mode with logging to file:
.. code:: text
@@ -715,13 +725,13 @@ Clone a repository from a remote ``rngit`` node:
.. code:: text
$ git clone rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
$ git clone rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
Add a Reticulum remote to an existing repository:
.. code:: text
$ git remote add some_remote rns://4a5c8d9e1f2a3b4c5d6e7f8a9b0c1d2e/public/myrepo
$ git remote add some_remote rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
Push changes to the Reticulum remote:
@@ -729,11 +739,11 @@ Push changes to the Reticulum remote:
$ git push some_remote master
Fetch changes from a remote repository:
Get changes from a remote repository:
.. code:: text
$ git fetch rns_remote
$ git pull rns_remote master
**Repository Structure**
@@ -765,6 +775,7 @@ Repository-specific ``.allowed`` files can be static text files or executable sc
--config CONFIG path to alternative config directory
--rnsconfig RNSCONFIG
path to alternative Reticulum config directory
-p, --print-identity print identity and destination info and exit
-s, --service rngit is running as a service and should log to file
-i, --interactive drop into interactive shell after initialisation
-v, --verbose increase verbosity