294 Commits

Author SHA1 Message Date
Aarsh Shah
00fffba0aa Update dht_bootstrap.go
1) on connecting to a new peer  -> trigger self & bucket bootstrap if RT size goes below thereshold
2) accept formatting & doc suggestions in the review
3) remove RT recovery code for now -> will address in a separate PR once #383 goes in

changes as per review
2019-10-11 14:10:19 +09:00
Aarsh Shah
f4630f62d5 1) seed RT whenever it becomes empty
2) seed RT if empty before starting bootstrap incase 1 hasn't fired
3) pass bootstrap config as option while creating Dht
4) replace all bootstrap function with 1 function
2019-10-11 13:17:36 +09:00
Steven Allen
232357eab2 chore: smaller diff 2019-10-11 13:14:07 +09:00
aarshkshah1992
585d6725be refresh a bucket whenever we lookup a key in it 2019-10-11 13:13:53 +09:00
Aarsh Shah
f7353aac3b reset timer on bucket 2019-10-11 13:13:53 +09:00
Raúl Kripalani
fed99afe6e
Make routing table bucket size configurable (#396) 2019-10-04 22:12:00 +09:00
Aarsh Shah
36578e2be3 Striped locks for atomic Dht updates (#374)
Implement striped locking for datastore puts.
2019-07-22 20:47:45 -07:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Adrian Lanzafame
cf9bd9b649 Add opencensus basic metrics (#317)
Add initial set of metrics exposed via OpenCensus.
2019-04-15 13:18:47 +10:00
Matt Joiner
86d78dc072
golangci-lint run -D errcheck (#298) 2019-03-14 11:07:15 +11:00
Matt Joiner
08c34b4d83
New node methods for tools and otherwise (#265)
* Add IpfsDHT.{Bootstrap{Random,Self},Peer{Id,Key}}
* Include client mode tests, support for Ping, and uncruft setupDHTs
* Include xerrors in deps
2019-03-06 08:10:38 +11:00
Raúl Kripalani
120a585ebf Revert "Test go mod in travis and use major versioning in import paths (#236)"
This reverts commit 7e68ac3c60c15243c7d2e622b91aed92245a2677.
2019-02-12 14:12:53 +00:00
Adrian Lanzafame
7e68ac3c60 Test go mod in travis and use major versioning in import paths (#236) 2019-02-12 17:38:06 +11:00
Matt Joiner
8b37385468 Rename log to logger 2019-02-03 13:14:35 +11:00
Matt Joiner
2d2bb5513c
Tidy up bootstrapping (#235)
* Remove signal bootstrapping

Remove IpfsDHT.BootstrapOnSignal.

* Type check expected interfaces on IpfsDHT

* Simplify the bootstrap logic

* Tidy up a few other things

* Include BootstrapOnce

* Add comment about duplicating sanity checks

* Use existing import naming convention

* Defer error wrapping until we need it

* Restore existing query count behaviour
2019-01-31 10:06:56 +11:00
Steven Allen
201eea5e0b
Revert "Tidy up bootstrapping" 2019-01-24 14:06:38 -08:00
Matt Joiner
f91dc28913 Type check expected interfaces on IpfsDHT 2019-01-24 09:52:55 +11:00
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