Commit Graph

1164 Commits

Author SHA1 Message Date
3cfe4bbfac docs: update auto relay example code usage (#1163)
Co-authored-by: aomini daiki <rakesh.shrestha@hazesoft.co>
2022-02-28 17:46:56 +01:00
6a3e37f250 chore: update js-interfaces URL in examples/transports README (#1150) 2022-02-01 10:11:19 +01:00
bad9e8c0ff chore: release 0.36.2 (#1147)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.36.2
2022-01-26 11:03:09 +00:00
902f10d58d fix: reject connections when not running (#1146)
When the node is shutting down, new connections can still be received.

If this happens we can end up writing into the datastore when it's
been closed which throws an error.

Instead, if we're not running, have the connection manager close new
incoming connections.
2022-01-26 10:52:23 +00:00
fc12973344 chore: release 0.36.1 (#1145)
### [0.36.1](https://www.github.com/libp2p/js-libp2p/compare/v0.36.0...v0.36.1) (2022-01-25)


### Bug Fixes

* await unhandle of protocols ([#1144](https://www.github.com/libp2p/js-libp2p/issues/1144)) ([d44bd90](d44bd9094f))
---

This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.36.1
2022-01-25 20:09:03 +00:00
d44bd9094f fix: await unhandle of protocols (#1144)
To allow us to shut down cleanly, we must wait the unhandling of protocols - this is because they write the new list of protocols into the datastore which might also be in the process of shutting down.
2022-01-25 19:56:56 +00:00
831ed39701 chore: release 0.36.0 (#1127)
## [0.36.0](https://www.github.com/libp2p/js-libp2p/compare/v0.35.8...v0.36.0) (2022-01-25)

### ⚠ BREAKING CHANGES

* abort-controller dep is gone from dependency tree
* `libp2p.handle`, `libp2p.registrar.register` and the peerstore methods have become async

### Features

* add fetch protocol ([#1036](https://www.github.com/libp2p/js-libp2p/issues/1036)) ([d8ceb0b](d8ceb0bc66))
* async peerstore backed by datastores ([#1058](https://www.github.com/libp2p/js-libp2p/issues/1058)) ([978eb36](978eb3676f))
* connection gater ([#1142](https://www.github.com/libp2p/js-libp2p/issues/1142)) ([ff32eba](ff32eba6a0))


### Bug Fixes

* cache build artefacts ([#1091](https://www.github.com/libp2p/js-libp2p/issues/1091)) ([5043cd5](5043cd5643))
* catch errors during identify ([#1138](https://www.github.com/libp2p/js-libp2p/issues/1138)) ([12f1bb0](12f1bb0aee))
* import uint8arrays package in example ([#1083](https://www.github.com/libp2p/js-libp2p/issues/1083)) ([c3700f5](c3700f55d5))
* make tests more reliable ([#1139](https://www.github.com/libp2p/js-libp2p/issues/1139)) ([b7e8706](b7e87066a6))
* prevent auto-dialer from dialing self ([#1104](https://www.github.com/libp2p/js-libp2p/issues/1104)) ([9b22c6e](9b22c6e2f9))
* remove abort-controller dep ([#1095](https://www.github.com/libp2p/js-libp2p/issues/1095)) ([0a4dc54](0a4dc54d08))
* try all peer addresses when dialing a relay ([#1140](https://www.github.com/libp2p/js-libp2p/issues/1140)) ([63aa480](63aa480800))
* update any-signal and timeout-abort-controller ([#1128](https://www.github.com/libp2p/js-libp2p/issues/1128)) ([e0354b4](e0354b4c6b))
* update multistream select ([#1136](https://www.github.com/libp2p/js-libp2p/issues/1136)) ([00e4959](00e49592a3))
* update node-forge ([#1133](https://www.github.com/libp2p/js-libp2p/issues/1133)) ([a4bba35](a4bba35948))
---

This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.36.0
2022-01-25 16:43:46 +00:00
ff32eba6a0 feat: connection gater (#1142)
Port of https://github.com/libp2p/go-libp2p-core/blob/master/connmgr/gater.go

Adds a new configuration key `connectionGater` which allows denying the dialing of certain peers, individual multiaddrs and the creation of connections at certain points in the connection flow.

Fixes: https://github.com/libp2p/js-libp2p/issues/175
Refs: https://github.com/libp2p/js-libp2p/issues/744
Refs: https://github.com/libp2p/js-libp2p/issues/769

Co-authored-by: mzdws <8580712+mzdws@user.noreply.gitee.com>
2022-01-25 16:27:01 +00:00
9b22c6e2f9 fix: prevent auto-dialer from dialing self (#1104)
Co-authored-by: Robert Kiel <robert.kiel@hoprnet.io>
Co-authored-by: achingbrain <alex@achingbrain.net>
2022-01-24 17:59:14 +00:00
d8ceb0bc66 feat: add fetch protocol (#1036)
Adds three methods to implement the `/libp2p/fetch/0.0.1` protocol:

* `libp2p.fetch(peerId, key) => Promise<Uint8Array>`
* `libp2p.fetchService.registerLookupFunction(prefix, lookupFunction)`
* `libp2p.fetchService.unRegisterLookupFunction(prefix, [lookupFunction])`

Co-authored-by: achingbrain <alex@achingbrain.net>
2022-01-24 17:07:11 +00:00
00e49592a3 fix: update multistream select (#1136)
It has types now so the ignore can be removed.
2022-01-21 18:13:33 +00:00
63aa480800 fix: try all peer addresses when dialing a relay (#1140)
The order of the addresses can affect our success rate in dialing a
relay - if it's a loopback address or similar it won't work.

Instead try dialing every address.
2022-01-21 11:57:09 -06:00
b7e87066a6 fix: make tests more reliable (#1139)
Try to use only public functions and properties to verify test behaviour
2022-01-21 12:58:31 +00:00
4c3bf01f35 chore: fix flaky tests (#1137)
These tests are flaky in CI, probably due to differences in timing introduced by #1058

Fixes #1134
2022-01-21 08:44:13 +00:00
12f1bb0aee fix: catch errors during identify (#1138)
Sometimes identify can be started while we are shutting down (for
example) - we should just log these errors.
2022-01-21 08:26:21 +00:00
a4bba35948 fix: update node-forge (#1133)
Upgrade to 1v of node-forge
2022-01-20 19:23:24 +00:00
fc43db750d chore: fix build on webworkers 2022-01-20 17:33:58 +00:00
bf1fc325b6 chore: add registry 2022-01-20 17:21:48 +00:00
79b356a313 chore: update var name 2022-01-20 16:52:30 +00:00
54e77221eb chore: fix publish command 2022-01-20 16:27:01 +00:00
85e23eb1cb chore: unpack node_module cache before rc publish (#1132) 2022-01-20 15:21:42 +00:00
cbd9bad86d chore: run test after build (#1130)
Run CI tests and check at the same time
2022-01-20 14:52:31 +00:00
75b922dc21 chore: checkout code and set up node for publishing rc (#1131)
Need to run the checkout and setup-node actions before publishing an RC.
2022-01-20 14:52:12 +00:00
280bb1b1f6 chore: autopublish next version (#1129)
If we aren't releasing a version on a given release run, publish an rc under the `next` tag instead.
2022-01-20 14:24:06 +00:00
e0354b4c6b fix: update any-signal and timeout-abort-controller (#1128)
Updates deps to remove abort controller dep

BREAKING CHANGE: abort-controller dep is gone from dependency tree
2022-01-20 14:17:41 +00:00
0264eb62ee chore: update example tests (#1126)
Remove some of the redundancy in the example tests
2022-01-20 13:33:01 +00:00
a0bfe8b534 chore: restore correct cache 2022-01-20 13:32:25 +00:00
2963b852db chore: add automated releases (#1124)
Adds release-please github action to create gated releases and a release issue that tracks all issues that will be in a release.
2022-01-20 13:19:38 +00:00
13d45de376 chore: add missing cache dir (#1125)
Fixes ci config
2022-01-20 12:37:52 +00:00
978eb3676f feat: async peerstore backed by datastores (#1058)
We have a peerstore that keeps all data for all observed peers in memory with no eviction.

This is fine when you don't discover many peers but when using the DHT you encounter a significant number of peers so our peer storage grows and grows over time.

We have a persistent peer store, but it just periodically writes peers into the datastore to be read at startup, still keeping them in memory.

It also means a restart doesn't give you any temporary reprieve from the memory leak as the previously observed peer data is read into memory at startup.

This change refactors the peerstore to use a datastore by default, reading and writing peer info as it arrives.  It can be configured with a MemoryDatastore if desired.

It was necessary to change the peerstore and *book interfaces to be asynchronous since the datastore api is asynchronous.

BREAKING CHANGE: `libp2p.handle`, `libp2p.registrar.register` and the peerstore methods have become async
2022-01-20 12:03:35 +00:00
0a4dc54d08 fix: remove abort-controller dep (#1095)
The `AbortController` class is supported by browsers and node 14+ - we only support node 16+ (e.g. LTS+Current) so the `abort-controller` module isn't needed any more.
2022-01-20 12:02:13 +00:00
c3700f55d5 fix: import uint8arrays package in example (#1083) 2022-01-14 16:33:17 +01:00
96d3461393 docs: Include loadkeychain in the index (#1087) 2022-01-10 11:56:08 +01:00
5e5d11ec19 docs: fix import of datastore-level (#1086) 2022-01-08 17:57:37 +01:00
4cadbad102 chore: remove pubsub dev deps (#1107) 2022-01-07 11:40:05 +01:00
5043cd5643 fix: cache build artefacts (#1091)
To speed up the build and make it more reliable, cache the node_modules
folder, dist, etc and re-use on each step.
2021-12-29 15:06:58 +01:00
ef54e0a10e chore: release version v0.35.8 v0.35.8 2021-12-29 11:00:11 +01:00
61bf546c46 chore: update contributors 2021-12-29 11:00:11 +01:00
d2b7ec0f6b fix: look for final peer event instead of peer response (#1092)
`FINAL_PEER` means we found the peer, `PEER_RESPONSE` means a peer
responded to our query.
2021-12-29 10:56:56 +01:00
79b3cfc6ad fix: do not wait for autodial start (#1089)
When we've previously seen loads of peers and stored them in the
datastore we'll try to dial them as part of starting the autodial
component.

If we or our peers have bad network connections this can make
starting a libp2p node take ages so don't wait for a round of auto
dialing before considering the component started.
2021-12-29 10:55:48 +01:00
f18fc80b70 fix: increase listeners on any-signal (#1084)
Increase the number of listeners we allow on the actual signal we pass along, instead of the signal we pass into any-signal.
2021-12-29 10:51:26 +01:00
b4b432406e fix: record tracked map clears (#1085)
Record the size of a map after we `.clear()` it.
2021-12-27 07:14:27 +01:00
bbdd559a02 chore: release version v0.35.7 v0.35.7 2021-12-24 14:51:51 +00:00
4070dcdf55 chore: update contributors 2021-12-24 14:51:51 +00:00
cb0d7d6c99 fix: type definitions for big dialrequest and persistent peerstore (#1078)
Signed-off-by: Tuyen Nguyen <vutuyen2636@gmail.com>
2021-12-24 15:46:00 +01:00
d1c48dcbed fix: main ci (#1079) 2021-12-24 11:18:09 +01:00
c4a442788b docs: update example config ipfs links (#1077) 2021-12-22 17:03:03 +01:00
70a4bb9451 docs: peerstore configuration datastore fixed 2021-12-22 14:15:18 +01:00
a0516ebc85 docs: update node and npm version badge according to package.json (#1074) 2021-12-22 14:01:54 +01:00
b425fa1230 fix: add tracked map (#1069)
Small refactor of the component stats - adds a `TrackedMap` which encapsulates updating the metrics and means we don't need to null guard on `this._metrics` everywhere.

If metrics are not enabled a regular `Map` is used.
2021-12-21 15:51:06 +01:00