mirror of
https://github.com/markqvist/LXMF
synced 2026-11-22 23:10:36 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8ba024832 | ||
|
|
5745f85647 | ||
|
|
c3ff2d6dc2 | ||
|
|
aa7137d840 | ||
|
|
247008105a | ||
|
|
3fc60af1ab | ||
|
|
3290c4e63d | ||
|
|
599bb67080 | ||
|
|
db2bd9e0e5 | ||
|
|
e52016c20f | ||
|
|
6fb5a366b1 | ||
|
|
43a077b291 | ||
|
|
170e71d5a9 | ||
|
|
beac6bcd1c | ||
|
|
acaa9e30ed | ||
|
|
fbc821ebb9 | ||
|
|
0889401ca1 | ||
|
|
1dc8097212 | ||
|
|
41cdce67c1 | ||
|
|
c939e25361 | ||
|
|
da1b9c0e08 | ||
|
|
795fdaa2b0 | ||
|
|
7bb4bcfbc8 | ||
|
|
d909619eb1 | ||
|
|
5769d46389 | ||
|
|
3e2cd361af | ||
|
|
241b29cc92 | ||
|
|
ca02fa5221 | ||
|
|
982c9fc743 | ||
|
|
4a93697511 | ||
|
|
548be107c8 | ||
|
|
8395793bad | ||
|
|
fb0fd24c98 | ||
|
|
fab12ad9bf | ||
|
|
a29c4a0e17 | ||
|
|
20864133a3 | ||
|
|
c877efaec1 | ||
|
|
11b2480223 |
No files matched your search
@@ -1,11 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: ✨ Feature Request or Idea
|
||||
url: https://github.com/markqvist/Reticulum/discussions/new?category=ideas
|
||||
about: Propose and discuss features and ideas
|
||||
- name: 💬 Questions, Help & Discussion
|
||||
about: Ask anything, or get help
|
||||
url: https://github.com/markqvist/Reticulum/discussions/new/choose
|
||||
- name: 📖 Read the Reticulum Manual
|
||||
url: https://markqvist.github.io/Reticulum/manual/
|
||||
about: The complete documentation for Reticulum
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
name: "\U0001F41B Bug Report"
|
||||
about: Report a reproducible bug
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Read the Contribution Guidelines**
|
||||
Before creating a bug report on this issue tracker, you **must** read the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md). Issues that do not follow the contribution guidelines **will be deleted without comment**.
|
||||
|
||||
- The issue tracker is used by developers of this project. **Do not use it to ask general questions, or for support requests**.
|
||||
- Ideas and feature requests can be made on the [Discussions](https://github.com/markqvist/Reticulum/discussions). **Only** feature requests accepted by maintainers and developers are tracked and included on the issue tracker. **Do not post feature requests here**.
|
||||
- After reading the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md), **delete this section only** (*"Read the Contribution Guidelines"*) from your bug report, **and fill in all the other sections**.
|
||||
|
||||
**Describe the Bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Describe in detail how to reproduce the bug.
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logs & Screenshots**
|
||||
Please include any relevant log output. If applicable, also add screenshots to help explain your problem.
|
||||
|
||||
**System Information**
|
||||
- OS and version
|
||||
- Python version
|
||||
- Program version
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
+2
-2
@@ -22,7 +22,7 @@ class LXMFDeliveryAnnounceHandler:
|
||||
|
||||
for lxmessage in self.lxmrouter.pending_outbound:
|
||||
if destination_hash == lxmessage.destination_hash:
|
||||
if lxmessage.method == LXMessage.DIRECT or lxmessage.method == LXMessage.OPPORTUNISTIC:
|
||||
if (lxmessage.method == LXMessage.DIRECT or lxmessage.method == LXMessage.OPPORTUNISTIC) and lxmessage.awaiting_path:
|
||||
lxmessage.next_delivery_attempt = time.time()
|
||||
|
||||
def outbound_trigger():
|
||||
@@ -44,7 +44,7 @@ class LXMFPropagationAnnounceHandler:
|
||||
if destination_hash == self.lxmrouter.get_outbound_propagation_node():
|
||||
if pn_announce_data_is_valid(app_data):
|
||||
for lxmessage in self.lxmrouter.pending_outbound:
|
||||
if lxmessage.method == LXMessage.PROPAGATED:
|
||||
if lxmessage.method == LXMessage.PROPAGATED and lxmessage.awaiting_path:
|
||||
lxmessage.next_delivery_attempt = time.time()
|
||||
|
||||
def outbound_trigger():
|
||||
|
||||
+2
-1
@@ -135,6 +135,7 @@ PN_META_SYNC_STRATUM = 0x02
|
||||
PN_META_SYNC_THROTTLE = 0x03
|
||||
PN_META_AUTH_BAND = 0x04
|
||||
PN_META_UTIL_PRESSURE = 0x05
|
||||
PN_META_IMPL_NAME = 0xFE
|
||||
PN_META_CUSTOM = 0xFF
|
||||
|
||||
# Supported functionality codes for signalling
|
||||
@@ -165,7 +166,7 @@ def display_name_from_app_data(app_data=None):
|
||||
decoded = dn.decode("utf-8").replace("\x00", "").strip()
|
||||
return decoded
|
||||
except Exception as e:
|
||||
RNS.log(f"Could not decode display name in included announce data. The contained exception was: {e}", RNS.LOG_ERROR)
|
||||
RNS.log(f"Could not decode display name in included announce data. The contained exception was: {e}", RNS.LOG_EXTREME)
|
||||
return None
|
||||
|
||||
# Original announce format
|
||||
|
||||
+12
-5
@@ -294,11 +294,14 @@ class LXMPeer:
|
||||
else:
|
||||
if not RNS.Transport.has_path(self.destination_hash):
|
||||
RNS.log("No path to peer "+RNS.prettyhexrep(self.destination_hash)+" exists, requesting...", RNS.LOG_DEBUG)
|
||||
RNS.Transport.request_path(self.destination_hash)
|
||||
self.router.request_path(self.destination_hash)
|
||||
time.sleep(LXMPeer.PATH_REQUEST_GRACE)
|
||||
|
||||
if not RNS.Transport.has_path(self.destination_hash):
|
||||
RNS.log("Path request was not answered, retrying sync with peer "+RNS.prettyhexrep(self.destination_hash)+" later", RNS.LOG_DEBUG)
|
||||
self.sync_backoff += LXMPeer.SYNC_BACKOFF_STEP
|
||||
self.next_sync_attempt = time.time() + self.sync_backoff
|
||||
self.alive = False
|
||||
RNS.log(f"Path request was not answered, retrying sync with peer {RNS.prettyhexrep(self.destination_hash)} later", RNS.LOG_DEBUG)
|
||||
|
||||
else:
|
||||
if self.identity == None:
|
||||
@@ -328,7 +331,7 @@ class LXMPeer:
|
||||
self.alive = True
|
||||
self.last_heard = time.time()
|
||||
self.sync_backoff = 0
|
||||
min_accepted_cost = min(0, self.propagation_stamp_cost-self.propagation_stamp_cost_flexibility)
|
||||
min_accepted_cost = max(0, self.propagation_stamp_cost-self.propagation_stamp_cost_flexibility)
|
||||
|
||||
RNS.log("Synchronisation link to peer "+RNS.prettyhexrep(self.destination_hash)+" established, preparing sync offer...", RNS.LOG_DEBUG)
|
||||
unhandled_entries = []
|
||||
@@ -378,9 +381,13 @@ class LXMPeer:
|
||||
cumulative_size += lxm_transfer_size
|
||||
unhandled_ids.append(transient_id)
|
||||
|
||||
if len(unhandled_ids) == 0:
|
||||
RNS.log(f"Sync requested for {self}, but no unhandled messages exist after offer preparation. Sync complete.", RNS.LOG_DEBUG)
|
||||
return
|
||||
|
||||
offer = [self.peering_key[0], unhandled_ids]
|
||||
|
||||
RNS.log(f"Offering {len(unhandled_ids)} messages to peer {RNS.prettyhexrep(self.destination.hash)} ({RNS.prettysize(len(msgpack.packb(unhandled_ids)))})", RNS.LOG_VERBOSE)
|
||||
RNS.log(f"Offering {len(unhandled_ids)} messages to peer {RNS.prettyhexrep(self.destination.hash)}", RNS.LOG_VERBOSE)
|
||||
self.last_offer = unhandled_ids
|
||||
self.link.request(LXMPeer.OFFER_REQUEST_PATH, offer, response_callback=self.offer_response, failed_callback=self.request_failed)
|
||||
self.state = LXMPeer.REQUEST_SENT
|
||||
@@ -404,7 +411,7 @@ class LXMPeer:
|
||||
if response == LXMPeer.ERROR_NO_IDENTITY:
|
||||
if self.link != None:
|
||||
RNS.log("Remote peer indicated that no identification was received, retrying...", RNS.LOG_VERBOSE)
|
||||
self.link.identify()
|
||||
self.link.identify(self.router.identity)
|
||||
self.state = LXMPeer.LINK_READY
|
||||
self.sync()
|
||||
return
|
||||
|
||||
+486
-167
File diff suppressed because it is too large.
Load diff
+29
-7
@@ -64,8 +64,8 @@ class LXMessage:
|
||||
|
||||
# With an MTU of 500, the maximum amount of data
|
||||
# we can send in a single encrypted packet is
|
||||
# 391 bytes.
|
||||
ENCRYPTED_PACKET_MDU = RNS.Packet.ENCRYPTED_MDU + TIMESTAMP_SIZE
|
||||
# 383 bytes.
|
||||
ENCRYPTED_PACKET_MDU = RNS.Packet.ENCRYPTED_MDU
|
||||
|
||||
# The max content length we can fit in LXMF message
|
||||
# inside a single RNS packet is the encrypted MDU, minus
|
||||
@@ -74,7 +74,7 @@ class LXMessage:
|
||||
# field of the packet, therefore we also add the length
|
||||
# of a destination hash to the calculation. With default
|
||||
# RNS and LXMF parameters, the largest single-packet
|
||||
# LXMF message we can send is 295 bytes. If a message
|
||||
# LXMF message we can send is 287 bytes. If a message
|
||||
# is larger than that, a Reticulum link will be used.
|
||||
ENCRYPTED_PACKET_MAX_CONTENT = ENCRYPTED_PACKET_MDU - LXMF_OVERHEAD + DESTINATION_LENGTH
|
||||
|
||||
@@ -95,7 +95,7 @@ class LXMessage:
|
||||
PLAIN_PACKET_MAX_CONTENT = PLAIN_PACKET_MDU - LXMF_OVERHEAD + DESTINATION_LENGTH
|
||||
|
||||
# Descriptive strings regarding transport encryption
|
||||
ENCRYPTION_DESCRIPTION_AES = "AES-128"
|
||||
ENCRYPTION_DESCRIPTION_AES = "AES-256"
|
||||
ENCRYPTION_DESCRIPTION_EC = "Curve25519"
|
||||
ENCRYPTION_DESCRIPTION_UNENCRYPTED = "Unencrypted"
|
||||
|
||||
@@ -177,6 +177,11 @@ class LXMessage:
|
||||
self.representation = LXMessage.UNKNOWN
|
||||
self.desired_method = desired_method
|
||||
self.delivery_attempts = 0
|
||||
|
||||
self.sent_on_path = False
|
||||
self.awaiting_path = False
|
||||
self.max_delivery_attempts = None
|
||||
|
||||
self.transport_encrypted = False
|
||||
self.transport_encryption = None
|
||||
self.ratchet_id = None
|
||||
@@ -187,6 +192,8 @@ class LXMessage:
|
||||
self.__pn_encrypted_data = None
|
||||
self.__persist_lock = Lock()
|
||||
self.failed_callback = None
|
||||
self.receipt_timeout = None
|
||||
self.concluded_callback = None
|
||||
|
||||
self.deferred_stamp_generating = False
|
||||
|
||||
@@ -466,10 +473,15 @@ class LXMessage:
|
||||
|
||||
if self.method == LXMessage.OPPORTUNISTIC:
|
||||
lxm_packet = self.__as_packet()
|
||||
lxm_packet.send().set_delivery_callback(self.__mark_delivered)
|
||||
receipt = lxm_packet.send()
|
||||
self.progress = 0.50
|
||||
self.ratchet_id = lxm_packet.ratchet_id
|
||||
self.state = LXMessage.SENT
|
||||
if receipt:
|
||||
receipt.set_delivery_callback(self.__mark_delivered)
|
||||
if self.receipt_timeout: receipt.set_timeout(max(receipt.timeout, self.receipt_timeout))
|
||||
if receipt.status == RNS.PacketReceipt.DELIVERED: self.__mark_delivered(receipt)
|
||||
else: RNS.log(f"No receipt generated on sent opportunistic {self}", RNS.LOG_WARNING)
|
||||
|
||||
elif self.method == LXMessage.DIRECT:
|
||||
self.state = LXMessage.SENDING
|
||||
@@ -479,12 +491,14 @@ class LXMessage:
|
||||
receipt = lxm_packet.send()
|
||||
self.ratchet_id = self.__delivery_destination.link_id
|
||||
if receipt:
|
||||
self.progress = 0.50
|
||||
receipt.set_delivery_callback(self.__mark_delivered)
|
||||
receipt.set_timeout_callback(self.__link_packet_timed_out)
|
||||
self.progress = 0.50
|
||||
if receipt.status == RNS.PacketReceipt.DELIVERED: self.__mark_delivered(receipt)
|
||||
else:
|
||||
if self.__delivery_destination:
|
||||
self.__delivery_destination.teardown()
|
||||
self.state = LXMessage.OUTBOUND
|
||||
|
||||
elif self.representation == LXMessage.RESOURCE:
|
||||
self.resource_representation = self.__as_resource()
|
||||
@@ -497,11 +511,13 @@ class LXMessage:
|
||||
if self.representation == LXMessage.PACKET:
|
||||
receipt = self.__as_packet().send()
|
||||
if receipt:
|
||||
self.progress = 0.50
|
||||
receipt.set_delivery_callback(self.__mark_propagated)
|
||||
receipt.set_timeout_callback(self.__link_packet_timed_out)
|
||||
self.progress = 0.50
|
||||
if receipt.status == RNS.PacketReceipt.DELIVERED: self.__mark_propagated(receipt)
|
||||
else:
|
||||
self.__delivery_destination.teardown()
|
||||
self.state = LXMessage.OUTBOUND
|
||||
|
||||
elif self.representation == LXMessage.RESOURCE:
|
||||
self.resource_representation = self.__as_resource()
|
||||
@@ -559,10 +575,13 @@ class LXMessage:
|
||||
self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED
|
||||
|
||||
def __mark_delivered(self, receipt = None):
|
||||
if self.state == LXMessage.DELIVERED: return
|
||||
RNS.log("Received delivery notification for "+str(self), RNS.LOG_DEBUG)
|
||||
self.state = LXMessage.DELIVERED
|
||||
self.progress = 1.0
|
||||
|
||||
if self.concluded_callback != None and callable(self.concluded_callback): self.concluded_callback(self)
|
||||
|
||||
if self.__delivery_callback != None and callable(self.__delivery_callback):
|
||||
try:
|
||||
self.__delivery_callback(self)
|
||||
@@ -571,10 +590,13 @@ class LXMessage:
|
||||
RNS.trace_exception(e)
|
||||
|
||||
def __mark_propagated(self, receipt = None):
|
||||
if self.state == LXMessage.SENT: return
|
||||
RNS.log("Received propagation success notification for "+str(self), RNS.LOG_DEBUG)
|
||||
self.state = LXMessage.SENT
|
||||
self.progress = 1.0
|
||||
|
||||
if self.concluded_callback != None and callable(self.concluded_callback): self.concluded_callback(self)
|
||||
|
||||
if self.__delivery_callback != None and callable(self.__delivery_callback):
|
||||
try:
|
||||
self.__delivery_callback(self)
|
||||
|
||||
+135
-8
@@ -87,12 +87,17 @@ def apply_config():
|
||||
else:
|
||||
active_configuration["peer_announce_interval"] = None
|
||||
|
||||
if "lxmf" in lxmd_config and "stamp_cost" in lxmd_config["lxmf"]:
|
||||
active_configuration["peer_stamp_cost"] = max(1, lxmd_config["lxmf"].as_int("stamp_cost"))
|
||||
else:
|
||||
active_configuration["peer_stamp_cost"] = 12
|
||||
|
||||
if "lxmf" in lxmd_config and "delivery_transfer_max_accepted_size" in lxmd_config["lxmf"]:
|
||||
active_configuration["delivery_transfer_max_accepted_size"] = lxmd_config["lxmf"].as_float("delivery_transfer_max_accepted_size")
|
||||
if active_configuration["delivery_transfer_max_accepted_size"] < 0.38:
|
||||
active_configuration["delivery_transfer_max_accepted_size"] = 0.38
|
||||
else:
|
||||
active_configuration["delivery_transfer_max_accepted_size"] = 1000
|
||||
active_configuration["delivery_transfer_max_accepted_size"] = 1
|
||||
|
||||
if "lxmf" in lxmd_config and "on_inbound" in lxmd_config["lxmf"]:
|
||||
active_configuration["on_inbound"] = lxmd_config["lxmf"]["on_inbound"]
|
||||
@@ -130,6 +135,21 @@ def apply_config():
|
||||
else:
|
||||
active_configuration["autopeer_maxdepth"] = None
|
||||
|
||||
if "propagation" in lxmd_config and "sequential_pn_stamp_validation" in lxmd_config["propagation"]:
|
||||
active_configuration["sequential_pn_stamp_validation"] = lxmd_config["propagation"].as_bool("sequential_pn_stamp_validation")
|
||||
else:
|
||||
active_configuration["sequential_pn_stamp_validation"] = True
|
||||
|
||||
if "propagation" in lxmd_config and "static_peers_bypass_sequential" in lxmd_config["propagation"]:
|
||||
active_configuration["static_peers_bypass_sequential"] = lxmd_config["propagation"].as_bool("static_peers_bypass_sequential")
|
||||
else:
|
||||
active_configuration["static_peers_bypass_sequential"] = True
|
||||
|
||||
if "propagation" in lxmd_config and "max_inbound_syncs" in lxmd_config["propagation"]:
|
||||
active_configuration["max_inbound_syncs"] = max(1, lxmd_config["propagation"].as_int("max_inbound_syncs"))
|
||||
else:
|
||||
active_configuration["max_inbound_syncs"] = 3
|
||||
|
||||
if "propagation" in lxmd_config and "announce_interval" in lxmd_config["propagation"]:
|
||||
active_configuration["node_announce_interval"] = lxmd_config["propagation"].as_int("announce_interval")*60
|
||||
else:
|
||||
@@ -285,8 +305,7 @@ def lxmf_delivery(lxm):
|
||||
processing_command = command+" \""+written_path+"\""
|
||||
return_code = subprocess.call(shlex.split(processing_command), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
else:
|
||||
RNS.log("No action defined for inbound messages, ignoring", RNS.LOG_DEBUG)
|
||||
else: RNS.log("No action defined for inbound messages, ignoring", RNS.LOG_DEBUG)
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("Error occurred while processing received message "+str(lxm)+". The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
@@ -383,6 +402,9 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
|
||||
propagation_limit = active_configuration["propagation_transfer_max_accepted_size"],
|
||||
propagation_cost = active_configuration["propagation_stamp_cost_target"],
|
||||
propagation_cost_flexibility = active_configuration["propagation_stamp_cost_flexibility"],
|
||||
sequential_validation = active_configuration["sequential_pn_stamp_validation"],
|
||||
static_sequential = not active_configuration["static_peers_bypass_sequential"],
|
||||
max_inbound_syncs = active_configuration["max_inbound_syncs"],
|
||||
peering_cost = active_configuration["peering_cost"],
|
||||
max_peering_cost = active_configuration["remote_peering_cost_max"],
|
||||
sync_limit = active_configuration["propagation_sync_max_accepted_size"],
|
||||
@@ -397,7 +419,8 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
|
||||
for destination_hash in active_configuration["ignored_lxmf_destinations"]:
|
||||
message_router.ignore_destination(destination_hash)
|
||||
|
||||
lxmf_destination = message_router.register_delivery_identity(identity, display_name=active_configuration["display_name"])
|
||||
lxmf_destination = message_router.register_delivery_identity(identity, display_name=active_configuration["display_name"],
|
||||
stamp_cost=active_configuration["peer_stamp_cost"])
|
||||
|
||||
RNS.Identity.remember(
|
||||
packet_hash=None,
|
||||
@@ -770,7 +793,7 @@ def get_status(remote=None, configdir=None, rnsconfigdir=None, verbosity=0, quie
|
||||
srxb = RNS.prettysize(p["rx_bytes"]); stxb = RNS.prettysize(p["tx_bytes"]); pmo = pm["offered"]; pmout = pm["outgoing"]
|
||||
pmi = pm["incoming"]; pmuh = pm["unhandled"]; ar = round(p["acceptance_rate"]*100, 2)
|
||||
if p["name"] == None: nn = ""
|
||||
else: nn = p["name"].strip().replace("\n", "").replace("\r", "")
|
||||
else: nn = sanitize_name(p["name"])
|
||||
if len(nn) > 45: nn = f"{nn[:45]}..."
|
||||
print(f"{ind}{t}{RNS.prettyhexrep(peer_id)}")
|
||||
if len(nn): print(f"{ind*2}Name : {nn}")
|
||||
@@ -1060,6 +1083,33 @@ autopeer_maxdepth = 6
|
||||
|
||||
# from_static_only = True
|
||||
|
||||
# By default, stamp validation jobs for PN
|
||||
# sync batches will run sequentially. If
|
||||
# a peer offers messages while another batch
|
||||
# is already processing, it will receive a
|
||||
# throttle response to indicate that it can
|
||||
# retry later. If you have a fast system, you
|
||||
# can disable this to accept and validate
|
||||
# everything as soon as it is offered.
|
||||
|
||||
# sequential_pn_stamp_validation = yes
|
||||
|
||||
# You can configure whether static peers are
|
||||
# allowed have their PN syncs processed as
|
||||
# soon as they are offered, regardless of
|
||||
# whether another batch is already validating.
|
||||
|
||||
# static_peers_bypass_sequential = yes
|
||||
|
||||
# You can configure how many concurrent inbound
|
||||
# propagation sync transfers will be accepted.
|
||||
# Once this number is reached, nodes offering
|
||||
# messages will receive a throttle response to
|
||||
# indicate that they can retry later. On a slow
|
||||
# system, it's a good idea to change this to 1.
|
||||
|
||||
# max_inbound_syncs = 3
|
||||
|
||||
# By default, any destination is allowed to
|
||||
# connect and download messages, but you can
|
||||
# optionally restrict this. If you enable
|
||||
@@ -1089,13 +1139,18 @@ announce_at_start = no
|
||||
|
||||
# announce_interval = 360
|
||||
|
||||
# You can configure the required stamp cost for
|
||||
# incoming messages.
|
||||
|
||||
# stamp_cost = 12
|
||||
|
||||
# The maximum accepted unpacked size for mes-
|
||||
# sages received directly from other peers,
|
||||
# specified in kilobytes. Messages larger than
|
||||
# this will be rejected before the transfer
|
||||
# begins.
|
||||
|
||||
delivery_transfer_max_accepted_size = 1000
|
||||
delivery_transfer_max_accepted_size = 1
|
||||
|
||||
# You can configure an external program to be run
|
||||
# every time a message is received. The program
|
||||
@@ -1122,5 +1177,77 @@ loglevel = 4
|
||||
|
||||
"""
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
import re
|
||||
import unicodedata
|
||||
STRIP_BLOCKS_RE = re.compile(
|
||||
'['
|
||||
'\U0001F600-\U0001F64F' # Emoticons
|
||||
'\U0001F300-\U0001F5FF' # Misc Symbols & Pictographs
|
||||
'\U0001F680-\U0001F6FF' # Transport & Map Symbols
|
||||
'\U0001F700-\U0001F77F' # Alchemical Symbols
|
||||
'\U0001F780-\U0001F7FF' # Geometric Shapes Extended
|
||||
'\U0001F800-\U0001F8FF' # Supplemental Arrows-C
|
||||
'\U0001F900-\U0001F9FF' # Supplemental Symbols & Pictographs
|
||||
'\U0001FA00-\U0001FA6F' # Chess Symbols
|
||||
'\U0001FA70-\U0001FAFF' # Symbols & Pictographs Extended-A
|
||||
'\U0001F1E0-\U0001F1FF' # Flags (iOS/regional indicators)
|
||||
'\u2600-\u26FF' # Misc Symbols (☀, ☁, ☂, etc.)
|
||||
'\u2700-\u27BF' # Dingbats (✂, ✈, ✉, etc.)
|
||||
'\uFE00-\uFE0F' # Variation Selectors
|
||||
'\U000E0100-\U000E01EF' # Variation Selectors Supplement
|
||||
'\U0001F3FB-\U0001F3FF' # Emoji modifiers (skin tones)
|
||||
']+',
|
||||
flags=re.UNICODE
|
||||
)
|
||||
|
||||
STRIP_CONTROL_RE = re.compile(
|
||||
'['
|
||||
'\x00-\x08' # C0 controls (NUL-BS)
|
||||
'\x0B\x0C' # VT, FF
|
||||
'\x0E-\x1F' # C0 controls (SO-US)
|
||||
'\x7F-\x9F' # DEL and C1 controls
|
||||
'\u200B-\u200F' # Zero-width chars, LRM, RLM, etc.
|
||||
'\u202A-\u202E' # Bidi embedding controls
|
||||
'\u2060-\u206F' # Format chars (word joiner, etc.)
|
||||
'\uFEFF' # BOM / Zero Width NBSP
|
||||
'\uFFF0-\uFFF8' # Specials
|
||||
']+',
|
||||
flags=re.UNICODE
|
||||
)
|
||||
|
||||
STRIP_PRIVATE_RE = re.compile(
|
||||
'['
|
||||
'\uD800-\uDFFF' # Surrogates
|
||||
'\uE000-\uF8FF' # Private Use Area
|
||||
'\uF900-\uFAFF' # CJK Compatibility Ideographs (keep? strip for safety)
|
||||
'\uFE10-\uFE1F' # Vertical Forms
|
||||
'\uFE20-\uFE2F' # Combining Half Marks
|
||||
'\U000F0000-\U000FFFFF' # Supplementary Private Use Area-A
|
||||
'\U00100000-\U0010FFFF' # Supplementary Private Use Area-B
|
||||
']+',
|
||||
flags=re.UNICODE
|
||||
)
|
||||
|
||||
def sanitize_name(name):
|
||||
if name is None: return None
|
||||
name = str(name)
|
||||
name = unicodedata.normalize('NFKC', name)
|
||||
result = []
|
||||
for char in name:
|
||||
cat = unicodedata.category(char)
|
||||
cat_prefix = cat[0] if cat else 'C'
|
||||
if cat_prefix in ('L', 'N', 'P'): result.append(char)
|
||||
elif cat == 'Zs': result.append(' ')
|
||||
elif cat in ('Zl', 'Zp'): result.append(' ')
|
||||
elif cat == 'Mc': result.append(char)
|
||||
elif cat == 'Lm': result.append(char)
|
||||
|
||||
name = ''.join(result)
|
||||
name = STRIP_BLOCKS_RE.sub('', name)
|
||||
name = STRIP_CONTROL_RE.sub('', name)
|
||||
name = STRIP_PRIVATE_RE.sub('', name)
|
||||
name = re.sub(r'\s+', ' ', name)
|
||||
name = name.strip()
|
||||
return name
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
+1
-1
@@ -1 +1 @@
|
||||
__version__ = "1.0.0"
|
||||
__version__ = "1.2.1"
|
||||
@@ -26,5 +26,10 @@ build_spkg: remove_symlinks build_sdist create_symlinks
|
||||
release: remove_symlinks build_wheel build_spkg create_symlinks
|
||||
|
||||
upload:
|
||||
@echo Ready to publish release over Reticulum
|
||||
@read VOID
|
||||
rngit release rns://7649a50d84610232d1416b41d2896aff/reticulum/lxmf create $$(python setup.py --getversion):dist --name lxmf
|
||||
|
||||
upload-pip:
|
||||
@echo Uploading to PyPi...
|
||||
twine upload dist/*.whl dist/*.tar.gz
|
||||
@@ -1,14 +1,24 @@
|
||||
# Lightweight Extensible Message Format
|
||||
|
||||
LXMF is a simple and flexible messaging format and delivery protocol that allows a wide variety of implementations, while using as little bandwidth as possible. It is built on top of [Reticulum](a8d24177d946de4f1f0a0fe1af9a1338:/page/repo.mu`g=reticulum|r=reticulum) and offers zero-conf message routing, end-to-end encryption and Forward Secrecy, and can be transported over any kind of medium that Reticulum supports.
|
||||
> [!WARNING]
|
||||
> Several hastily launched, incorrect, and in most cases entirely LLM-generated fakes of LXMF and associated tools are currently being circulated and marketed. Most of these "projects" violate the open source license that LXMF was published under, but claim independent ownership and license grants. Such claims or grants are **not** legally valid, and **not** recognized by the LXMF authors and copyright holders.
|
||||
>
|
||||
> Any claimed assertion of copyright or grant of license that such projects are making are [void grants](https://reticulum.network/manual/brandolinis.html#void-grants-legal-foundations-of-machine-generated-code). Both the violators themselves, and **all** downstream projects using the infringing derivatives, are **directly** and **personally** liable for the legal consequences.
|
||||
>
|
||||
> For more detailed information, see the relevant sections of the [Brandolini's Reference](https://reticulum.network/manual/brandolinis.html) chapter of the Reticulum Manual. For software and projects recognized by the Reticulum community, see the [Programs Using Reticulum](https://reticulum.network/manual/software.html) chapter.
|
||||
>
|
||||
> Do **not** use these "projects", they are a hazard to the entire ecosystem we have been carefully building over the last ten years.
|
||||
|
||||
LXMF is a simple and flexible messaging format and delivery protocol that allows a wide variety of implementations, while using as little bandwidth as possible. It is built on top of [Reticulum](https://reticulum.network) and offers zero-conf message routing, end-to-end encryption and Forward Secrecy, and can be transported over any kind of medium that Reticulum supports.
|
||||
|
||||
LXMF is efficient enough that it can deliver messages over extremely low-bandwidth systems such as packet radio or LoRa. Encrypted LXMF messages can also be encoded as QR-codes or text-based URIs, allowing completely analog *paper message* transport.
|
||||
|
||||
User-facing clients built on LXMF include:
|
||||
|
||||
- [Sideband](https://unsigned.io/sideband)
|
||||
- [MeshChat](https://github.com/liamcottle/reticulum-meshchat)
|
||||
- [MeshChatX](https://meshchatx.com/)
|
||||
- [Nomad Network](https://unsigned.io/nomadnet)
|
||||
- [Columba](https://github.com/torlando-tech/columba)
|
||||
|
||||
Community-provided tools and utilities for LXMF include:
|
||||
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
>Lightweight Extensible Message Format
|
||||
|
||||
LXMF is a simple and flexible messaging format and delivery protocol that allows a wide variety of implementations, while using as little bandwidth as possible. It is built on top of `_`!`[Reticulum`https://reticulum.network]`!`_ and offers zero-conf message routing, end-to-end encryption and Forward Secrecy, and can be transported over any kind of medium that Reticulum supports.
|
||||
|
||||
LXMF is efficient enough that it can deliver messages over extremely low-bandwidth systems such as packet radio or LoRa. Encrypted LXMF messages can also be encoded as QR-codes or text-based URIs, allowing completely analog `*paper message`* transport.
|
||||
|
||||
User-facing clients built on LXMF include:
|
||||
|
||||
• `_`!`[Sideband`https://unsigned.io/sideband]`!`_
|
||||
• `_`!`[MeshChatX`https://meshchatx.com/]`!`_
|
||||
• `_`!`[Nomad Network`https://unsigned.io/nomadnet]`!`_
|
||||
• `_`!`[Columba`https://github.com/torlando-tech/columba]`!`_
|
||||
|
||||
Community-provided tools and utilities for LXMF include:
|
||||
|
||||
• `_`!`[LXMFy`https://lxmfy.quad4.io/]`!`_
|
||||
• `_`!`[LXMF-Bot`https://github.com/randogoth/lxmf-bot]`!`_
|
||||
• `_`!`[LXMF Messageboard`https://github.com/chengtripp/lxmf_messageboard]`!`_
|
||||
• `_`!`[LXMEvent`https://github.com/faragher/LXMEvent]`!`_
|
||||
• `_`!`[RangeMap`https://github.com/faragher/RangeMap]`!`_
|
||||
• `_`!`[LXMF Tools`https://github.com/SebastianObi/LXMF-Tools]`!`_
|
||||
|
||||
>>Structure
|
||||
|
||||
LXMF messages are stored in a simple and efficient format, that's easy to parse and write.
|
||||
|
||||
>>>The format follows this general structure:
|
||||
|
||||
• Destination
|
||||
• Source
|
||||
• Ed25519 Signature
|
||||
• Payload
|
||||
• Timestamp
|
||||
• Content
|
||||
• Title
|
||||
• Fields
|
||||
|
||||
>>>And these rules:
|
||||
|
||||
1. A LXMF message is identified by its `!message-id`!, which is a SHA-256 hash of the `!Destination`!, `!Source`! and `!Payload`!. The message-id is never included directly in the message, since it can always be inferred from the message itself.
|
||||
|
||||
In some cases the actual message-id cannot be inferred, for example when a Propagation Node is storing an encrypted message for an offline user. In these cases a `*transient-id`* is used to identify the message while in storage or transit.
|
||||
|
||||
2. `!Destination`!, `!Source`!, `!Signature`! and `!Payload`! parts are mandatory, as is the `!Timestamp`! part of the payload.
|
||||
• The `!Destination`! and `!Source`! fields are 16-byte Reticulum destination hashes
|
||||
• The `!Signature`! field is a 64-byte Ed25519 signature of the `!Destination`!, `!Source`!, `!Payload`! and `!message-id`!
|
||||
• The `!Payload`! part is a `_`!`[msgpacked`https://msgpack.org]`!`_ list containing four items:
|
||||
1. The `!Timestamp`! is a double-precision floating point number representing the number of seconds since the UNIX epoch.
|
||||
2. The `!Content`! is the optional content or body of the message
|
||||
3. The `!Title`! is an optional title for the message
|
||||
4. The `!Fields`! is an optional dictionary
|
||||
|
||||
3. The `!Content`!, `!Title`! and `!Fields`! parts must be included in the message structure, but can be left empty.
|
||||
|
||||
4. The `!Fields`! part can be left empty, or contain a dictionary of any structure or depth.
|
||||
|
||||
>>Usage Examples
|
||||
|
||||
LXMF offers flexibility to implement many different messaging schemes, ranging from human communication to machine control and sensor monitoring. Here are a few examples:
|
||||
|
||||
• A messaging system for passing short, simple messages between human users, akin to SMS can be implemented using only the `!Content`! field, and leaving all other optional fields empty.
|
||||
|
||||
• For sending full-size mail, an email-like system can be implemented using the `!Title`! and `!Content`! fields to store "subject" and "body" parts of the message, and optionally the `!Fields`! part can be used to store attachments or other metadata.
|
||||
|
||||
• Machine-control messages or sensor readings can be implemented using command structures embedded in the `!Fields`! dictionary.
|
||||
|
||||
• Distributed discussion or news-groups, akin to USENET or similar systems, can be implemented using the relevant fields and LXMF Propagation Nodes. Broadcast bulletins can be implemented in a similar fashion.
|
||||
|
||||
>>Propagation Nodes
|
||||
|
||||
LXM Propagation Nodes offer a way to store and forward messages to users or endpoints that are not directly reachable at the time of message emission. Propagation Nodes can also provide infrastructure for distributed bulletin, news or discussion boards.
|
||||
|
||||
When Propagation Nodes exist on a Reticulum network, they will by default peer with each other and synchronise messages, automatically creating an encrypted, distributed message store. Users and other endpoints can retrieve messages destined for them from any available Propagation Nodes on the network.
|
||||
|
||||
>>The LXM Router
|
||||
|
||||
The LXM Router handles transporting messages over a Reticulum network, managing delivery receipts, outbound and inbound queues, and is the point of API interaction for client programs. The LXM Router also implements functionality for acting as an LXMF Propagation Node.
|
||||
|
||||
Programatically, using the LXM Router to send a message is as simple as:
|
||||
|
||||
`BT282828`Fddd
|
||||
`FTff7b72import`f `FT7ee787LXMF`f
|
||||
|
||||
`FTe6edf3lxm_router`f `FTff7b72=`f `FTe6edf3LXMF`f`FTff7b72.`f`FTd2a8ffLXMRouter`f`FTb4b4b4(`f`FTb4b4b4)`f
|
||||
|
||||
`FTe6edf3message`f `FTff7b72=`f `FTe6edf3LXMF`f`FTff7b72.`f`FTd2a8ffLXMessage`f`FTb4b4b4(`f`FTe6edf3destination`f`FTb4b4b4,`f `FTe6edf3source`f`FTb4b4b4,`f `FTa5d6ff"`f`FTa5d6ffThis is a short, simple message.`f`FTa5d6ff"`f`FTb4b4b4)`f
|
||||
|
||||
`FTe6edf3lxm_router`f`FTff7b72.`f`FTd2a8ffhandle_outbound`f`FTb4b4b4(`f`FTe6edf3message`f`FTb4b4b4)`f
|
||||
`f`b
|
||||
|
||||
The LXM Router then handles the heavy lifting, such as message packing, encryption, delivery confirmation, path lookup, routing, retries and failure notifications.
|
||||
|
||||
>>Transport Encryption
|
||||
|
||||
LXMF uses encryption provided by `_`!`[Reticulum`https://reticulum.network]`!`_, and thus uses end-to-end encryption by default. The delivery method of a message will influence which transport encryption scheme is used.
|
||||
|
||||
• If a message is delivered over a Reticulum link (which is the default method), the message will be encrypted with ephemeral AES-128 keys derived with ECDH on Curve25519. This mode offers forward secrecy.
|
||||
|
||||
• A message can be delivered opportunistically, embedded in a single Reticulum packet. In this cases the message will be opportunistically routed through the network, and will be encrypted with per-packet AES-128 keys derived with ECDH on Curve25519.
|
||||
|
||||
• If a message is delivered to the Reticulum GROUP destination type, the message will be encrypted using the symmetric AES-128 key of the GROUP destination.
|
||||
|
||||
>>Wire Format & Overhead
|
||||
|
||||
Assuming the default Reticulum configuration, the binary wire-format is as follows:
|
||||
|
||||
• 16 bytes destination hash
|
||||
• 16 bytes source hash
|
||||
• 64 bytes Ed25519 signature
|
||||
• Remaining bytes of `_`!`[msgpack`https://msgpack.org]`!`_ payload data, in accordance with the structure defined above
|
||||
|
||||
The complete message overhead for LXMF is only 111 bytes, which in return gives you timestamped, digitally signed, infinitely extensible, end-to-end encrypted, zero-conf routed, minimal-infrastructure messaging that's easy to use and build applications with.
|
||||
|
||||
>>Code Examples
|
||||
|
||||
Before writing your own programs using LXMF, you need to have a basic understanding of how the `_`!`[Reticulum`https://reticulum.network]`!`_ protocol and API works. Please see the `_`!`[Reticulum Manual`https://reticulum.network/manual/]`!`_. For a few simple examples of how to send and receive messages with LXMF, please see the `_`!`[receiver example`:/page/blob.mu`g=reticulum|r=lxmf|ref=HEAD|path=./docs/example_receiver.py]`!`_ and the `_`!`[sender example`:/page/blob.mu`g=reticulum|r=lxmf|ref=HEAD|path=./docs/example_sender.py]`!`_ included in this repository.
|
||||
|
||||
>>Example Paper Message
|
||||
|
||||
You can try out the paper messaging functionality by using the following QR code. It is a paper message sent to the LXMF address `BT383838`Fddd6b3362bd2c1dbf87b66a85f79a8d8c75`f`b. To be able to decrypt and read the message, you will need to import the following Reticulum Identity to an LXMF messaging app:
|
||||
|
||||
`BT383838`Fddd3BPTDTQCRZPKJT3TXAJCMQFMOYWIM3OCLKPWMG4HCF2T4CH3YZHVNHNRDU6QAZWV2KBHMWBNT2C62TQEVC5GLFM4MN25VLZFSK3ADRQ=`f`b
|
||||
|
||||
The `_`!`[Sideband`https://unsigned.io/sideband]`!`_ application allows you to do this easily. After you have imported the identity into an app of your choice, you can scan the following QR code and open it in the app, where it will be decrypted and added as a message.
|
||||
|
||||
`_`!`[Paper message QR code`a8d24177d946de4f1f0a0fe1af9a1338:/page/blob.mu`g=reticulum|r=lxmf|ref=HEAD|path=docs/paper_msg_test.png]`!`_
|
||||
|
||||
You can also find the entire message in this link:
|
||||
|
||||
`BT282828`Fddd
|
||||
`=
|
||||
lxm://azNivSwdv4e2aoX3mo2MdTAozuI7BlzrLlHULmnVgpz3dNT9CMPVwgywzCJP8FVogj5j_kU7j7ywuvBNcr45kRTrd19c3iHenmnSDe4VEd6FuGsAiT0Khzl7T81YZHPTDhRNp0FdhDE9AJ7uphw7zKMyqhHHxOxqrYeBeKF66gpPxDceqjsOApvsSwggjcuHBx9OxOBy05XmnJxA1unCKgvNfOFYc1T47luxoY3c0dLOJnJPwZuFRytx2TXlQNZzOJ28yTEygIfkDqEO9mZi5lgev7XZJ0DvgioQxMIyoCm7lBUzfq66zW3SQj6vHHph7bhr36dLOCFgk4fZA6yia2MlTT9KV66Tn2l8mPNDlvuSAJhwDA_xx2PN9zKadCjo9sItkAp8r-Ss1CzoUWZUAyT1oDw7ly6RrzGBG-e3eM3CL6u1juIeFiHby7_3cON-6VTUuk4xR5nwKlFTu5vsYMVXe5H3VahiDSS4Q1aqX7I
|
||||
`=
|
||||
`f`b
|
||||
|
||||
On operating systems that allow for registering custom URI-handlers, you can click the link, and it will be decoded directly in your LXMF client. This works with Sideband on Android.
|
||||
|
||||
>>Installation
|
||||
|
||||
If you want to try out LXMF, you can install it with pip:
|
||||
|
||||
`BT282828`Fddd
|
||||
pip install lxmf
|
||||
`f`b
|
||||
|
||||
If you are using an operating system that blocks normal user package installation via `BT383838`Fdddpip`f`b,
|
||||
you can return `BT383838`Fdddpip`f`b to normal behaviour by editing the `BT383838`Fddd~/.config/pip/pip.conf`f`b file,
|
||||
and adding the following directive in the `BT383838`Fddd[global]`f`b section:
|
||||
|
||||
`BT282828`Fddd
|
||||
[global]
|
||||
break-system-packages = true
|
||||
`f`b
|
||||
|
||||
Alternatively, you can use the `BT383838`Fdddpipx`f`b tool to install Reticulum in an isolated environment:
|
||||
|
||||
`BT282828`Fddd
|
||||
pipx install lxmf
|
||||
`f`b
|
||||
|
||||
>>Daemon Included
|
||||
|
||||
The `BT383838`Fdddlxmf`f`b package comes with the `BT383838`Fdddlxmd`f`b program, a fully functional (but lightweight) LXMF message router and propagation node daemon. After installing the `BT383838`Fdddlxmf`f`b package, you can run `BT383838`Fdddlxmd --help`f`b to learn more about the command-line options:
|
||||
|
||||
`BT282828`Fddd
|
||||
$ lxmd --help
|
||||
|
||||
usage: lxmd [-h] [--config CONFIG] [--rnsconfig RNSCONFIG] [-p] [-i PATH] [-v] [-q] [-s] [--exampleconfig] [--version]
|
||||
|
||||
Lightweight Extensible Messaging Daemon
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--config CONFIG path to alternative lxmd config directory
|
||||
--rnsconfig RNSCONFIG
|
||||
path to alternative Reticulum config directory
|
||||
-p, --propagation-node
|
||||
run an LXMF Propagation Node
|
||||
-i PATH, --on-inbound PATH
|
||||
executable to run when a message is received
|
||||
-v, --verbose
|
||||
-q, --quiet
|
||||
-s, --service lxmd is running as a service and should log to file
|
||||
--exampleconfig print verbose configuration example to stdout and exit
|
||||
--version show program's version number and exit
|
||||
`f`b
|
||||
|
||||
Or run `BT383838`Fdddlxmd --exampleconfig`f`b to generate a commented example configuration documenting all the available configuration directives.
|
||||
|
||||
>>Support LXMF Development
|
||||
You can help support the continued development of open, free and private communications systems by donating via one of the following channels:
|
||||
|
||||
• Monero:
|
||||
`BT282828`Fddd
|
||||
`=
|
||||
84FpY1QbxHcgdseePYNmhTHcrgMX4nFfBYtz2GKYToqHVVhJp8Eaw1Z1EedRnKD19b3B8NiLCGVxzKV17UMmmeEsCrPyA5w
|
||||
`=
|
||||
`f`b
|
||||
• Bitcoin
|
||||
`BT282828`Fddd
|
||||
`=
|
||||
bc1pgqgu8h8xvj4jtafslq396v7ju7hkgymyrzyqft4llfslz5vp99psqfk3a6
|
||||
`=
|
||||
`f`b
|
||||
• Ethereum
|
||||
`BT282828`Fddd
|
||||
`=
|
||||
0x91C421DdfB8a30a49A71d63447ddb54cEBe3465E
|
||||
`=
|
||||
`f`b
|
||||
• Liberapay: https://liberapay.com/Reticulum/
|
||||
|
||||
• Ko-Fi: https://ko-fi.com/markqvist
|
||||
|
||||
|
||||
>>Caveat Emptor
|
||||
|
||||
LXMF is beta software, and should be considered experimental. While it has been built with cryptography best practices very foremost in mind, it `*has not`* been externally security audited, and there could very well be privacy-breaking bugs. If you want to help out, or help sponsor an audit, please do get in touch.
|
||||
|
||||
>>Development Roadmap
|
||||
|
||||
LXMF is actively being developed, and the following improvements and features are currently planned for implementation:
|
||||
|
||||
• Sneakernet and physical transport functionality
|
||||
• Content Destinations, and easy to use API for group messaging and discussion threads
|
||||
• Write and release full API and protocol documentation
|
||||
• Documenting and possibly expanding LXMF limits and priorities
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
import setuptools
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
@@ -5,6 +6,10 @@ with open("README.md", "r") as fh:
|
||||
|
||||
exec(open("LXMF/_version.py", "r").read())
|
||||
|
||||
if "--getversion" in sys.argv:
|
||||
print(__version__, end="")
|
||||
exit(0)
|
||||
|
||||
setuptools.setup(
|
||||
name="lxmf",
|
||||
version=__version__,
|
||||
@@ -26,6 +31,6 @@ setuptools.setup(
|
||||
'lxmd=LXMF.Utilities.lxmd:main',
|
||||
]
|
||||
},
|
||||
install_requires=["rns>=1.3.2"],
|
||||
install_requires=["rns>=1.5.7"],
|
||||
python_requires=">=3.7",
|
||||
)
|
||||
Reference in new issue
Block a user