mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-11-19 14:36:34 -05:00
Added ability to configure destination value and link cost to rngit
This commit is contained in:
parent
0123133e71
commit
05ac4bba8e
7 changed files with 100 additions and 13 deletions
|
|
@ -71,6 +71,7 @@ class NomadNetworkNode():
|
|||
FILE_DOWNLOAD = "/file/download"
|
||||
FILE_WORKDOC = "/file/workdoc"
|
||||
|
||||
DEFAULT_LINK_COST = 18.0
|
||||
BLOB_SIZE_LIMIT = 256 * 1024
|
||||
TREE_ENTRIES_PER_PAGE = 1000
|
||||
COMMITS_PER_PAGE = 100
|
||||
|
|
@ -138,6 +139,8 @@ class NomadNetworkNode():
|
|||
self.node_name = owner.node_name
|
||||
self.announce_interval = owner.announce_interval
|
||||
self.last_announce = 0
|
||||
self.stamp_value = None
|
||||
self.link_cost = self.DEFAULT_LINK_COST
|
||||
self.null_ident = RNS.Identity.from_bytes(bytes(64))
|
||||
|
||||
self.templates = {}
|
||||
|
|
@ -175,8 +178,14 @@ class NomadNetworkNode():
|
|||
if self.owner.config["pages"].as_bool("unicode_icons"): self.use_nerdfonts = False
|
||||
if "media_conversion" in self.owner.config["pages"]:
|
||||
self.media_conversion = self.owner.config["pages"].as_bool("media_conversion")
|
||||
if "link_cost" in self.owner.config["pages"]:
|
||||
self.link_cost = RNS.Stamps.quantize_cost(self.owner.config["pages"].as_float("link_cost"))
|
||||
if "stamp_value" in self.owner.config["pages"]:
|
||||
self.stamp_value = RNS.Stamps.quantize_cost(self.owner.config["pages"].as_float("stamp_value"))
|
||||
|
||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, self.APP_NAME, "node")
|
||||
if self.stamp_value: self.destination.set_value(self.stamp_value)
|
||||
self.destination.set_link_cost(self.link_cost)
|
||||
self.destination.set_link_established_callback(self.remote_connected)
|
||||
self.destination.set_default_app_data(self.get_announce_app_data)
|
||||
self.register_request_handlers()
|
||||
|
|
|
|||
|
|
@ -1977,6 +1977,8 @@ class ReticulumGitNode():
|
|||
|
||||
CLONE_PROTOS = ["rns", "http", "https", "ssh"]
|
||||
|
||||
DEFAULT_LINK_COST = 18.0
|
||||
|
||||
def __init__(self, configdir=None, verbosity=None, print_identity=False):
|
||||
self.identity = None
|
||||
self.userdir = os.path.expanduser("~")
|
||||
|
|
@ -1989,6 +1991,8 @@ class ReticulumGitNode():
|
|||
self.blocked_identities = {}
|
||||
self.last_announce = 0
|
||||
self.announce_interval = 0
|
||||
self.stamp_value = None
|
||||
self.link_cost = self.DEFAULT_LINK_COST
|
||||
self.stats_enabled = False
|
||||
self.stats_job_interval = 180
|
||||
self.last_stats_job = time.time()
|
||||
|
|
@ -2059,6 +2063,8 @@ class ReticulumGitNode():
|
|||
exit(0)
|
||||
|
||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, APP_NAME, "repositories")
|
||||
if self.stamp_value: self.destination.set_value(self.stamp_value)
|
||||
self.destination.set_link_cost(self.link_cost)
|
||||
self.destination.set_link_established_callback(self.remote_connected)
|
||||
self.register_request_handlers()
|
||||
RNS.log(f"Reticulum Git Node listening on {RNS.prettyhexrep(self.destination.hash)}", RNS.LOG_NOTICE)
|
||||
|
|
@ -2205,6 +2211,8 @@ class ReticulumGitNode():
|
|||
section = self.config["rngit"]
|
||||
if "node_name" in section: self.node_name = section["node_name"]
|
||||
if "announce_interval" in section: self.announce_interval = section.as_int("announce_interval")*60
|
||||
if "stamp_value" in section: self.stamp_value = RNS.Stamps.quantize_cost(section.as_float("stamp_value"))
|
||||
if "link_cost" in section: self.link_cost = RNS.Stamps.quantize_cost(section.as_float("link_cost"))
|
||||
if "mirror_interval" in section: self.mirror_interval = max(section.as_int("mirror_interval")*60*60, 0)
|
||||
if "record_stats" in section: self.stats_enabled = section.as_bool("record_stats")
|
||||
if "stats_ignore_identities" in section:
|
||||
|
|
@ -4926,6 +4934,16 @@ announce_interval = 360
|
|||
|
||||
# node_name = Anonymous Git Node
|
||||
|
||||
# You can configure the required link stamp cost for
|
||||
# connecting to the repository node.
|
||||
|
||||
# link_cost = 18.0
|
||||
|
||||
# The target stamp value for the repositories destination
|
||||
# can also be configured.
|
||||
|
||||
# stamp_value = 25.0
|
||||
|
||||
# You can enable collecting view, fetch and push statistics
|
||||
# which can be displayed on the stats pages of repositories.
|
||||
# Remember to set the "s" (stats) permission appropriately
|
||||
|
|
@ -5044,6 +5062,16 @@ internal = rw:9710b86ba12c42d1d8f30f74fe509286
|
|||
|
||||
# serve_nomadnet = no
|
||||
|
||||
# You can configure the required link stamp cost for
|
||||
# connecting to the page node.
|
||||
|
||||
# link_cost = 18.0
|
||||
|
||||
# The target stamp value for the node destination can
|
||||
# also be configured.
|
||||
|
||||
# stamp_value = 25.0
|
||||
|
||||
# It is possible to disable Nerd Font icons and instead
|
||||
# use simpler (but more compatible) unicode icons.
|
||||
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ To enable the page node, add the following to your ``~/.rngit/config`` file:
|
|||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
serve_nomadnet = yes
|
||||
|
||||
When the page node is enabled, ``rngit`` will listen on a Nomad Network node destination in addition to the Git repository destination. You can view the destination hash by running:
|
||||
|
||||
|
|
@ -634,6 +634,15 @@ When the page node is enabled, ``rngit`` will listen on a Nomad Network node des
|
|||
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
||||
Nomad Network Destination : <50824b711717f97c2fb1166ceddd5ea9>
|
||||
|
||||
You can configure the destination stamp value and required link establishment cost with the following options:
|
||||
|
||||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
stamp_value = 25.0
|
||||
link_cost = 18.0
|
||||
|
||||
Accessing Repository Pages
|
||||
--------------------------
|
||||
|
||||
|
|
@ -717,8 +726,8 @@ By default, the page node uses Nerd Font icons. If you prefer simpler icons or y
|
|||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
|
||||
Repository Statistics
|
||||
---------------------
|
||||
|
|
@ -746,6 +755,8 @@ A complete node configuration might look like this:
|
|||
node_name = My Git Node
|
||||
announce_interval = 360
|
||||
record_stats = yes
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.5
|
||||
|
||||
[repositories]
|
||||
public = /var/git/public
|
||||
|
|
@ -758,6 +769,8 @@ A complete node configuration might look like this:
|
|||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = no
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.7
|
||||
|
||||
|
||||
Verified Releases
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ options:
|
|||
<h3>Enabling the Git Page Node<a class="headerlink" href="#enabling-the-git-page-node" title="Link to this heading">¶</a></h3>
|
||||
<p>To enable the page node, add the following to your <code class="docutils literal notranslate"><span class="pre">~/.rngit/config</span></code> file:</p>
|
||||
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>[pages]
|
||||
serve_nomadnet = yes
|
||||
serve_nomadnet = yes
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>When the page node is enabled, <code class="docutils literal notranslate"><span class="pre">rngit</span></code> will listen on a Nomad Network node destination in addition to the Git repository destination. You can view the destination hash by running:</p>
|
||||
|
|
@ -771,6 +771,13 @@ Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
|||
Nomad Network Destination : <50824b711717f97c2fb1166ceddd5ea9>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can configure the destination stamp value and required link establishment cost with the following options:</p>
|
||||
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>[pages]
|
||||
serve_nomadnet = yes
|
||||
stamp_value = 25.0
|
||||
link_cost = 18.0
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="accessing-repository-pages">
|
||||
<h3>Accessing Repository Pages<a class="headerlink" href="#accessing-repository-pages" title="Link to this heading">¶</a></h3>
|
||||
|
|
@ -838,8 +845,8 @@ def hello_world():
|
|||
<p><strong>Icon Sets</strong></p>
|
||||
<p>By default, the page node uses Nerd Font icons. If you prefer simpler icons or your terminal does not support Nerd Fonts, you can enable Unicode icons instead:</p>
|
||||
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -862,6 +869,8 @@ unicode_icons = yes
|
|||
node_name = My Git Node
|
||||
announce_interval = 360
|
||||
record_stats = yes
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.5
|
||||
|
||||
[repositories]
|
||||
public = /var/git/public
|
||||
|
|
@ -874,6 +883,8 @@ unicode_icons = yes
|
|||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = no
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.7
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -566,7 +566,7 @@ To enable the page node, add the following to your `~/.rngit/config` file:
|
|||
|
||||
```text
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
serve_nomadnet = yes
|
||||
```
|
||||
|
||||
When the page node is enabled, `rngit` will listen on a Nomad Network node destination in addition to the Git repository destination. You can view the destination hash by running:
|
||||
|
|
@ -580,6 +580,15 @@ Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
|||
Nomad Network Destination : <50824b711717f97c2fb1166ceddd5ea9>
|
||||
```
|
||||
|
||||
You can configure the destination stamp value and required link establishment cost with the following options:
|
||||
|
||||
```text
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
stamp_value = 25.0
|
||||
link_cost = 18.0
|
||||
```
|
||||
|
||||
### Accessing Repository Pages
|
||||
|
||||
Once the page node is running, you can access it from any Nomad Network client by connecting to the Nomad Network destination. The page node provides the following views:
|
||||
|
|
@ -659,8 +668,8 @@ By default, the page node uses Nerd Font icons. If you prefer simpler icons or y
|
|||
|
||||
```text
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
```
|
||||
|
||||
### Repository Statistics
|
||||
|
|
@ -686,6 +695,8 @@ A complete node configuration might look like this:
|
|||
node_name = My Git Node
|
||||
announce_interval = 360
|
||||
record_stats = yes
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.5
|
||||
|
||||
[repositories]
|
||||
public = /var/git/public
|
||||
|
|
@ -698,6 +709,8 @@ A complete node configuration might look like this:
|
|||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = no
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.7
|
||||
```
|
||||
|
||||
## Verified Releases
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ To enable the page node, add the following to your ``~/.rngit/config`` file:
|
|||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
serve_nomadnet = yes
|
||||
|
||||
When the page node is enabled, ``rngit`` will listen on a Nomad Network node destination in addition to the Git repository destination. You can view the destination hash by running:
|
||||
|
||||
|
|
@ -634,6 +634,15 @@ When the page node is enabled, ``rngit`` will listen on a Nomad Network node des
|
|||
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
||||
Nomad Network Destination : <50824b711717f97c2fb1166ceddd5ea9>
|
||||
|
||||
You can configure the destination stamp value and required link establishment cost with the following options:
|
||||
|
||||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
stamp_value = 25.0
|
||||
link_cost = 18.0
|
||||
|
||||
Accessing Repository Pages
|
||||
--------------------------
|
||||
|
||||
|
|
@ -717,8 +726,8 @@ By default, the page node uses Nerd Font icons. If you prefer simpler icons or y
|
|||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
|
||||
Repository Statistics
|
||||
---------------------
|
||||
|
|
@ -746,6 +755,8 @@ A complete node configuration might look like this:
|
|||
node_name = My Git Node
|
||||
announce_interval = 360
|
||||
record_stats = yes
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.5
|
||||
|
||||
[repositories]
|
||||
public = /var/git/public
|
||||
|
|
@ -758,6 +769,8 @@ A complete node configuration might look like this:
|
|||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = no
|
||||
stamp_value = 27.5
|
||||
link_cost = 18.7
|
||||
|
||||
|
||||
Verified Releases
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue