nightly #73

Merged
ag merged 2 commits from nightly into main 2024-08-01 21:11:49 +00:00
24 changed files with 85 additions and 52 deletions
Showing only changes of commit 53b1ffd9c6 - Show all commits

6
.gitignore vendored
View File

@ -2,9 +2,9 @@ bin/
lib*
share/
**/__pycache__/
src/webui/build/
src/webui/htmx-extensions/
src/webui/res/js/node_modules/
src/Splash/build/
src/Splash/htmx-extensions/
src/Splash/res/js/node_modules/
src/daisy/
src/catch/
src/logs/

View File

@ -6,4 +6,4 @@ mv docs.tmp/* docs
rm -rf docs.tmp
mv docs/index.md docs/readme.md
sed -i '1s;^;![PierMesh logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/piermeshicon.png)\n\n;' docs/readme.md
sed -i '1s;^;![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)\n\n;' docs/Components/daisy.md
sed -i '1s;^;![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)\n\n;' docs/Daisy/Daisy.md

View File

@ -1,3 +1,5 @@
![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)
Schemaless binary database
base class
==========================

View File

@ -1,3 +1,7 @@
SubPackets for handling
full submessages
=======================
### *class* Packets.SubMessage.SubMessage
TODO

View File

@ -1,3 +1,7 @@
SubPacket for handling
individual packets of submessages
=================================
### *class* Packets.SubPacket.SubPacket
TODO

View File

@ -1,6 +1,6 @@
# serve: Web UI server
### *class* Splash.serve.Server(transmitter, catch, onodeID, network, cLog)
### *class* Splash.serve.Server(transceiver, catch, onodeID, network, cLog)
Web server that serves the web ui and provides web to node communication
@ -42,7 +42,7 @@ Microdot server instance
#### catch
Reference to our Catch Cache instance to pull from for servijg Catchs
Reference to our Catch Cache instance to pull from for serving Catchs
* **Type:**
[Daisy.Catch.Catch](/PierMesh/piermesh/src/branch/main/docs/Daisy/Catch.md#Daisy.Catch.Catch)

View File

@ -6,6 +6,8 @@ Dispatches to Protocols
Packet filtering orchestration
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/base.py)
cLog
: Reference to run.Node.cLog for logging
@ -45,18 +47,26 @@ Check if this is a self packet, if so skip
Base filtering logic, takes a single MeshTastic packet
### *class* Sponge.Protocols.bubble.filter(completeMessage, recipient, recipientNode, onodeID, todo)
#### *async* bubble.filter(recipient, recipientNode, onodeID, todo)
Peer to peer protol
### *class* Sponge.Protocols.catch.filter(completeMessage, recipient, recipientNode, todo)
[🔗 Bubble Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Sponge/Protocols/bubble.py)
#### *async* catch.filter(recipient, recipientNode, todo)
Catch exchange protocol
### *class* Sponge.Protocols.cryptography.filter(completeMessage, recipientNode, todo)
[🔗 Catch Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/catch.py)
#### *async* cryptography.filter(recipientNode, todo)
Cryptographic operations protocol
### *class* Sponge.Protocols.map.filter(completeMessage, todo)
[🔗 Cryptography Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/cryptography.py)
#### *async* map.filter(todo)
Network mapping protocol
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/map.py)

View File

@ -17,7 +17,7 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Node.cache`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cache)
* [`Node.nodeInfo`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.nodeInfo)
* [`Node.onodeID`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.onodeID)
* [`Node.oTransmitter`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.oTransmitter)
* [`Node.oTransceiver`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.oTransceiver)
* [`Node.processed`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.processed)
* [`Node.proc`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.proc)
* [`Node.mTasks`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.mTasks)
@ -27,7 +27,6 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Node.action_sendCatch()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendCatch)
* [`Node.action_sendToPeer()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendToPeer)
* [`Node.cLog()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cLog)
* [`Node.monitor()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.monitor)
* [`Node.spongeListen()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.spongeListen)
* [ui: TUI application](/PierMesh/piermesh/src/branch/main/docs/ui.md)
* [`TUI`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI)
@ -109,10 +108,10 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Filter.protoRoute()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.protoRoute)
* [`Filter.selfCheck()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.selfCheck)
* [`Filter.sieve()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.sieve)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.bubble.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.catch.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.cryptography.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.map.filter)
* [`bubble.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.bubble.filter)
* [`catch.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.catch.filter)
* [`cryptography.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.cryptography.filter)
* [`map.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.map.filter)
* [Header packet: Metadata packet](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md)
* [`Header`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header)
* [`Header.sender`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header.sender)
@ -134,6 +133,8 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Packet.dump()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.dump)
* [`Packet.parsePayload()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.parsePayload)
* [`SinglePacket`](/PierMesh/piermesh/src/branch/main/docs/Packets/SinglePacket.md)
* [`SubMessage`](/PierMesh/piermesh/src/branch/main/docs/Packets/SubMessage.md)
* [`SubPacket`](/PierMesh/piermesh/src/branch/main/docs/Packets/SubPacket.md)
* [Layer 0 data transceiving](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md)
* [`Transceiver`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver)
* [`Transceiver.cLog`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver.cLog)

View File

@ -62,12 +62,12 @@ PierMesh node ID
* **Type:**
str
#### oTransmitter
#### oTransceiver
LoRa transmitter Transmitter
LoRa transceiver Transceiver
* **Type:**
Transmitter
[Transceiver](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver)
#### processed
@ -145,10 +145,6 @@ Convenience function that logs to the ui and log files
* **Return type:**
None
#### *async* monitor()
Monitor and log ram and cpu usage
#### *async* spongeListen()
Loop to watch for tasks to do

View File

@ -184,8 +184,7 @@ class DHEFern:
publicKey = privateKey.public_key()
if setSelf:
self.publicKey = publicKey
self.updateStore(
"key",
self.stores["key"].update(
"self",
{
"publicKey": self.publicKey.public_bytes(

View File

@ -0,0 +1,4 @@
class SubMessage:
"""
TODO
"""

View File

@ -1,3 +1,6 @@
SubPackets for handling
full submessages
=======================
.. autoclass:: Packets.SubMessage.SubMessage
:members:

View File

@ -0,0 +1,4 @@
class SubPacket:
"""
TODO
"""

View File

@ -1,3 +1,6 @@
SubPacket for handling
individual packets of submessages
=================================
.. autoclass:: Packets.SubPacket.SubPacket
:members:

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, recipient, recipientNode, onodeID, todo):
"""
Peer to peer protol
`🔗 Bubble Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Sponge/Protocols/bubble.py>`_
"""
m = completeMessage
if recipientNode == onodeID:

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, recipient, recipientNode, todo):
"""
Catch exchange protocol
`🔗 Catch Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/catch.py>`_
"""
m = completeMessage
# TODO: Sending to other nodes clients

View File

@ -1,9 +1,8 @@
import logging
async def filter(completeMessage, recipientNode, todo):
"""
Cryptographic operations protocol
`🔗 Cryptography Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/cryptography.py>`_
"""
todo.append(
{

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, todo):
"""
Network mapping protocol
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/map.py>`_
"""
m = completeMessage
todo.append(

View File

@ -12,6 +12,8 @@ class Filter:
"""
Packet filtering orchestration
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/base.py>`_
cLog
Reference to `run.Node.cLog` for logging
@ -138,10 +140,10 @@ class Filter:
# responseLoop(packets_id)
pass
completeMessage = self.messages[packetsID]
completeMessage["data"] = Packets.reassemble(None, completeMessage)
completeMessage["data"] = Message.reassemble(None, completeMessage)
del self.messages[packetsID]
self.completed.append(packetsID)
self.cLog(20, "Assembly completed, routing")
await self.protoRoute(completeMessage)
except Exception as e:
self.cLog(30, traceback.print_exc())
except Exception:
self.cLog(30, traceback.format_exc())

View File

@ -5,14 +5,11 @@ Dispatches to Protocols
.. autoclass:: Sponge.base.Filter
:members:
.. autoclass:: Sponge.Protocols.bubble.filter
:members:
.. automethod:: Sponge.Protocols.bubble.filter
.. autoclass:: Sponge.Protocols.catch.filter
:members:
.. automethod:: Sponge.Protocols.catch.filter
.. autoclass:: Sponge.Protocols.cryptography.filter
:members:
.. automethod:: Sponge.Protocols.cryptography.filter
.. automethod:: Sponge.Protocols.map.filter
.. autoclass:: Sponge.Protocols.map.filter
:members:

View File

@ -23,6 +23,7 @@ extensions = [
"sphinx_markdown_builder",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]
templates_path = ["_templates"]

View File

@ -150,9 +150,6 @@ class Node:
"""
while True:
if tuiOb != None:
if tuiOb.done:
print("Terminating PierMesh service...")
self.proc.terminate()
await asyncio.sleep(10)
memmb = self.proc.memory_info().rss / (1024 * 1024)
memmb = round(memmb, 2)
@ -270,7 +267,9 @@ async def logPassLoop():
await asyncio.sleep(1)
if tuiOb == None or nodeOb == None:
await asyncio.sleep(1)
elif tuiOb.done == True:
elif tuiOb.done:
tuiOb.exit()
os.system("reset")
print("Terminating PierMesh service...")
nodeOb.proc.terminate()
else:
@ -315,10 +314,8 @@ async def main():
nodeOb.mTasks["announce"] = asyncio.create_task(nodeOb.oTransceiver.announce())
await asyncio.sleep(1)
await nodeOb.server.app.start_server(port=int(sys.argv[2]), debug=True)
except KeyboardInterrupt:
sys.exit()
except Exception:
nodeOb.cLog(20, traceback.format_exc())
logging.log(20, traceback.format_exc())
if __name__ == "__main__":
@ -330,7 +327,8 @@ if __name__ == "__main__":
tuiOb = TUI()
tuiOb.nodeOb = nodeOb
tuiOb.run()
except KeyboardInterrupt:
nodeOb.cLog(30, "Terminating PierMesh service...")
except Exception:
nodeOb.cLog(30, sys.gettrace())
except:
try:
nodeOb.cLog(30, traceback.format_exc())
except:
logging.log(30, traceback.format_exc())

View File

@ -57,9 +57,9 @@ class TUI(App):
run.monitor
"""
self.done = True
sys.exit("Terminating TUI...")
# sys.exit("Terminating TUI...")
def compose(self) -> ComposeResult:
def compose(self):
"""
Build the TUI
"""