added some more readmes
This commit is contained in:
parent
636cf3a8d1
commit
76356d5e3f
9
onionr/apiservers/README.md
Normal file
9
onionr/apiservers/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# API Servers
|
||||
|
||||
Contains the WSGI servers Onionr uses for remote peer communication and local daemon control
|
||||
|
||||
## Files
|
||||
|
||||
* \_\_init\_\_.py: Exposes the server classes
|
||||
* private: Contains the client API (the server used to interact with the local Onionr daemon, and view the web UI)
|
||||
* public: Contains the public API (the server used by remote peers to talk to our daemon)
|
8
onionr/apiservers/private/README.md
Normal file
8
onionr/apiservers/private/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Private API Server
|
||||
|
||||
Private API server, used to access the web interface locally and control Onionr
|
||||
|
||||
## Files
|
||||
|
||||
* \_\_init\_\_.py: Sets up the server and a few misc functions
|
||||
* register_private_blueprints.py: Adds in flask blueprints for various sub-APIs
|
@ -72,7 +72,7 @@ class PrivateAPI:
|
||||
'''
|
||||
Validate that the client token matches the given token. Used to prevent CSRF and data exfiltration
|
||||
'''
|
||||
if len(self.clientToken) == 0:
|
||||
if not self.clientToken:
|
||||
logger.error("client password needs to be set")
|
||||
return False
|
||||
try:
|
||||
|
@ -5,11 +5,11 @@ Onionr communicator is the Onionr client. It "connects" to remote Onionr peers a
|
||||
* Finding new peers
|
||||
* Uploading blocks
|
||||
* Downloading blocks
|
||||
* Daemon maintnence/housekeeping
|
||||
* Daemon maintenance/housekeeping
|
||||
|
||||
## Files
|
||||
|
||||
* \_\_init\_\_.py: Contains the main communicator code. Inits and launches the communicator and sets up the timers
|
||||
* peeraction.py: contains a function to send commands to remote peers
|
||||
* bootstrappers.py: adds peers from the bootstrap list to the communicator to try to connect to them
|
||||
* onlinepers: management of the online peer pool for the communicator
|
||||
* onlinepeers: management of the online peer pool for the communicator
|
12
onionr/communicator/onlinepeers/README.md
Normal file
12
onionr/communicator/onlinepeers/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Online Peers
|
||||
|
||||
Manages a pool of peers to perform actions with. Since Onionr does not maintain socket connections, it holds a list of peers.
|
||||
|
||||
|
||||
## Files
|
||||
|
||||
* \_\_init\_\_.py: exposes some functions to interact with the pool
|
||||
* clearofflinepeer.py: Pop the oldest peer in the offline list
|
||||
* onlinepeers.py: communicator timer to add new peers to the pool randomly
|
||||
* pickonlinepeers.py: returns a random peer from the online pool
|
||||
* removeonlinepeer.py: removes a specified peer from the online pool
|
@ -20,16 +20,16 @@
|
||||
import secrets
|
||||
def pick_online_peer(comm_inst):
|
||||
'''randomly picks peer from pool without bias (using secrets module)'''
|
||||
retData = ''
|
||||
ret_data = ''
|
||||
while True:
|
||||
peerLength = len(comm_inst.onlinePeers)
|
||||
if peerLength <= 0:
|
||||
peer_length = len(comm_inst.onlinePeers)
|
||||
if peer_length <= 0:
|
||||
break
|
||||
try:
|
||||
# get a random online peer, securely. May get stuck in loop if network is lost or if all peers in pool magically disconnect at once
|
||||
retData = comm_inst.onlinePeers[secrets.randbelow(peerLength)]
|
||||
ret_data = comm_inst.onlinePeers[secrets.randbelow(peer_length)]
|
||||
except IndexError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
return retData
|
||||
return ret_data
|
Loading…
Reference in New Issue
Block a user