Compare commits

...
19 Commits
Author SHA1 Message Date
Mark Qvist 2812a07165 Cleanup 2023-11-02 18:29:46 +01:00
Mark Qvist 10be1383e5 Updated version and dependencies 2023-11-02 12:48:24 +01:00
Mark Qvist 4d356bcda8 Tweaked timing 2023-11-02 04:36:51 +01:00
Mark Qvist da6fb3d0f3 Added field specifiers 2023-10-30 02:26:24 +01:00
Mark Qvist 56cb637bfa Improved propagation node sync feedback. Added physical layer reception statistics. 2023-10-28 00:06:56 +02:00
Mark Qvist 2872c94394 Merge branch 'master' of github.com:markqvist/LXMF 2023-10-24 01:48:13 +02:00
Mark Qvist f307f33bf8 Updated version and dependencies 2023-10-24 01:47:45 +02:00
Mark Qvist a095ba7e40 Added physical layer link statistics to reception 2023-10-23 01:34:20 +02:00
markqvist 0dc1e13f9d Update README.md 2023-10-17 02:14:07 +02:00
Mark Qvist f83600430a Updated version 2023-10-16 01:50:37 +02:00
Mark Qvist 537123896b Increased max unreachable time to 14 days 2023-10-16 01:50:01 +02:00
Mark Qvist bc8863c3b1 Updated version 2023-10-15 20:28:55 +02:00
Mark Qvist b894c5a2a6 Fixed paper message generation sequence 2023-10-15 20:27:35 +02:00
Mark Qvist 0ac4660510 Updated version and dependencien 2023-10-07 16:43:33 +02:00
Mark Qvist 672054177c Updated version and dependencies 2023-09-19 11:36:13 +02:00
Mark Qvist 55cf934475 Updated install section 2023-08-15 11:27:02 +02:00
Mark Qvist b690880332 Updated dependencies 2023-08-15 11:08:38 +02:00
Mark Qvist 7220a4d6f7 Updated install section 2023-08-15 11:07:24 +02:00
Mark Qvist 5abf01a88f Updated version and dependencies 2023-06-13 19:56:44 +02:00
8 changed files with 91 additions and 26 deletions

No files matched your search

+16 -1
View File
@@ -1 +1,16 @@
APP_NAME = "lxmf"
APP_NAME = "lxmf"
# WARNING! These field specifiers are floating and not
# yet final! Consider highly experiemental, and expect
# them to change in the future! You have been warned :)
FIELD_EMBEDDED_LXMS = 0x01
FIELD_TELEMETRY = 0x02
FIELD_TELEMETRY_STREAM = 0x03
FIELD_ICON_APPEARANCE = 0x04
FIELD_FILE_ATTACHMENTS = 0x05
FIELD_IMAGE = 0x06
FIELD_AUDIO = 0x07
FIELD_THREAD = 0x08
FIELD_COMMANDS = 0x09
FIELD_RESULTS = 0x0A
+1 -1
View File
@@ -22,7 +22,7 @@ class LXMPeer:
# Maximum amount of time a peer can
# be unreachable before it is removed
MAX_UNREACHABLE = 4*24*60*60
MAX_UNREACHABLE = 14*24*60*60
# Everytime consecutive time a sync
# link fails to establish, add this
+45 -13
View File
@@ -19,7 +19,7 @@ class LXMRouter:
MAX_DELIVERY_ATTEMPTS = 5
PROCESSING_INTERVAL = 4
DELIVERY_RETRY_WAIT = 7
PATH_REQUEST_WAIT = 5
PATH_REQUEST_WAIT = 7
LINK_MAX_INACTIVITY = 10*60
MESSAGE_EXPIRY = 30*24*60*60
@@ -40,8 +40,12 @@ class LXMRouter:
PR_RECEIVING = 0x05
PR_RESPONSE_RECEIVED = 0x06
PR_COMPLETE = 0x07
PR_NO_IDENTITY_RCVD = 0xf0
PR_NO_ACCESS = 0xf1
PR_NO_PATH = 0xf0
PR_LINK_FAILED = 0xf1
PR_TRANSFER_FAILED = 0xf2
PR_NO_IDENTITY_RCVD = 0xf3
PR_NO_ACCESS = 0xf4
PR_FAILED = 0xfe
PR_ALL_MESSAGES = 0x00
@@ -220,9 +224,9 @@ class LXMRouter:
if max_messages == None:
max_messages = LXMRouter.PR_ALL_MESSAGES
self.propagation_transfer_progress = 0.0
self.propagation_transfer_max_messages = max_messages
if self.outbound_propagation_node != None:
self.propagation_transfer_progress = 0.0
if self.outbound_propagation_link != None and self.outbound_propagation_link.status == RNS.Link.ACTIVE:
self.propagation_transfer_state = LXMRouter.PR_LINK_ESTABLISHED
self.outbound_propagation_link.identify(identity)
@@ -469,7 +473,16 @@ class LXMRouter:
if self.outbound_propagation_link != None and self.outbound_propagation_link.status == RNS.Link.CLOSED:
self.outbound_propagation_link = None
self.acknowledge_sync_completion()
if self.propagation_transfer_state == LXMRouter.PR_COMPLETE:
self.acknowledge_sync_completion()
elif self.propagation_transfer_state < LXMRouter.PR_LINK_ESTABLISHED:
self.acknowledge_sync_completion(failure_state=LXMRouter.PR_LINK_FAILED)
elif self.propagation_transfer_state >= LXMRouter.PR_LINK_ESTABLISHED and self.propagation_transfer_state < LXMRouter.PR_COMPLETE:
self.acknowledge_sync_completion(failure_state=LXMRouter.PR_TRANSFER_FAILED)
else:
RNS.log(f"Unknown propagation transfer state on link cleaning: {self.propagation_transfer_state}", RNS.LOG_DEBUG)
self.acknowledge_sync_completion()
RNS.log("Cleaned outbound propagation link", RNS.LOG_DEBUG)
def clean_transient_id_caches(self):
@@ -647,7 +660,7 @@ class LXMRouter:
self.request_messages_from_propagation_node(self.wants_download_on_path_available_to, self.propagation_transfer_max_messages)
else:
RNS.log("Propagation node path request timed out", RNS.LOG_DEBUG)
self.acknowledge_sync_completion()
self.acknowledge_sync_completion(failure_state=LXMRouter.PR_NO_PATH)
def identity_allowed(self, identity):
if self.auth_required:
@@ -810,12 +823,15 @@ class LXMRouter:
if self.outbound_propagation_link != None:
self.outbound_propagation_link.teardown()
def acknowledge_sync_completion(self, reset_state=False):
def acknowledge_sync_completion(self, reset_state=False, failure_state=None):
self.propagation_transfer_last_result = None
if reset_state or self.propagation_transfer_state <= LXMRouter.PR_COMPLETE:
self.propagation_transfer_state = LXMRouter.PR_IDLE
if failure_state == None:
self.propagation_transfer_state = LXMRouter.PR_IDLE
else:
self.propagation_transfer_state = failure_state
self.propagation_transfer_progress = 0.0
self.propagation_transfer_last_result = None
self.wants_download_on_path_available_from = None
self.wants_download_on_path_available_to = None
@@ -842,10 +858,15 @@ class LXMRouter:
self.pending_outbound.append(lxmessage)
self.process_outbound()
def lxmf_delivery(self, lxmf_data, destination_type = None):
def lxmf_delivery(self, lxmf_data, destination_type = None, phy_stats = None):
try:
message = LXMessage.unpack_from_bytes(lxmf_data)
if phy_stats != None:
if "rssi" in phy_stats: message.rssi = phy_stats["rssi"]
if "snr" in phy_stats: message.snr = phy_stats["snr"]
if "q" in phy_stats: message.q = phy_stats["q"]
if destination_type == RNS.Destination.SINGLE:
message.transport_encrypted = True
message.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC
@@ -885,7 +906,16 @@ class LXMRouter:
else:
lxmf_data = data
if self.lxmf_delivery(lxmf_data, packet.destination_type):
try:
reticulum = RNS.Reticulum.get_instance()
if packet.rssi == None: packet.rssi = reticulum.get_packet_rssi(packet.packet_hash)
if packet.snr == None: packet.snr = reticulum.get_packet_snr(packet.packet_hash)
if packet.q == None: packet.q = reticulum.get_packet_q(packet.packet_hash)
except Exception as e:
RNS.log("Error while retrieving physical link stats for LXMF delivery packet: "+str(e), RNS.LOG_ERROR)
phy_stats = {"rssi": packet.rssi, "snr": packet.snr, "q": packet.q}
if self.lxmf_delivery(lxmf_data, packet.destination_type, phy_stats=phy_stats):
packet.prove()
except Exception as e:
@@ -893,6 +923,7 @@ class LXMRouter:
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
def delivery_link_established(self, link):
link.track_phy_stats(True)
link.set_packet_callback(self.delivery_packet)
link.set_resource_strategy(RNS.Link.ACCEPT_ALL)
link.set_resource_started_callback(self.resource_transfer_began)
@@ -907,7 +938,8 @@ class LXMRouter:
def delivery_resource_concluded(self, resource):
RNS.log("Transfer concluded for LXMF delivery resource "+str(resource), RNS.LOG_DEBUG)
if resource.status == RNS.Resource.COMPLETE:
self.lxmf_delivery(resource.data.read(), resource.link.type)
phy_stats = {"rssi": resource.link.rssi, "snr": resource.link.snr, "q": resource.link.q}
self.lxmf_delivery(resource.data.read(), resource.link.type, phy_stats=phy_stats)
### Peer Sync & Propagation ###########################
@@ -1189,7 +1221,7 @@ class LXMRouter:
else:
RNS.log("Starting outbound processing for "+str(lxmessage)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
# Outbound handling for opportunistic messages
if lxmessage.method == LXMessage.OPPORTUNISTIC:
if lxmessage.method == LXMessage.OPPORTUNISTIC:
if lxmessage.delivery_attempts <= LXMRouter.MAX_DELIVERY_ATTEMPTS:
if not hasattr(lxmessage, "next_delivery_attempt") or time.time() > lxmessage.next_delivery_attempt:
lxmessage.delivery_attempts += 1
+6 -4
View File
@@ -111,7 +111,6 @@ class LXMessage:
self.set_title_from_string(title)
self.set_content_from_string(content)
self.set_fields(fields)
self.payload = None
@@ -122,6 +121,9 @@ class LXMessage:
self.progress = None
self.state = LXMessage.DRAFT
self.method = LXMessage.UNKNOWN
self.rssi = None
self.snr = None
self.q = None
self.propagation_packed = None
self.paper_packed = None
@@ -161,7 +163,7 @@ class LXMessage:
def set_fields(self, fields):
if isinstance(fields, dict) or fields == None:
self.fields = fields
self.fields = fields or {}
else:
raise ValueError("LXMessage property \"fields\" can only be dict or None")
@@ -487,7 +489,6 @@ class LXMessage:
return None
def as_uri(self, finalise=True):
self.determine_transport_encryption()
if not self.packed:
self.pack()
@@ -499,6 +500,7 @@ class LXMessage:
lxm_uri = LXMessage.URI_SCHEMA+"://"+encoded_bytes.decode("utf-8").replace("=","")
if finalise:
self.determine_transport_encryption()
self.__mark_paper_generated()
return lxm_uri
@@ -507,7 +509,6 @@ class LXMessage:
raise TypeError("Attempt to represent LXM with non-paper delivery method as URI")
def as_qr(self):
self.determine_transport_encryption()
if not self.packed:
self.pack()
@@ -522,6 +523,7 @@ class LXMessage:
data = self.as_uri(finalise=False),
)
self.determine_transport_encryption()
self.__mark_paper_generated()
return qr
+1
View File
@@ -2,6 +2,7 @@ import os
import glob
from .LXMessage import LXMessage
from .LXMRouter import LXMRouter
from .LXMF import *
from ._version import __version__
+1 -1
View File
@@ -1 +1 @@
__version__ = "0.3.1"
__version__ = "0.3.8"
+19 -4
View File
@@ -85,11 +85,11 @@ The LXM Router then handles the heavy lifting, such as message packing, encrypti
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.
- 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 _ephemeral_ keys derived with _ECDH_ on _Curve25519_. This mode offers Perfect Forward Secrecy.
- 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.
- If a message is delivered to the Reticulum GROUP destination type, the message will be transported using _AES-128_ encryption.
- 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 over a Reticulum link (which is the default method), the message will be encrypted with _ephemeral_ keys derived with _ECDH_ on _Curve25519_. This mode offers Perfect Forward Secrecy.
- 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
@@ -127,7 +127,22 @@ LXMF is beta software, and should be considered experimental. While it has been
If you want to try out LXMF, you can install it with pip:
```bash
pip3 install lxmf
pip install lxmf
```
If you are using an operating system that blocks normal user package installation via `pip`,
you can return `pip` to normal behaviour by editing the `~/.config/pip/pip.conf` file,
and adding the following directive in the `[global]` section:
```text
[global]
break-system-packages = true
```
Alternatively, you can use the `pipx` tool to install Reticulum in an isolated environment:
```bash
pipx install lxmf
```
## Development Roadmap
+2 -2
View File
@@ -25,6 +25,6 @@ setuptools.setup(
'lxmd=LXMF.Utilities.lxmd:main',
]
},
install_requires=['rns>=0.4.9'],
python_requires='>=3.6',
install_requires=['rns>=0.6.4'],
python_requires='>=3.7',
)