this is a major refactor of the entire codebase
it changes the monolithic peer.Peer into using
a peer.ID and a peer.Peerstore.
Other changes:
- removed handshake3.
- testutil vastly simplified peer
- secio bugfix + debugging logs
- testutil: RandKeyPair
- backpressure bugfix: w.o.w.
- peer: added hex enc/dec
- peer: added a PeerInfo struct
PeerInfo is a small struct used to pass around a peer with
a set of addresses and keys. This is not meant to be a
complete view of the system, but rather to model updates to
the peerstore. It is used by things like the routing system.
- updated peer/queue + peerset
- latency metrics
- testutil: use crand for PeerID gen
RandPeerID generates random "valid" peer IDs. it does not
NEED to generate keys because it is as if we lost the key
right away. fine to read some randomness and hash it. to
generate proper keys and an ID, use:
sk, pk, _ := testutil.RandKeyPair()
id, _ := peer.IDFromPublicKey(pk)
Also added RandPeerIDFatal helper
- removed old spipe
- updated seccat
- core: cleanup initIdentity
- removed old getFromPeerList
This commit changes the connections to use io.ReadWriters
instead of channels (+ async workers). This is a pretty
big change -- away from csp -- in the name of performance
(and predictable flow control).
It also uses the brand new secio, which is spipe's successor.
+/- if len(addresses) is 0, connSetup will be called with nil value for c.
+/- avoid variable reassignment
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
For simplicity this is sequential. This will be bad latency given
RTTs for all the handshakes, etc. Later on can make async or
at least open based on some priority of the channel.
I broke out multiaddr/net to its own package so
that multiaddr parsing could remain lean. multiaddr-net
will vendor special implementations of protocols (like utp)
The check needed knowledge of the _listen_ addresses,
not just the interface addresses. Also, the handshake now
sends out all the addresses we accumulate about ourselves.
(this may be bad in the long run, but useful now to test)