1244 Commits

Author SHA1 Message Date
github-actions[bot]
6ac62da025
chore: release 0.39.3 (#1392)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-03 15:07:18 +01:00
dependabot[bot]
806804ac88
chore(deps-dev): bump @libp2p/bootstrap from 2.0.1 to 3.0.0 (#1391)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-28 13:51:16 +01:00
Alex Potsides
0ecc02b2a4
docs: update delegated routing example readme (#1390) 2022-09-23 09:34:54 +01:00
Alex Potsides
ec02351e65
fix: when creating dial targets, encapsulate PeerIds last (#1389)
It turns out because `Multiaddr.encapsulate` stringifies the `Multiaddr`
it's a [suprisingly expensive operation](https://github.com/multiformats/js-multiaddr/pull/275#issuecomment-1254981709)
so here we switch the order of our `Multiaddr` pipeline around so
we filter undialable addresses (e.g. unsupported transports etc) before
encapsulating the `PeerId` onto a `Multiaddr` we'd then just ignore.
2022-09-23 10:33:42 +02:00
Alex Potsides
3f57edaf3b
fix: yield only final peers from dht getClosestPeers (#1380)
* fix: yield final peers from dht getClosestPeers

`PEER_RESPONSE` is an intermediate event, we should only yield from `FINAL_PEER` events as we'll only get `K` of those.

* chore: fix test
2022-09-23 10:31:04 +02:00
Saul
62198414b3
docs: fix examples in documentation (#1379)
This PR fixes all the errors in the code snippets in the readme files contained in the examples directory and it fixes the doc/GETTING_STARTED.md file.

I have also updated the old package names, e.g. `libp2p-websockets` -> `@libp2p/websockets`.

Resolves #1367 and resolves #1361

Co-authored-by: saul <saul@organicdesign.nz>
2022-09-22 18:40:33 +01:00
Christoph Müller
a11260c753
docs: update noise package name in instructions (#1383)
libp2p-noise has been moved to @chainsafe/libp2p-noise
2022-09-22 18:36:55 +01:00
github-actions[bot]
a4ac534252
chore: release 0.39.2 (#1388)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-21 14:57:07 +01:00
Alex Potsides
633d4a9740
fix: remove ipfs dependency and upgrade multiaddr (#1387)
- Upgrades @multiformats/multiaddr to 11.0.0
- Removes ipfs-http-client and delegate router dependencies
- Test delegation using interface stubs instead of implementations
2022-09-21 14:41:20 +01:00
libp2p-mgmt-read-write[bot]
a4566ede92
chore: Update .github/workflows/stale.yml [skip ci] 2022-09-19 13:40:57 +00:00
github-actions[bot]
111e75d05e
chore: release 0.39.1 (#1376)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-11 09:04:59 +01:00
Alex Potsides
0218acfae2
fix: report dialer metrics (#1377)
Converts the dialer to a component so it can access metrics
2022-09-09 19:00:11 +01:00
Cayman
b87632f97f fix: add yamux interop tests (#1290)
Test stream compatibility with https://www.npmjs.com/package/@chainsafe/libp2p-yamux

Co-authored-by: achingbrain <alex@achingbrain.net>
2022-09-09 16:24:59 +01:00
dependabot[bot]
dd14f82ed5
deps(dev): bump ipfs-http-client from 57.0.3 to 58.0.0 (#1369)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-08 12:47:31 +01:00
Alex Potsides
43b0418998
fix: overwrite stream fields after handshake (#1305)
Instead of creating a new stream objects instead just overwrite the duplex fields with ones from the mss stream.
2022-09-08 12:47:03 +01:00
github-actions[bot]
d63e08115b
chore: release 0.39.0 (#1359)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-07 10:58:36 +01:00
tabcat
57ef75493d
docs: re-add talks section (#1368)
The libp2p <3 ethereum video seems to have been moved to https://archive.devcon.org/archive/watch/2/libp2p-devp2p-ipfs-and-ethereum-networking/
unfortunately couldn't find the slides and demos previously linked
2022-09-07 10:57:39 +01:00
Marin Petrunić
d281a60dac
fix: discovery mechanism examples not working (#1365)
Co-authored-by: achingbrain <alex@achingbrain.net>- fixed tests that were passing even though the example isn't working
- added timeouts to avoid infinite wait

Fixes #1229
2022-09-05 15:17:35 +01:00
Alex Potsides
fc2224a1e8
deps: update tcp (#1366) 2022-09-05 11:21:31 +01:00
Alex Potsides
0e7096d527
docs: update message filtering example (#1362)
Updates the example to use the new pubsub `addEventListener`-style API along with the README.

Also updates the test to actually test that the relevant messages were received.

Fixes https://github.com/libp2p/js-libp2p/issues/1288
2022-08-30 09:33:39 +01:00
Alex Potsides
1f38ab7ac8
fix!: load self key into keychain on startup if not present (#1357)
To prevent triggering keychain attack prevention on startup, refactor the `KeyChain` class to load the current PeerId as the `'self'` key on startup.

Fixes #1315

BREAKING CHANGE: the `loadKeychain` method has been removed as it is no longer necessary
2022-08-17 21:34:57 +01:00
github-actions[bot]
29c803a63e
chore: release 0.38.0 (#1253)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-08-17 20:39:29 +01:00
Alex Potsides
41990421bf
deps: update node-forge to 1.3.1 to slience automated warnings (#1358)
Fixes #1351
2022-08-17 20:27:57 +01:00
Alex Potsides
509e56a603
fix: prepend connection addr to circuit relay address (#1355)
Otherwise the reported remote addr is not valid
2022-08-15 09:20:05 +01:00
Alex Potsides
886759b7fb
fix: catch errors when reconnecting old peers (#1352)
Since we don't wait for successful reconnection to existing peers,
the peerstore can be closed while we're accessing it since we might
be shut down right after we've started up, e.g. during test runs so
just log any reconnect errors instead of throwing.
2022-08-14 11:14:18 +01:00
Alex Potsides
2262f81924
deps: update wherearewe@2.0.0 (#1350) 2022-08-13 18:27:12 +01:00
Alex Potsides
6630cb19b9
deps: update interface-datastore and datastore-core (#1347) 2022-08-12 13:29:34 +01:00
Cayman
8880eefa8f
fix: add successful stream peer to protobook (#1341)
* fix: add successful stream peer to protobook

If a protocol stream has been successfully negotiated and is to be
psased to the application, the peerstore should ensure that the peer is
registerd with that protocol.

* fix: upgrader test fix
2022-08-11 10:48:16 -05:00
Alex Potsides
f439d9b589
deps!: update all deps to support no-copy operations (#1335)
Updates all deps needed to support passing lists of byte arrays where they have been created from multiple input buffers.

When reading multiplexed data, all messages arrive in length-prefixed buffers, which means the first few bytes tell the consumer how many bytes long next chunk will be.

One length prefixed chunk can be delivered in several payloads from the underlying network transport. The first payload can also include the length prefix and some or all of the data, so we stitch these together in a `Uint8ArrayList` to avoid having to concatenate `Uint8Array`s together.

Previously once we'd received enough bytes to satisfy the length prefix we'd concatenate the bytes together, but this is a potentially expensive operation where transports have small message sizes so instead just pass the `Uint8ArrayList` to the consumer and let them decide wether to concatenate or not as some consumers will be smart enough to operate on lists of `Uint8Array`s instead of always requiring a contiguous block of memory.

BREAKING CHANGE: Streams are now `Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>`
2022-08-11 13:21:04 +01:00
Alex Potsides
564f4b8aa7
deps: update it-length-prefix, uint8arraylist etc (#1317)
In order to support no-copy operations in streams, update all deps
to support streaming Uint8ArrayLists.
2022-08-03 14:15:35 +01:00
Alex Potsides
05e8e7ead9
fix: remove mplex prefix from muxer errors (#1304)
Muxer errors are now standard across implementations so do not
depend on the `"MPLEX_"` prefix
2022-07-25 13:37:31 +01:00
Alex Potsides
3c0fb13bab
fix: close streams when protocol limits are reached (#1301)
- If a stream is opened that exceeds inbound/outbound limits, reset that stream (if it is incoming) or abort and throw (if it is outgoing)
- Make the error message more helpful (say which protocol has breached the limit)
- Increase the default stream limits so we don't trigger this by accident when a remote dials us with a protocol we don't support
2022-07-22 13:57:01 +01:00
Roshan Singh
54450d4342
docs: removed talks section (#1300)
Removed "Talks" section as links are broken.
2022-07-21 13:46:39 +01:00
Alex Potsides
627b8bf87c
fix: MaxListenersExceeded warning (#1297)
Where we create signals that are passed down the stack, increase the max listeners to prevent warnings in the console.
2022-07-17 08:25:21 +00:00
Alex Potsides
ba56c64662
fix: add timeout for circuit relay (#1294)
Make sure we don't potentially wait forever during incoming circuit relay handshakes.

Adds a timeout option to the hop config to control how long we will wait.
2022-07-15 16:36:31 +00:00
Alex Potsides
0bb1b802c8
feat: programmatically set agentVersion for use in identify (#1296)
If no `agentVersion` is provided for the Identify protocol, the default `AGENT_VERSION` will now be set to
* `js-libp2p/<libp2p.version> UserAgent=<process.version>` when running in Node.js
* `js-libp2p/<libp2p.version> UserAgent=<navigator.userAgent>` when running in the browser (also when running in a webworker)

Fixes #686
Supersedes #1240

Co-authored-by: Kevin Westphal <westphal@consider-it.de>
Co-authored-by: Kevin <56823591+6d7a@users.noreply.github.com>
2022-07-15 16:35:52 +00:00
Konosuke Kachi
6eaab2e3ee
docs: update transport example (#1268) 2022-07-15 15:27:26 +00:00
Alex Potsides
750ed9c35f
fix: add timeout for incoming connections and build-in protocols (#1292)
Ensure that we don't wait forever for upgrading an inbound connection
to occur.

Note that transports should return an AbortableSource when passed an
AbortSignal so outbound connections to not need the same fix.

Also adds default timeouts for the ping, fetch, and identify protocols.
2022-07-14 13:35:12 +00:00
Cayman
b1b91398e2
fix: update muxer behavior (#1289)
- use `direction` in `muxerFactory.createStreamMuxer`
- use `muxer.close` instead of `muxer.streams.forEach(s => s.close())`
2022-07-14 12:03:06 +00:00
Alex Potsides
e6f646ed36
chore: update deps (#1285) 2022-07-01 18:33:17 +02:00
Alex Potsides
5af93883ce
chore: update deps (#1284)
Update libp2p deps
2022-06-29 06:59:51 +01:00
Alex Potsides
2836acc90f
fix: use keep-alive tag to reconnect to peers on startup (#1278)
Instead of trying to connect to every peer in the peer store when
we start a node, only connect to the peers that have been marked
with a `keep-alive` tag.
2022-06-28 08:05:16 +01:00
Alex Potsides
b1b2b216da
feat!: use tag values to choose which connections to close (#1276)
Uses peer tag values to select low-value connections to prune when we have too many connections open.

BREAKING CHANGE: `connectionManager.peerValue` has been removed, use `peerStore.tagPeer` instead
2022-06-27 15:34:03 +01:00
Alex Potsides
ceb44f9e98
docs: add build step to docs (#1275)
Now that we need to build ts to js a build step is necessary.

Add it to the instructions where we are telling people to clone the repo first.

Refs: #1273
2022-06-24 16:28:56 +01:00
dependabot[bot]
b270527c8f
chore(deps-dev): bump @libp2p/webrtc-star from 2.0.1 to 3.0.0 (#1266)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-24 13:33:37 +01:00
Vasco Santos
676cee2947
docs: update websockets import var (#1274) 2022-06-24 14:33:28 +02:00
dependabot[bot]
a5077cbc6b
chore(deps-dev): bump @chainsafe/libp2p-noise from 6.2.0 to 7.0.1 (#1272)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-24 13:16:32 +01:00
Alex Potsides
de30c2cec7
feat!: limit protocol streams per-connection (#1255)
* feat: limit protocol streams per-connection

Uses the `maxInboundStreams` and `maxOutboundStreams` of the `registrar.handle`
opts to limit the number of concurrent streams open on each connection
on a per-protocol basis.

Both values default to 1 so some tuning will be necessary to set
appropriate values for some protocols.

* chore: make error codes consistent

* chore: fix up examples
2022-06-17 15:46:31 +02:00
Alex Potsides
5371729646
fix: specify max stream args separately (#1254) 2022-06-16 08:37:58 +01:00
Alex Potsides
d4dd664071
feat!: update libp2p interfaces (#1252)
BREAKING CHANGE: uses new single-issue libp2p interface modules
2022-06-15 18:30:39 +01:00