braidpool
braidpool copied to clipboard
Integrate libp2p: peer discovery
- Use Kademlia to obtain a list of peers
- Connect to each peer and send a ping message
- Write a peer selection function that will use a heuristic on both latency (recorded from the ping messages) and Kademlia xor distance to obtain a set of peers spanning the entire range in latency.
- Start some data structures to keep statics on peers: a. Connection attempts/successes b. Connection drops c. Garbled/undecodable messages/packet loss d. Running tally of latency, and the std. deviation of latency e. Did we have to hole punch this peer?
- Cache the peer data structure by writing it in ~/.braidpool so it survives restarts.
With hole punching it's important to find a peer that is "between" both peers in terms of latency. Determine if there's anything we can add in the peer data structure that is useful for this.