327 Commits

Author SHA1 Message Date
ZhengQi
9d60a686c0 add RoutingTable func (#217)
* add RoutingTable func

* fix gofmt
2019-01-22 04:46:41 +01:00
Gustvo Chain
70d5802fce Remove outdated package documentation
Both, dht.go and dht_bootstrap.go duplicate the package documentation.
The whole block had been moved to doc.go

Also query.go provides documentation for query package but now it
belongs to dht package, so it's been removed.
2019-01-09 14:21:14 +11:00
Marcin Tojek
28e7c7ac17 Rephrase "betterPeersToQuery" method comment to be less cryptic 2018-11-15 12:25:38 +01:00
Marcin Tojek
9afff7b2d7 Fix: typo in betterPeersToQuery 2018-11-15 12:24:01 +01:00
Kevin Atkinson
a303c45371 gx update and fix code to use new Cid type 2018-09-11 21:54:47 -04:00
Steven Allen
4d76fd28ed upgrade protobuf and switch to bytes keys
fixes #177
2018-08-07 18:50:04 -07:00
gpestana
95293f0f31 Idiomatic fixes 2018-08-03 09:34:37 +03:00
gpestana
17d72d8de5 Adds more and better logging 2018-08-02 17:22:59 +03:00
Steven Allen
2c8f3872f3 return info for connected peers in handleFindPeer
This way, users who are actually trying to find a peer (not just nodes near a
key in the DHT) can find that peer, even if they aren't a DHT server and/or
aren't in anyone's routing table.

fixes #161
2018-06-14 19:51:03 -07:00
Steven Allen
277f253733 fix getLocal error handling 2018-06-13 19:42:26 -07:00
Steven Allen
39907a7658 reuse getRecordFromDatastore in getValue
Also, double check the key (should be impossible but the check is cheep).
2018-06-13 16:59:12 -07:00
Steven Allen
53421fc17f
Merge pull request #155 from libp2p/fix/154
remove redundant error check
2018-06-07 00:00:41 +00:00
Steven Allen
eb07ccd9db remove redundant error check
fixes #154
2018-06-02 22:19:55 -07:00
Erin Swenson-Healey
53e314e449 initialize to length and then index into pstrs 2018-06-01 15:57:22 -07:00
Erin Swenson-Healey
d94deae41d make DHT protocols pluggable 2018-06-01 14:55:16 -07:00
Steven Allen
c0d3351b8d revert interface changes and add options
Instead of changing the existing constructors, add a new DHT constructor that
takes options (and add DHT options).
2018-05-31 17:54:24 -07:00
Steven Allen
3befc403d7 require that the validator be explicitly passed in
Note: this does mean that the DHT won't work with peer keys by default and that
the constructor signature changes. Given all the changes that'll come with the
libp2p refactor, I don't feel too bad about this.
2018-05-31 17:54:19 -07:00
Cole Brown
bf3ba207de Add explanation to NewDHT/NewDHTClient doc strings 2018-05-21 19:13:53 -04:00
Lars Gierth
db3b915a17 docs: remove mentions of coral, it's not implemented 2018-03-28 03:44:49 +02:00
ForrestWeston
024c67aea2 fix loggable collision on peer and target
License: MIT
Signed-off-by: ForrestWeston <forrest@protocol.ai>
2018-03-26 17:30:45 -07:00
Dirk McCormick
a9c59f3f15 Remove record signature verification 2018-02-07 14:52:15 -08:00
Steven Allen
36ae474bfd fix connection tracking race
Before, we could end up (e.g.):

1. Creating two connections (both sides connect at the same time).
2. Try to test with the first one.
3. The first connection dies.
4. Get a stream reset and think that the other side doesn't support the DHT
protocol.

We tried to fix this by checking for an EOF. Unfortunately, reset streams don't
return EOFs.

This commit also simplifies peer tracking (and saves a bit of memory).

fixes #99
2018-01-06 17:08:24 -08:00
ForrestWeston
24c9006902 Set errors on dht event logs
License: MIT
Signed-off-by: ForrestWeston <forrest@protocol.ai>
2017-12-11 14:00:21 -08:00
Steven Allen
491afc8e27 optimize allocations
Try to preallocate slices up-front instead of repeatedly reallocating.
2017-12-05 15:46:24 -08:00
Jeromy
bf8a57474f tag kbucket peers for better connection closing 2017-10-08 08:40:19 -07:00
Steven Allen
a1b973ce3c Properly track connections to peers in the DHT.
fixes #70
2017-07-27 14:52:44 -07:00
Jeromy
00b46e0cf7 Fixes for dht findpeer queries
First, we use Alpha instead of K as the number of peers we grab from the
routing table (as per the kademlia paper).

Second, we don't use a size limited set for the 'GetClosestPeers' query.
We're going to process more than K peers before we find the K closest
peers.

Third, Change GetClosestPeers to actually return the K Closest peers,
not a hodge podge of peers that it found on the way to finding the
closest peers.
2017-03-05 21:36:46 -08:00
Jeromy
fa1630a364 clean up logic in getcloserpeers 2017-03-05 20:17:38 -08:00
Jeromy
9f89eb51a9 update base32 package and fix tests 2016-11-21 20:10:14 -08:00
Jeromy Johnson
3ade5ff66d Merge pull request #32 from JustinDrake/patch-2
Remove diaglock as per #26
2016-11-16 14:11:51 -08:00
Jeromy Johnson
859ab8f149 Merge pull request #33 from JustinDrake/patch-3
Remove clientOnly as per #26
2016-11-16 14:11:40 -08:00
Jeromy
f2414416ce update cid package through tree 2016-11-15 16:45:12 -08:00
Justin
dd947df98e Remove clientOnly as per #26 2016-11-15 22:39:16 +00:00
Justin
baea5a35e0 Remove diaglock as per #26 2016-11-15 22:38:28 +00:00
Jeromy Johnson
3efe96023f Merge pull request #27 from JustinDrake/cleanup
DRY up NewDHT
2016-11-15 14:29:34 -08:00
Justin
88aba96b16 Remove outdated comment; fixes #23 2016-11-15 13:46:14 +00:00
Justin Drake
f292dcebaf DRY up NewDHT 2016-11-14 10:00:07 +00:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
e00b3ca0a4 use stdlib context and clean up deps 2016-09-30 10:24:03 -07:00
Jeromy
c372d79e42 switch to strings and cids instead of keys 2016-09-30 10:13:57 -07:00
Jeromy
5235d5f0d3 Implement 'client only' dht logic to not have to serve dht queries 2016-09-23 23:45:35 -07:00
Jeromy
e015b2a2f6 clean up dht construction code 2016-09-23 04:38:05 -07:00
Jeromy
d09b2e73d0 add back patch with protocol updates 2016-09-23 02:45:58 -07:00
George Antoniadis
9b3d1b5661 Bump deps, revert protobuf 2016-09-03 20:35:59 +01:00
George Antoniadis
30d43d22e0 Fix dependencies 2016-09-02 20:21:23 +01:00
George Antoniadis
5f3e63aa46 Undo gx rewrites and add gx package.json 2016-08-21 17:18:58 +01:00
Jeromy
1bd98f05f4 use batching datastore for providers storage
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-26 10:48:25 -07:00
Jeromy
95553964a2 update go-libp2p
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-04 12:27:26 -07:00
Jeromy
29c36b20d8 update go-datastore changes 0.1.2
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-01 22:40:57 -07:00
Jeromy
7c91e7bdd1 encode keys to datastore with base32 standard encoding
Fixes #2601

Also bump version to 0.4.3-dev

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-01 14:15:06 -07:00