1119 Commits

Author SHA1 Message Date
Vasco Santos
d1c48dcbed
fix: main ci (#1079) 2021-12-24 11:18:09 +01:00
Vít Habada
c4a442788b
docs: update example config ipfs links (#1077) 2021-12-22 17:03:03 +01:00
Vít Habada
70a4bb9451
docs: peerstore configuration datastore fixed 2021-12-22 14:15:18 +01:00
Tim Daubenschütz
a0516ebc85
docs: update node and npm version badge according to package.json (#1074) 2021-12-22 14:01:54 +01:00
Alex Potsides
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
achingbrain
0a485d07b3 chore: release version v0.35.6 v0.35.6 2021-12-18 07:55:27 +01:00
achingbrain
0c3ed0a4ac chore: update contributors 2021-12-18 07:55:26 +01:00
Alex Potsides
09a0f940df
fix: increase the maxlisteners for timeout controllers (#1065)
We use timeout controllers to ensure we're not dialling peers forever but we can end up registering lots of listeners for the `abort` event when peers have a lot of addresses.

In node this means we see an unhelpful `MaxListenersExceededWarning` in the console warning of a potential memory leak.

Increase the max number of listeners on the signal to silence the warning.
2021-12-18 07:34:27 +01:00
Alex Potsides
a642ad2a03
chore(deps-dev): bump libp2p-floodsub from 0.27.1 to 0.28.0 (#1062)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-15 09:30:49 +00:00
achingbrain
8ce2f08589 chore: release version v0.35.5 v0.35.5 2021-12-15 09:28:05 +00:00
achingbrain
fe0d9828bb chore: update contributors 2021-12-15 09:28:04 +00:00
achingbrain
c8e1b08c19 chore: typo 2021-12-15 09:25:40 +00:00
achingbrain
faf1f89d9e chore: release version v0.35.4 v0.35.4 2021-12-15 08:18:44 +00:00
achingbrain
76f4ea5e8a chore: update contributors 2021-12-15 08:18:44 +00:00
Alex Potsides
2f0b311df7
feat: allow per-component metrics to be collected (#1061)
Implements the idea from #1060 - allows us to get some insight into what's happening in a libp2p node out side of just bandwidth stats.

Configures a few default metrics if metrics are enabled - current connections, the state of the dial queue, etc.

Also makes the `Metrics` class not depend on the `ConnectionManager` class, otherwise we can't collect simple metrics from the connection manager class due to the circular dependency.
2021-12-15 08:03:09 +00:00
achingbrain
d172d0d952 chore: release version v0.35.3 v0.35.3 2021-12-13 09:03:54 +00:00
achingbrain
f8e8023aed chore: update contributors 2021-12-13 09:03:54 +00:00
Alex Potsides
bdc9f16d0c
fix: clean up pending dial targets (#1059)
If the `Promise.race` throws, execution of the function is terminated so the pending dial target is never removed from the map and we leak memory.

This can happen when there are invalid multiaddrs or when a peer reports more dialable addresses than the threshold.

Instead wrap the `Promise.race` in a `try/finally` which will always remove the pending dial target in the event of success or failure.
2021-12-10 12:42:09 +00:00
Alex Potsides
1b46f47fdb
chore: run node tests in ci (#1057)
Looks like this project stopped running the `test:node` npm script when it was migrated to gh actions.

Re-enable it and fix all the related test failures.
2021-12-08 08:38:17 +00:00
dependabot[bot]
b539f9b655
chore(deps-dev): bump libp2p-gossipsub from 0.11.4 to 0.12.1 (#1045)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-07 21:06:06 +00:00
dependabot[bot]
103818733e
chore(deps-dev): bump @chainsafe/libp2p-noise from 4.1.1 to 5.0.0 (#1053)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-07 21:05:53 +00:00
Marston Connell
1f1bbc0ee6
docs: naming error in the documentation (#1056)
Changed LevelStore to LevelDatastore
2021-12-07 21:05:33 +00:00
Robert Kiel
3b683e7156
fix: fix uncaught promise rejection when finding peers (#1044)
Do not abort all attempts to find peers when `findPeers` on one router throws synchronously

Co-authored-by: Robert Kiel <robert.kiel@hoprnet.io>
Co-authored-by: achingbrain <alex@achingbrain.net>
2021-12-07 17:51:48 +00:00
Alex Potsides
b25e0fe531
fix: make error codes consistent (#1054)
Sometimes they are `NOT_FOUND`, sometimes `ERR_NOT_FOUND`, etc.

Move all error codes into `errors.js` and reference them from there.
2021-12-07 14:42:10 +00:00
Alex Potsides
cbaa5a2ef3
chore: switch to nat api (#1052)
@motrix/nat-api is a fork, nat-api has the fix from https://github.com/alxhotel/nat-api/pull/25
2021-12-07 09:37:12 +00:00
Alan Smithee
51dabb1724
chore: pubsub example subscribe returns void (#1048)
Seems like the correct return type of `Libp2p.pubsub.subscribe` is `void`, so the `await` can be removed: ae21299ade/src/pubsub-adapter.js (L29)
2021-12-06 21:12:38 +01:00
Vasco Santos
b9339bccaa chore: release version v0.35.2 v0.35.2 2021-12-06 21:07:39 +01:00
Vasco Santos
9b21893b64 chore: update contributors 2021-12-06 21:07:38 +01:00
Alex Potsides
b70fb43427
fix: increase maxlisteners on event target (#1050)
Sometimes you encounter peers with lots of addresses. When this happens
you can attach more than 10x event listeners to the abort signal we
use to abort all the dials - this causes node to print a warning
which is misleading.

This PR increases the default number of listeners on the signal.

Fixes #900
2021-12-06 20:54:44 +01:00
achingbrain
ae21299ade chore: release version v0.35.1 v0.35.1 2021-12-03 16:24:14 +00:00
achingbrain
149120bebc chore: update contributors 2021-12-03 16:24:13 +00:00
Alex Potsides
91c2ec9856
fix: do not let closest peers run forever (#1047)
The DHT takes a `signal` not a timeout so if a timeout is passed,
create a `TimeoutController` that will abort the query after the
timeout.
2021-12-03 15:47:30 +00:00
achingbrain
6d0ac819f1 chore: release version v0.35.0 v0.35.0 2021-12-02 10:44:07 +00:00
achingbrain
15a0b1dbf2 chore: update contributors 2021-12-02 10:44:07 +00:00
Alex Potsides
9cbf36fcb5
chore: update peer id and libp2p crypto (#1042)
BREAKING CHANGE: requires node 15+
2021-12-02 10:11:23 +00:00
Alex Potsides
3a9d5f64d9
fix: stop dht before connection manager (#1041)
Stop the dht before the connection manager, otherwise in-flight eviction pings fail and we move on to the next one when we should just abort them all.

Also pulls in the fix from #1039 and splits the auto-dialler out from the connection manager as during shutdown it can get into a weird state where it's simultaneously killing and creating connections so stop auto-dialling things before we cause connections to dip below the low watermark by killing existing connections.

Fixes: https://github.com/ipfs/js-ipfs/issues/3923
2021-11-30 18:07:57 +00:00
Alex Potsides
eacd7e8f76
chore: update deps (#1038) 2021-11-26 16:00:47 +00:00
dependabot[bot]
7f2cc4dc44
chore(deps-dev): bump ipfs-http-client from 52.0.5 to 54.0.2 (#1035)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-26 14:26:26 +00:00
achingbrain
5cc5a8749a chore: release version v0.34.0 v0.34.0 2021-11-25 16:49:46 +00:00
achingbrain
ee60e18213 chore: update contributors 2021-11-25 16:49:46 +00:00
achingbrain
a4a2fac41e chore: node_modules is not required 2021-11-25 16:48:41 +00:00
Alex Potsides
2f598eba09
feat: update dht (#1009)
Changes dht creation to use factory function and updates docs

BREAKING CHANGE: libp2p-kad-dht has a new event-based API which is exposed as `_dht`
2021-11-25 16:32:19 +00:00
Alan Smithee
443a102528
docs: minor corrections to discovery-mechanisms readme (#1030) 2021-11-21 23:18:45 +01:00
Alex Potsides
3bed7b4cb2
chore: update aegir (#1027)
Updates aegir, fixes all new linting errors.
2021-11-19 08:02:24 +00:00
Alex Potsides
3fb424914f
chore: fix examples (#1026)
Uses npm to install deps for examples.

We can put yarn back when we remove `node-fetch@2.x` from ipfs-utils, or when
yarn can download tarball dependencies reliably.

This either needs:

1. https://github.com/node-fetch/node-fetch/pull/1172 merging
2. Swap node-fetch for undici
3. Drop CJS support (node-fetch 3 has the above fix but is ESM-only)
2021-11-19 07:26:38 +00:00
patrickwoodhead
bb0ca28195
docs: update connection link in API docs (#1024)
Fixes #1018

The issue was caused when the repo [js-libp2p-interfaces](https://github.com/libp2p/js-libp2p-interfaces) was renamed and refactored in this [commit](946348f7f8)
2021-11-16 15:55:00 +00:00
TheStarBoys
01a8b8da9b
chore: example docs for auto-relay with correct port 2021-11-12 10:50:11 +01:00
Vasco Santos
77d7cb8f08
fix: private ip ts compile has no call signatures (#1020) 2021-11-12 10:34:44 +01:00
Robert Kiel
a335fda852
docs: fix datastore link (#999) 2021-09-27 12:42:53 +02:00
Vasco Santos
43e3af0c12
chore: add migration guide to 0.33 (#997) 2021-09-24 11:33:59 +02:00