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.
to improve SnR. Feel free to contest these changes if you find these
statements useful. In my experience, they were adding noise at Info.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
With the new msgio, we no longer need to bound message sizes for
the sake of buffers. MaxMessageSize should remain though in order
to prevent streaming of huge things. In general, messages shouldn't
be above one MB. This max is now set to 4MB.
If a block happens to be larger, we should split it up.
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)
@jbenet we may want to consider setting the default type to Remote. I
left the default as Unspecified just for safety.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
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)