Add Connectivity documentation

This commit is contained in:
Kleissner
2021-04-05 18:43:59 +02:00
parent b2cbe2d066
commit 7927e18572

View File

@@ -65,6 +65,42 @@ The name of the config file is passed to the function `LoadConfig`. If it does n
The Private Key is required to make any changes to the user's blockchain, including deleting, renaming, and adding files on Peernet, or nuking the blockchain. If the private key is lost, no write access will be possible. Users should always create a secure backup of their private key.
## Connectivity
### Bootstrap Strategy
* Connection to root peers (initial seed list):
* Immediate contact to all root peers.
* Phase 1: First 10 minutes. Try every 7 seconds to connect to all root peers until at least 2 peers connected.
* Phase 2: After that (if not 2 peers), try every 5 minutes to connect to remaining root peers for a maximum of 1 hour.
* Local peer discovery via IPv4 Broadcast and IPv6 Multicast:
* Send out immediately when starting.
* Phase 1: Resend every 10 seconds until at least 1 peer in the peer list.
* Phase 2: Every 10 minutes.
### Ping
The Ping/Pong commands are used to verify whether connections remain valid. They are only sent in absence of any other commands in the defined timeframe.
* Active connections
* Invalidate if 'Last packet in' was older than 22 seconds ago.
* Send ping if last ping and 'Last packet in' was earlier than 10 seconds.
* Redundant connections to the same peer (= any connections exceeding the 1 main active one): Mentioned times are multiplied by 4.
* Inactive connections
* If inactive for 120 seconds, remove the connection.
* If there are no connections (neither active/inactive) to the peer, remove it.
* Send ping if last ping was earlier than 10 seconds.
Above limits are constants and can be adjusted in the code via `pingTime`, `connectionInvalidate`, and `connectionRemove`.
### Kademlia
TBD
### Ongoing Peerlist Exchange
TBD
## Contributing
Please note that by contributing code, documentation, ideas, snippets, or any other intellectual property you agree that you have all the necessary rights and you agree that we, the Peernet organization, may use it for any purpose.