I think it's time to move a lot of the peer-to-peer networking
but-not-ipfs-specific things into its own package: p2p.
This could in the future be split off into its own library.
The first thing to go is the peer.
I needed the network implementation in its own
package, because I'll be writing several services that
will plug into _it_ that shouldn't be part of the core net
package. and then there were dependency conflicts. yay.
mux + identify are good examples of what i mean.
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
@jbenet @whyrusleeping
the pyramids were built one brick at a time
addresses: https://github.com/jbenet/go-ipfs/issues/370
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet @whyrusleeping @mappum
very helpful for tracking down errors. the stack traces are only
shown when debug mode is visible. They function best when caught at the
source.
I propose we use this errors package as a drop-in replacement for
fmt.Errorf and errors.New in all of our code, and use errors.Wrap for
external errors as they emerge from others' libraries.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
@jbenet @whyrusleeping @mappum
If we permit initialization in `ipfs daemon`, then we must ensure that
the node instantiated in `ipfs init` (to create the welcome file) shuts
down and releases resources.
Kept running into "resource temporarily unavailable". Discovered that it
was our cousins Jeff and Sanjay over at LevelDB Ave.
go-datastore doesn't expose Close() so I extended the TsDs interface and
submitted a patch.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>