129 Commits

Author SHA1 Message Date
Aarsh Shah
1eb70081cb fixed tests 2020-04-01 15:31:57 +05:30
Aarsh Shah
c2a3f218c3 new RT management policy 2020-03-31 19:14:11 +05:30
Aarsh Shah
fbb1b3668a RT connectivity changes 2020-03-10 14:51:28 -07:00
Adin Schmahmann
7ada018b2a Upgrade DHT version (#479)
* upgraded the protocol id to version 2 (i.e. /kad/2.0.0) and made it so v2 peers running in server mode respond to queries from v1 peers. Note: v2 peers will only send queries using the v2 protocol, will only add v2 peers to their routing tables, and will only tell v1 peers about v2 peers.
* to run a forked network we now use network specific protocol prefixes instead of manually setting protocol IDs. Use the ProtocolPrefix option instead of the Protocols option.
* emit errors during initialization if the user misuses the default protocol prefix by setting parameters inconsistent with the default protocol's network specification
* since the Client option has been deprecated it's been removed from the dht's options. While deprecated it is still available in the dht options package. Setting `Client(false)` now puts the node into ModeAuto.
2020-03-10 16:22:41 -04:00
Steven Allen
d440bbf0c4 feat: move options to main package and make internals private (#486)
* feat: move options to main package and make internals private

Rationale:

1. This allows us to make private options for testing.
2. This removes an import for DHT users.
3. This makes options much easier to discover.
4. This makes it possible to make the config/options internals private.

We originally put them in a sub-package to avoid poluting the root namespace,
but that isn't really necessary.

This keeps the old package (for now) to avoid breaking too much.
2020-03-10 16:21:56 -04:00
Adin Schmahmann
c24a52fc7c
Enable switching DHT between client and server modes (#469)
* created Mode(ModeOpt) option for choosing between auto/client/server modes
* Auto mode internally switches the DHT between client and server modes based on the EvtLocalReachabilityChanged event emitted on the event bus (e.g. by AutoNAT)
* routing table management of peers that switch between client and server mode while we are connected to them (i.e. are in auto mode)
* removed Client(bool) option, becoming a DHT client is specified using Mode(ModeClient) instead
2020-03-06 14:56:03 -05:00
Steven Allen
e50572360e fix: improve context deadline handling
1. Continue to best-effort provide, but still return an error when we fail to
send provider records to the _best_ peers.
2. Continue returning the best peer's we've found in GetClosestPeers, but also
return an error to indicate that we didn't find the closest ones.

And fix the hang test.
2020-03-05 20:01:39 -08:00
Adin Schmahmann
5d313b134c Utilize identify events to add peers to the routing table (#472)
* feat: consume identify events to evaluate routing table addition
* fix: routing table no longer gets an update just because new messages have arrived or been sent
* fix: add already connected peers into the routing table before listening to events

Co-authored-by: Raúl Kripalani <raul.kripalani@gmail.com>
Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
2020-03-04 22:26:30 -08:00
Steven Allen
0b029388bd fix: obey the context when sending messages to peers
Related to #453 but not a fix. This will cause us to actually return early when
we start blocking on sending to some peers, but it won't really _unblock_ those
peers. For that, we need to write with a context.
2020-02-22 16:34:56 -05: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
Aarsh Shah
7cce5bdd96 make bootstrap synchronous & get tests to work 2019-11-02 00:37:15 +08:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01: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
Łukasz Magiera
6ca5dd7bf4 SearchValues: more review addressing 2018-08-10 12:06:32 +02:00
Łukasz Magiera
d72432caf1 SearchValue: address review 2018-08-10 12:06:32 +02:00
Łukasz Magiera
547c0a7170 SearchValue: simplify error handling further 2018-08-10 12:06:32 +02:00
Steven Allen
4d76fd28ed upgrade protobuf and switch to bytes keys
fixes #177
2018-08-07 18:50:04 -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
Dirk McCormick
a9c59f3f15 Remove record signature verification 2018-02-07 14:52:15 -08:00
Steven Allen
d3d572b74d Retry queries if a write to the stream fails.
Previously, we'd only retry when a write failed (in case the peer was using
single-use streams). However, in the new world of half-open streams, writes
still succeed on remote-closed streams so this isn't sufficient. Instead, we
need to retry on read failure as well.

Note: this was technically broken before because a peer could write on a stream
before receiving the close message causing the write to succeed but the
subsequent read to fail.
2017-09-14 10:30:52 -07:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
2604f3422f make go vet happy 2016-09-30 11:08:16 -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
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
Jakub Sztandera
22af8d1151 Update go-log in whole dependency tree (#2898)
* Update golog in go-ipfs

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-secio for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-crypto for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-peer for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Import peersore, it wasn't imported

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peerstore

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peer

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update secio

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-24 09:38:07 -07:00
Jeromy
47d10d7be6 update go-libp2p to 3.3.4
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-15 13:04:49 -07:00
Jakub Sztandera
3ac45d1425 Import go-datastore to gx
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-12 08:47:15 +02:00
Jakub Sztandera
441d33addf Remove go-datastore from Godeps
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-12 08:23:43 +02:00
Jeromy
63b6db0589 pull in libp2p updates with utp fixes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-11 10:33:44 -07:00
Jeromy Johnson
9454558e9d Merge pull request #2817 from ipfs/feat/dht-reuse-stream
reuse streams for dht messaging
2016-06-08 10:08:25 -07:00
Jeromy
71a8519372 update libp2p to version 3.2.2
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-07 00:20:06 -07:00
Jeromy
031024b1c5 reuse streams in the dht networking code
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-06 17:35:56 -07:00
Jeromy
5f777f323b update libp2p to v3.3.1
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-01 16:45:46 -07:00
Jeromy
b0e5f253f9 update libp2p to v3.2.3
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-30 22:14:21 -07:00
Jeromy
26beb1f3d0 update go-libp2p 3.2.2, nil maddr fixes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-17 10:23:10 -07:00
Jeromy
c81d962885 update libp2p to v3.2.1
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-16 11:22:36 -07:00
Jeromy
d6e7c3de0f update deps to introduce yamux hang fix
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-13 13:42:46 -07:00
Jeromy
b9f86c8c87 update libp2p with go-multiaddr and go-stream-muxer updates
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-10 16:06:28 -07:00
Jeromy
8cd54dd9d8 update libp2p with utp dep
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-04-27 14:10:54 -07:00