mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-12-17 14:54:26 +01:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f000073594 | ||
|
|
e332be6211 | ||
|
|
9ee052a122 | ||
|
|
11fda51017 | ||
|
|
d5cf34f9d9 | ||
|
|
d13c8af88e | ||
|
|
7cd025e236 | ||
|
|
c48a8d2a09 | ||
|
|
4fb97eecc5 | ||
|
|
74e7e4e806 | ||
|
|
01a5c21016 | ||
|
|
5e8a14d7a6 | ||
|
|
6edf531fbf | ||
|
|
eb3ff558c0 | ||
|
|
b5bf730e07 | ||
|
|
c52c49371b | ||
|
|
46eee79da2 | ||
|
|
bd909c9f58 | ||
|
|
c95fd83400 | ||
|
|
7d18a103cf | ||
|
|
00855c32a7 | ||
|
|
d8cfc69ac6 | ||
|
|
ccc41a5789 | ||
|
|
7b38d4f80e |
@@ -1,4 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import RNS
|
import RNS
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
@@ -159,7 +161,7 @@ class Node:
|
|||||||
try:
|
try:
|
||||||
if request_allowed:
|
if request_allowed:
|
||||||
RNS.log("Serving page: "+file_path, RNS.LOG_VERBOSE)
|
RNS.log("Serving page: "+file_path, RNS.LOG_VERBOSE)
|
||||||
if os.access(file_path, os.X_OK):
|
if not RNS.vendor.platformutils.is_windows() and os.access(file_path, os.X_OK):
|
||||||
env_map = {}
|
env_map = {}
|
||||||
if "PATH" in os.environ:
|
if "PATH" in os.environ:
|
||||||
env_map["PATH"] = os.environ["PATH"]
|
env_map["PATH"] = os.environ["PATH"]
|
||||||
|
|||||||
@@ -290,9 +290,20 @@ class NomadNetworkApp:
|
|||||||
|
|
||||||
self.directory = nomadnet.Directory(self)
|
self.directory = nomadnet.Directory(self)
|
||||||
|
|
||||||
|
static_peers = []
|
||||||
|
for static_peer in self.static_peers:
|
||||||
|
try:
|
||||||
|
dh = bytes.fromhex(static_peer)
|
||||||
|
if len(dh) != RNS.Reticulum.TRUNCATED_HASHLENGTH//8:
|
||||||
|
raise ValueError("Invalid destination length")
|
||||||
|
static_peers.append(dh)
|
||||||
|
except Exception as e:
|
||||||
|
RNS.log(f"Could not decode static peer destination hash {static_peer}: {e}", RNS.LOG_ERROR)
|
||||||
|
|
||||||
self.message_router = LXMF.LXMRouter(
|
self.message_router = LXMF.LXMRouter(
|
||||||
identity = self.identity, storagepath = self.storagepath, autopeer = True,
|
identity = self.identity, storagepath = self.storagepath, autopeer = True,
|
||||||
propagation_limit = self.lxmf_max_propagation_size, delivery_limit = self.lxmf_max_incoming_size,
|
propagation_limit = self.lxmf_max_propagation_size, delivery_limit = self.lxmf_max_incoming_size,
|
||||||
|
max_peers = self.max_peers, static_peers = static_peers,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.message_router.register_delivery_callback(self.lxmf_delivery)
|
self.message_router.register_delivery_callback(self.lxmf_delivery)
|
||||||
@@ -920,6 +931,19 @@ class NomadNetworkApp:
|
|||||||
else:
|
else:
|
||||||
self.prioritised_lxmf_destinations = []
|
self.prioritised_lxmf_destinations = []
|
||||||
|
|
||||||
|
if "static_peers" in self.config["node"]:
|
||||||
|
self.static_peers = self.config["node"].as_list("static_peers")
|
||||||
|
else:
|
||||||
|
self.static_peers = []
|
||||||
|
|
||||||
|
if not "max_peers" in self.config["node"]:
|
||||||
|
self.max_peers = None
|
||||||
|
else:
|
||||||
|
value = self.config["node"].as_int("max_peers")
|
||||||
|
if value < 0:
|
||||||
|
value = 0
|
||||||
|
self.max_peers = value
|
||||||
|
|
||||||
if not "message_storage_limit" in self.config["node"]:
|
if not "message_storage_limit" in self.config["node"]:
|
||||||
self.message_storage_limit = 2000
|
self.message_storage_limit = 2000
|
||||||
else:
|
else:
|
||||||
@@ -1136,13 +1160,15 @@ announce_interval = 360
|
|||||||
# Whether to announce when the node starts.
|
# Whether to announce when the node starts.
|
||||||
announce_at_start = Yes
|
announce_at_start = Yes
|
||||||
|
|
||||||
# By default, when Nomad Network is hosting a
|
# When Nomad Network is hosting a page-serving
|
||||||
# node, it will also act as an LXMF propagation
|
# node, it can also act as an LXMF propagation
|
||||||
# node. If there is already a large amount of
|
# node. If there is already a large amount of
|
||||||
# propagation nodes on the network, or you
|
# propagation nodes on the network, or you
|
||||||
# simply want to run a pageserving-only node,
|
# simply want to run a pageserving-only node,
|
||||||
# you can disable running a propagation node.
|
# you can disable running a propagation node.
|
||||||
# disable_propagation = False
|
# Due to lots of propagation nodes being
|
||||||
|
# available, this is currently the default.
|
||||||
|
disable_propagation = Yes
|
||||||
|
|
||||||
# The maximum amount of storage to use for
|
# The maximum amount of storage to use for
|
||||||
# the LXMF Propagation Node message store,
|
# the LXMF Propagation Node message store,
|
||||||
@@ -1176,9 +1202,16 @@ max_transfer_size = 256
|
|||||||
# and generally you do not need to use it.
|
# and generally you do not need to use it.
|
||||||
# prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf
|
# prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf
|
||||||
|
|
||||||
# Automatic rescan interval of the pages directory in minutes.
|
# You can configure the maximum number of other
|
||||||
# Default: int = 0 (no rescan)
|
# propagation nodes that this node will peer
|
||||||
page_refresh_interval = 0
|
# with automatically. The default is 50.
|
||||||
|
# max_peers = 25
|
||||||
|
|
||||||
|
# You can configure a list of static propagation
|
||||||
|
# node peers, that this node will always be
|
||||||
|
# peered with, by specifying a list of
|
||||||
|
# destination hashes.
|
||||||
|
# static_peers = e17f833c4ddf8890dd3a79a6fea8161d, 5a2d0029b6e5ec87020abaea0d746da4
|
||||||
|
|
||||||
# You can specify the interval in minutes for
|
# You can specify the interval in minutes for
|
||||||
# rescanning the hosted pages path. By default,
|
# rescanning the hosted pages path. By default,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "0.5.5"
|
__version__ = "0.6.0"
|
||||||
|
|||||||
@@ -666,9 +666,9 @@ Determines the interval in minutes for rescanning the hosted files path. By defa
|
|||||||
<
|
<
|
||||||
|
|
||||||
>>>
|
>>>
|
||||||
`!disable_propagation = no`!
|
`!disable_propagation = yes`!
|
||||||
>>>>
|
>>>>
|
||||||
By default, when Nomad Network is hosting a node, it will also run an LXMF propagation node. If there is already a large amount of propagation nodes on the network, or you simply want to run a pageserving-only node, you can disable running a propagation node.
|
When Nomad Network is hosting a node, it can also run an LXMF propagation node. If there is already a large amount of propagation nodes on the network, or you simply want to run a pageserving-only node, you can disable running a propagation node.
|
||||||
<
|
<
|
||||||
|
|
||||||
>>>
|
>>>
|
||||||
@@ -689,6 +689,18 @@ The maximum accepted transfer size per incoming propagation transfer, in kilobyt
|
|||||||
Configures the LXMF Propagation Node to prioritise storing messages for certain destinations. If the message store reaches the specified limit, LXMF will prioritise keeping messages for destinations specified with this option. This setting is optional, and generally you do not need to use it.
|
Configures the LXMF Propagation Node to prioritise storing messages for certain destinations. If the message store reaches the specified limit, LXMF will prioritise keeping messages for destinations specified with this option. This setting is optional, and generally you do not need to use it.
|
||||||
<
|
<
|
||||||
|
|
||||||
|
>>>
|
||||||
|
`!max_peers = 25`!
|
||||||
|
>>>>
|
||||||
|
Configures the maximum number of other nodes the LXMF Propagation Node will automatically peer with. The default is 50, but can be lowered or increased according to available resources.
|
||||||
|
<
|
||||||
|
|
||||||
|
>>>
|
||||||
|
`!static_peers = e17f833c4ddf8890dd3a79a6fea8161d, 5a2d0029b6e5ec87020abaea0d746da4`!
|
||||||
|
>>>>
|
||||||
|
Configures the LXMF Propagation Node to always maintain propagation node peering with the specified list of destination hashes.
|
||||||
|
<
|
||||||
|
|
||||||
>> Printing Section
|
>> Printing Section
|
||||||
|
|
||||||
This section holds configuration directives related to printing. It is delimited by the `![printing]`! header in the configuration file. Available directives, along with example values, are as follows:
|
This section holds configuration directives related to printing. It is delimited by the `![printing]`! header in the configuration file. Available directives, along with example values, are as follows:
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ def parse_line(line, state, url_delegate):
|
|||||||
fn = o["name"]
|
fn = o["name"]
|
||||||
fs = o["style"]
|
fs = o["style"]
|
||||||
fmask = "*" if o["masked"] else None
|
fmask = "*" if o["masked"] else None
|
||||||
f = urwid.Edit(caption="", edit_text=fd, align=state["align"], multiline=False, mask=fmask)
|
f = urwid.Edit(caption="", edit_text=fd, align=state["align"], multiline=True, mask=fmask)
|
||||||
f.field_name = fn
|
f.field_name = fn
|
||||||
fa = urwid.AttrMap(f, fs)
|
fa = urwid.AttrMap(f, fs)
|
||||||
widgets.append((fw, fa))
|
widgets.append((fw, fa))
|
||||||
|
|||||||
@@ -1594,10 +1594,10 @@ class NetworkDisplay():
|
|||||||
if self.list_display == 1:
|
if self.list_display == 1:
|
||||||
parent = self.app.ui.main_display.sub_displays.network_display
|
parent = self.app.ui.main_display.sub_displays.network_display
|
||||||
selected_node_entry = parent.known_nodes_display.ilb.get_selected_item()
|
selected_node_entry = parent.known_nodes_display.ilb.get_selected_item()
|
||||||
if selected_node_entry != None:
|
if selected_node_entry is not None:
|
||||||
selected_node_hash = selected_node_entry._get_base_widget().display_widget.source_hash
|
selected_node_hash = selected_node_entry.base_widget.display_widget.source_hash
|
||||||
|
|
||||||
if selected_node_hash != None:
|
if selected_node_hash is not None:
|
||||||
info_widget = KnownNodeInfo(selected_node_hash)
|
info_widget = KnownNodeInfo(selected_node_hash)
|
||||||
options = parent.left_pile.options(height_type=urwid.WEIGHT, height_amount=1)
|
options = parent.left_pile.options(height_type=urwid.WEIGHT, height_amount=1)
|
||||||
parent.left_pile.contents[0] = (info_widget, options)
|
parent.left_pile.contents[0] = (info_widget, options)
|
||||||
@@ -1753,7 +1753,7 @@ class LXMFPeers(urwid.WidgetWrap):
|
|||||||
|
|
||||||
def make_peer_widgets(self):
|
def make_peer_widgets(self):
|
||||||
widget_list = []
|
widget_list = []
|
||||||
sorted_peers = sorted(self.peer_list, key=lambda pid: (self.app.directory.pn_trust_level(pid), self.peer_list[pid].link_establishment_rate), reverse=True)
|
sorted_peers = sorted(self.peer_list, key=lambda pid: (self.app.directory.pn_trust_level(pid), self.peer_list[pid].sync_transfer_rate), reverse=True)
|
||||||
for peer_id in sorted_peers:
|
for peer_id in sorted_peers:
|
||||||
peer = self.peer_list[peer_id]
|
peer = self.peer_list[peer_id]
|
||||||
trust_level = self.app.directory.pn_trust_level(peer_id)
|
trust_level = self.app.directory.pn_trust_level(peer_id)
|
||||||
@@ -1797,7 +1797,15 @@ class LXMFPeerEntry(urwid.WidgetWrap):
|
|||||||
style = "list_unresponsive"
|
style = "list_unresponsive"
|
||||||
focus_style = "list_focus_unresponsive"
|
focus_style = "list_focus_unresponsive"
|
||||||
|
|
||||||
widget = ListEntry(sym+" "+display_str+"\n "+alive_string+", last heard "+pretty_date(int(peer.last_heard))+"\n "+str(len(peer.unhandled_messages))+" unhandled LXMs, "+RNS.prettysize(peer.link_establishment_rate/8, "b")+"/s LER")
|
if peer.propagation_transfer_limit:
|
||||||
|
txfer_limit = RNS.prettysize(peer.propagation_transfer_limit*1000)
|
||||||
|
else:
|
||||||
|
txfer_limit = "No"
|
||||||
|
peer_info_str = sym+" "+display_str+"\n "+alive_string+", last heard "+pretty_date(int(peer.last_heard))
|
||||||
|
peer_info_str += "\n "+str(peer.unhandled_message_count)+f" unhandled LXMs, {txfer_limit} sync limit\n"
|
||||||
|
peer_info_str += f" {RNS.prettyspeed(peer.sync_transfer_rate)} STR, "
|
||||||
|
peer_info_str += f"{RNS.prettyspeed(peer.link_establishment_rate)} LER\n"
|
||||||
|
widget = ListEntry(peer_info_str)
|
||||||
self.display_widget = urwid.AttrMap(widget, style, focus_style)
|
self.display_widget = urwid.AttrMap(widget, style, focus_style)
|
||||||
self.display_widget.destination_hash = destination_hash
|
self.display_widget.destination_hash = destination_hash
|
||||||
super().__init__(self.display_widget)
|
super().__init__(self.display_widget)
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -30,6 +30,6 @@ setuptools.setup(
|
|||||||
entry_points= {
|
entry_points= {
|
||||||
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
||||||
},
|
},
|
||||||
install_requires=["rns>=0.8.7", "lxmf>=0.5.8", "urwid>=2.4.4", "qrcode"],
|
install_requires=["rns>=0.9.1", "lxmf>=0.6.1", "urwid>=2.6.16", "qrcode"],
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.7",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user