2024-08-01 22:03:59 +00:00
|
|
|
|
<a id="run-piermesh-service-runner"></a>
|
|
|
|
|
|
2024-08-01 01:00:46 +00:00
|
|
|
|
# run: PierMesh service runner
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
### *class* run.Node
|
|
|
|
|
|
2024-08-01 01:00:46 +00:00
|
|
|
|
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 03:47:27 +00:00
|
|
|
|
#### 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:**
|
2024-08-01 01:00:46 +00:00
|
|
|
|
[Daisy](/PierMesh/piermesh/src/branch/main/docs/Daisy/Daisy.md#Daisy.Daisy.Daisy)
|
2024-07-29 03:47:27 +00:00
|
|
|
|
|
|
|
|
|
#### onodeID
|
|
|
|
|
|
|
|
|
|
PierMesh node ID
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
str
|
|
|
|
|
|
2024-08-01 21:09:50 +00:00
|
|
|
|
#### oTransceiver
|
2024-07-29 03:47:27 +00:00
|
|
|
|
|
2024-08-01 21:09:50 +00:00
|
|
|
|
LoRa transceiver Transceiver
|
2024-07-29 03:47:27 +00:00
|
|
|
|
|
|
|
|
|
* **Type:**
|
2024-08-01 21:09:50 +00:00
|
|
|
|
[Transceiver](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver)
|
2024-07-29 03:47:27 +00:00
|
|
|
|
|
|
|
|
|
#### proc
|
|
|
|
|
|
|
|
|
|
This process (psutil.Process), used for managing and monitoring PierMesh
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
psutil.Process
|
|
|
|
|
|
|
|
|
|
#### mTasks
|
|
|
|
|
|
|
|
|
|
Dictionary of PierMesh service tasks
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
dict
|
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
#### *async* action_addPSK(data)
|
2024-07-29 03:47:27 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
Action to add PSK for specific node, currently unused
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
#### *async* action_hop(data)
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
Proxy a request to the main internet (in the future cross protocol/link)
|
|
|
|
|
|
|
|
|
|
#### *async* action_initCryptography(data: dict)
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
Initialize AES-GCM encrypted transport session
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
#### SEE ALSO
|
|
|
|
|
[`Cryptography.WhaleSong.Transport`](/PierMesh/piermesh/src/branch/main/docs/Cryptography/WhaleSong.md#Cryptography.WhaleSong.Transport)
|
|
|
|
|
: End to end encryption functionality
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
#### *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-11-26 17:43:02 +00:00
|
|
|
|
: Layered graph network representation
|
|
|
|
|
|
|
|
|
|
#### *async* action_routeCatch(data: dict)
|
|
|
|
|
|
|
|
|
|
Route received catch to peer who requested it
|
|
|
|
|
|
|
|
|
|
#### *async* action_routeHop(data: dict)
|
|
|
|
|
|
|
|
|
|
Return proxy request results to requester
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
#### *async* action_sendCatch(data: dict)
|
|
|
|
|
|
|
|
|
|
Get catch and return the data to a peer
|
|
|
|
|
|
|
|
|
|
#### *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
|
2024-08-01 01:00:46 +00:00
|
|
|
|
`Sponge.Protocols`
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Protocol based packet filtering
|
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
[`Splash.serve.Server`](/PierMesh/piermesh/src/branch/main/docs/Splash/serve.md#Splash.serve.Server)
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Runs a light Microdot web server with http/s and websocket functionality
|
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
[`Splash.serve.Server.sendToPeer`](/PierMesh/piermesh/src/branch/main/docs/Splash/serve.md#Splash.serve.Server.sendToPeer)
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Function to actually execute the action
|
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
#### *async* action_syncIndex(data: dict)
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
Add received index entries to Catch via the a remote Catch index
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-11-26 17:43:02 +00:00
|
|
|
|
#### *async* fsInit()
|
|
|
|
|
|
|
|
|
|
Initialize the file system for use
|
|
|
|
|
|
|
|
|
|
#### *async* main()
|
|
|
|
|
|
|
|
|
|
Main loop, sets up the message listening, system monitoring and server running loops
|
|
|
|
|
|
|
|
|
|
#### *async* monitor()
|
|
|
|
|
|
|
|
|
|
Monitor and log ram and cpu usage
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
2024-07-29 03:47:27 +00:00
|
|
|
|
#### *async* spongeListen()
|
2024-07-28 11:21:15 +00:00
|
|
|
|
|
|
|
|
|
Loop to watch for tasks to do
|
|
|
|
|
|
|
|
|
|
#### SEE ALSO
|
2024-08-01 01:00:46 +00:00
|
|
|
|
`Sponge.base.sieve`
|
2024-07-28 11:21:15 +00:00
|
|
|
|
: Packet filtering/parsing
|
|
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
|
|
|
|
We use a common technique here that calls the function from our preloaded actions via dictionary entry
|