2024-07-28 11:21:15 +00:00
|
|
|
|
# PierMesh service runner
|
|
|
|
|
|
|
|
|
|
Main method for running the PierMesh service
|
|
|
|
|
|
|
|
|
|
### *class* run.Node
|
|
|
|
|
|
2024-07-29 14:13:56 +00:00
|
|
|
|
Node: Class that handles most of the PierMesh data
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/run.py)
|
|
|
|
|
|
2024-07-29 14:13:56 +00:00
|
|
|
|
#### toLog
|
|
|
|
|
|
|
|
|
|
We store logs to be processed here
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
list
|
|
|
|
|
|
|
|
|
|
#### actions
|
|
|
|
|
|
|
|
|
|
Dictionary mapping methods with the action prefix to the method name after action dynamically to be called through Sponge (Sponge.base) filtering
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
dict
|
|
|
|
|
|
|
|
|
|
#### todo
|
|
|
|
|
|
|
|
|
|
List of actions to execute
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
list[dict]
|
|
|
|
|
|
|
|
|
|
#### network
|
|
|
|
|
|
|
|
|
|
Network map
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
Network
|
|
|
|
|
|
|
|
|
|
#### catch
|
|
|
|
|
|
|
|
|
|
Daisy cache for catchs, our domain analog
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
Catch
|
|
|
|
|
|
|
|
|
|
#### cache
|
|
|
|
|
|
|
|
|
|
Daisy cache for general use
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
Cache
|
|
|
|
|
|
|
|
|
|
#### nodeInfo
|
|
|
|
|
|
|
|
|
|
Daisy (Components.daisy.Daisy) record containing some information about the node
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Daisy](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md#Components.daisy.Daisy)
|
|
|
|
|
|
|
|
|
|
#### onodeID
|
|
|
|
|
|
|
|
|
|
PierMesh node ID
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
str
|
|
|
|
|
|
|
|
|
|
#### oTransmitter
|
|
|
|
|
|
|
|
|
|
LoRa transmitter Transmitter
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Transmitter](/PierMesh/piermesh/src/branch/main/docs/Transmission/transmission.md#Transmission.transmission.Transmitter)
|
|
|
|
|
|
|
|
|
|
#### processed
|
|
|
|
|
|
|
|
|
|
List of IDs of already completed messages so that we don’t reprocess messages
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
list
|
|
|
|
|
|
|
|
|
|
#### proc
|
|
|
|
|
|
|
|
|
|
This process (psutil.Process), used for managing and monitoring PierMesh
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
psutil.Process
|
|
|
|
|
|
|
|
|
|
#### mTasks
|
|
|
|
|
|
|
|
|
|
Dictionary of PierMesh service tasks
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
dict
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
|
|
|
|
`logPassLoop`
|
|
|
|
|
: Loop to handle logging to file and TUI
|
|
|
|
|
|
2024-07-28 11:21:15 +00:00
|
|
|
|
#### *async* action_initNodeDH(data: dict)
|
|
|
|
|
|
|
|
|
|
Initialize diffie hellman key exchange
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
|
|
|
|
[`Cryptography.DHEFern.DHEFern`](/PierMesh/piermesh/src/branch/main/docs/Cryptography/DHEFern.md#Cryptography.DHEFern.DHEFern)
|
|
|
|
|
: End to end encryption functionality
|
|
|
|
|
|
|
|
|
|
#### *async* action_keyDeriveDH(data: dict)
|
|
|
|
|
|
|
|
|
|
Derive key via diffie hellman key exchange
|
|
|
|
|
|
|
|
|
|
#### *async* action_map(data: dict)
|
|
|
|
|
|
|
|
|
|
Map new network data to internal network map
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
2024-07-29 03:47:27 +00:00
|
|
|
|
`Siph.network.Network`
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Layered graph etwork representation
|
|
|
|
|
|
|
|
|
|
#### *async* action_sendCatch(data: dict)
|
|
|
|
|
|
|
|
|
|
Get catch and return the data to a peer
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
2024-07-28 23:25:20 +00:00
|
|
|
|
`Bubble.router.Router`
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Routing class
|
|
|
|
|
|
|
|
|
|
#### *async* action_sendToPeer(data: dict)
|
|
|
|
|
|
|
|
|
|
Send data to a peer connected to the server
|
|
|
|
|
|
|
|
|
|
* **Parameters:**
|
|
|
|
|
**data** (*dict*) – Data passed from the filter, this is a generic object so it’s similar on all actions here
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
|
|
|
|
`Filters.Protocols`
|
|
|
|
|
: Protocol based packet filtering
|
|
|
|
|
|
|
|
|
|
`webui.serve.Server`
|
|
|
|
|
: Runs a light Microdot web server with http/s and websocket functionality
|
|
|
|
|
|
|
|
|
|
`webui.serve.Server.sendToPeer`
|
|
|
|
|
: Function to actually execute the action
|
|
|
|
|
|
|
|
|
|
#### cLog(priority: int, message: str)
|
|
|
|
|
|
|
|
|
|
Convenience function that logs to the ui and log files
|
|
|
|
|
|
|
|
|
|
* **Parameters:**
|
|
|
|
|
* **priority** (*int*) – Priority of message to be passed to logging
|
|
|
|
|
* **message** (*str*) – Message to log
|
|
|
|
|
* **Return type:**
|
|
|
|
|
None
|
|
|
|
|
|
2024-07-29 03:47:27 +00:00
|
|
|
|
#### *async* monitor()
|
|
|
|
|
|
|
|
|
|
Monitor and log ram and cpu usage
|
|
|
|
|
|
|
|
|
|
#### *async* spongeListen()
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
Loop to watch for tasks to do
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
|
|
|
|
`Filters.base.sieve`
|
|
|
|
|
: Packet filtering/parsing
|
|
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
|
|
|
|
We use a common technique here that calls the function from our preloaded actions via dictionary entry
|