319 Commits

Author SHA1 Message Date
Steven Allen
c68c7e3fa5 chore: get rid of xerrors
go 1.14 is now required anyways
2020-03-22 15:22:21 -07:00
David Dias
ad27ebcfa7
feat: Expose the ProviderManager through the IpfsDht struct (#491)
* feat: Expose the ProviderManager through the IpfsDht struct
* feat: expose providers prefix so that we do not have to hard code it in other places

Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
2020-03-13 09:53:26 -07:00
Aarsh Shah
14422102c9 close context correctly 2020-03-04 17:28:50 +05:30
Vibhav Pant
28f2f2ab96
Provide the entire config object to makeDHT. 2020-02-18 16:18:52 +05:30
Vibhav Pant
fececcc819
Make the Routing Table's latency tolerance configurable. 2020-02-17 20:06:29 +05:30
Aarsh Shah
50d524dfbb remove incorrect doc 2020-02-04 10:22:28 +05:30
Adin Schmahmann
5d2e3df37d make all key types loggable 2019-12-19 12:04:25 -05:00
Adin Schmahmann
3e24f352aa provider record keys can be an arbitrary byte array less than 80 bytes instead of only a multihash 2019-12-19 12:00:51 -05:00
Adin Schmahmann
a4b38eebee feat(dht): provider records use multihashes instead of CIDs 2019-12-19 12:00:51 -05:00
Steven Allen
2e6adb8c2b
Merge pull request #400 from libp2p/feat/disable-providers
feat: allow disabling value and provider storage/messages
2019-12-12 18:05:53 +01:00
Henrique Dias
0449555dde make BaseConnMgrScore const
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
2019-12-12 17:56:30 +01:00
Henrique Dias
e4dae1c931 call it common prefix len
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
2019-12-12 17:55:50 +01:00
Henrique Dias
dca21f6a05 fix: prioritize closer peers
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
2019-12-12 17:17:45 +01:00
Steven Allen
0be0cbc50e feat: refresh and wait
We'd like to be able to refresh then _wait_ for the refresh to finish in the testground DHT tests. That way, we can:

1. Start and disable _auto_ refresh.
2. Bootstrap.
3. Refresh a couple of times till we're stable.
4. Wait to _stop_ refreshing.
5. Disconnect from and forget about all peers _not_ in our routing tables.
6. Run the actual tests without interference from the bootstrapping logic.
2019-12-10 15:41:20 +01:00
Steven Allen
c2b72b250d doc(options): document that disabling values/providers should only be done on forked dhts 2019-12-05 19:11:46 -05:00
Steven Allen
52747fc1f0 feat: allow disabling value and provider storage/messages
fixes #274
2019-12-05 19:11:46 -05:00
Steven Allen
0d48254082 chore(dep): update
Update deps:

* Switch to multiformats/go-base32
* Regenerate protobuf decoding code
2019-12-02 13:05:53 -05:00
Aarsh Shah
7a39667d70 make max record age configurable 2019-11-15 10:54:09 +08:00
Raúl Kripalani
a33b0b97a4 inline struct for RoutingTable config. 2019-11-05 23:55:32 +00:00
Steven Allen
ef319676a9 chore: rename bootstrap to refresh
As pointed out by raul, bootstrapping and refreshing are not the same thing.
Bootstrapping is the initial setup (i.e., connect to some initial nodes to get
started). Refreshing is the process of refreshing the routing table.
2019-11-05 23:33:53 +00:00
Steven Allen
ed244cd485 feat(bootstrap): simplify bootstrapping
* Rename triggerAutoBootstrap to autoBootstrap. This variable used to control
_triggering_ only but now completely disables automatic bootstrapping.
* Remove the BootstrapConfig. We introduced this before we switched to
functional options. Now that we're breaking the interfaces anyways, we might as
well use functional options all the way (easier to extend).
* Always query self (feedback from @raulk).
* Important: don't abort the bootstrap process if we timeout finding ourselves.
2019-11-05 22:33:05 +00:00
Steven Allen
98cf91494d chore(bootstrap): remove unecessary request structure 2019-11-05 11:15:23 +00:00
Aarsh Shah
da6edafb21 make Bootstrap() async and latestSelfWalk a dht field 2019-11-02 11:37:44 +08:00
Aarsh Shah
7cce5bdd96 make bootstrap synchronous & get tests to work 2019-11-02 00:37:15 +08:00
Steven Allen
e2842f0317 feat(bootstrap): autobootstrap
1. Auto bootstrap on start.
2. Make `Bootstrap(ctx)` trigger a bootstrap but not _start_ the bootstrapping
   process.
2019-11-01 00:38:28 -07:00
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