43 Commits

Author SHA1 Message Date
Juan Batiz-Benet
f972c759dd dht: debug dont cast Key as peer.ID 2015-01-05 00:16:52 -08:00
Juan Batiz-Benet
719cd7c51c swap net2 -> net 2015-01-02 08:46:46 -08:00
Juan Batiz-Benet
2b086634b2 introducing p2p pkg
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.
2015-01-02 08:46:45 -08:00
Jeromy
0408e60ef6 some better logging and cleanup 2015-01-02 07:42:08 +00:00
Jeromy
0547622e00 rewrite of provides to better select peers to send RPCs to
refactor test peer creation to be deterministic and reliable

a bit of cleanup trying to figure out TestGetFailure

add test to verify deterministic peer creation

switch put RPC over to use getClosestPeers

rm 0xDEADC0DE

fix queries not searching peer if its not actually closer
2015-01-02 07:42:07 +00:00
Juan Batiz-Benet
b408265be0 dht bootstrap err check fix + logging 2014-12-24 02:10:52 -08:00
Juan Batiz-Benet
a367a22bbe dht: bit nicer logging 2014-12-23 08:46:30 -08:00
Juan Batiz-Benet
3b37c43171 peer change: peer.Peer -> peer.ID
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
2014-12-23 08:33:32 -08:00
Juan Batiz-Benet
fac6fe1e73 Integrated new network into ipfs 2014-12-16 14:47:29 -08:00
Jeromy
c459776cde rewrite FindProvidersAsync 2014-12-11 05:09:03 +00:00
Juan Batiz-Benet
a718944be1 dht: FindPeersConnectedToPeer 2014-12-08 20:52:46 -08:00
Juan Batiz-Benet
e1b5933641 dht/pb: changed PeersToPBPeers to set ConnectionType
Uses an inet.Dialer
2014-12-08 20:52:45 -08:00
Juan Batiz-Benet
fb367a8619 dht: changed msgs, include multiple addrs + conn type
See https://github.com/jbenet/go-ipfs/issues/153#issuecomment-63350535
2014-12-08 20:52:34 -08:00
Brian Tiger Chow
add43e52a4 fix(dht/routing) make GetProviders respect context
This commit makes GetProviders (sync) respect the request context. It
also amends all of GetProviders' callsites to pass a context in. This
meant changing the signature of the dht's handlerfunc.

I think I'll start referring to the request context as Vito Corleone.

cc @whyrusleeping @jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-05 20:56:27 -08:00
Jeromy
cd4baf2245 make vendor 2014-11-16 02:45:19 -08:00
Jeromy
1e7e59f0c4 fix validators and key prefix 2014-11-16 02:45:19 -08:00
Jeromy
cac56033a9 switch DHT entries over to be records, test currently fail 2014-11-16 02:45:19 -08:00
Jeromy
6d4ac99351 more doc comments 2014-11-08 22:44:37 -08:00
Juan Batiz-Benet
be52e35ed7 dht ctxcloserify 2014-10-25 21:33:59 -07:00
Jeromy
1c9b21063d lots of logging 2014-10-26 00:45:40 +00:00
Brian Tiger Chow
1024504a6f refactor(dht/pb) move proto to pb package 2014-10-25 04:13:28 -07:00
Juan Batiz-Benet
2aeefaa102 go-vet friendly codebase
- distinguish log.Error and log.Errorf functions
- Initialize structs with field names
- A bit of unreachable code (defers)
2014-10-25 03:46:39 -07:00
Juan Batiz-Benet
840a868c6f notes 2014-10-22 03:24:05 -07:00
Jeromy
9f4bdde9b8 working on debugging dht issues 2014-10-22 03:24:05 -07:00
Juan Batiz-Benet
3b15457cf0 renamed datastore.go -> go-datastore 2014-10-21 15:10:58 -07:00
Juan Batiz-Benet
28e083b902 peer.Peer is now an interface
![](http://m.memegen.com/77n7dk.jpg)
2014-10-20 03:26:46 -07:00
Jeromy
9dbba5c6d0 some dht cleanup, and make DHTs take a master context 2014-10-18 04:28:26 -07:00
Jeromy
34452f1678 fix bug in diagnostics, and add more peers to closer peer responses 2014-10-18 04:28:25 -07:00
Juan Batiz-Benet
4429ee65e3 logging + tweaks 2014-10-18 04:28:24 -07:00
Juan Batiz-Benet
5fe1399bab dht handleAddProviders adds addr in msg
Otherwise don't have the peer's target address.
2014-10-18 04:28:24 -07:00
Jeromy
52fca5a91e add in some extra debug logging, and increase routing table latencies 2014-10-08 21:55:50 +00:00
Juan Batiz-Benet
740b381804 changed logging, in dht and elsewhere
- use log.* instead of u.*
- use automatic type conversions to .String()
  (Peer.String() prints nicely, and avoids calling b58 encoding
  until needed)
2014-10-07 21:33:59 -07:00
Juan Batiz-Benet
129ac6aaa6 use string datastore keys. 2014-10-03 15:39:22 -07:00
Juan Batiz-Benet
00659cbb7e ping: return sme msg
This fixes the broken pinging. (the issue was the cluster
level, it's bein set incorrectly (off by one))

Anyway, this works now:

    [peer: QmfQTbC3LxfpK5WoyHW2WgnAzo6d6GePuq2wHTsJNXM5PS] Sent message type: 'PING' [to = QmNXUeFrV9gxR4aqJddEsfhWZLSJrUsfpUSeRb3R7xvSp9]
    [QmfQTbC3LxfpK5WoyHW2WgnAzo6d6GePuq2wHTsJNXM5PS] ping QmNXUeFrV9gxR4aqJddEsfhWZLSJrUsfpUSeRb3R7xvSp9 end (err = %!s(<nil>))

cc @whyrusleeping
2014-09-23 05:23:54 -07:00
Juan Batiz-Benet
0a9810a150 dht tests pass again 2014-09-22 04:06:16 -07:00
Juan Batiz-Benet
34e171e2b3 fixed get/put 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
709f932e6e Fixed connections all over. 2014-09-22 04:06:12 -07:00
Juan Batiz-Benet
45796e5fdf remove start 2014-09-22 04:05:23 -07:00
Juan Batiz-Benet
b5f0a42bd6 better query processing (runner) 2014-09-22 04:05:22 -07:00
Juan Batiz-Benet
fdea4d9c5f got everything to build 2014-09-22 04:05:21 -07:00
Juan Batiz-Benet
fa2b736bbe newMessage and more impl. 2014-09-22 04:05:19 -07:00
Juan Batiz-Benet
4366f4a031 uncomment all handlers 2014-09-22 04:05:18 -07:00
Juan Batiz-Benet
6ed2d45182 moved handlers to own file 2014-09-22 04:05:17 -07:00