1215 Commits

Author SHA1 Message Date
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
github-actions[bot]
13d95b413c
chore: release 0.37.3 (#1237)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-10 07:49:49 +01:00
Alex Potsides
b0472686d2
fix: wait for peer stats to be updated during test (#1238)
The peer stats update interval doesn't always align with the timing
in the test so make sure it's elapsed before asserting on the results.

Fixes #1219
2022-06-08 10:47:41 -05:00
Alex Potsides
f9073ecd21
fix: connection pruning (#1235)
Actually prune connections when we reach the connection limit
2022-06-08 16:20:56 +01:00
Alex Potsides
eee256db8a
fix: ensure streams are closed when protocol negotiation fails (#1236)
If an error is thrown during the initial stages of setting up a multiplexed stream, ensure we close the stream to free up any resources associated with it.
2022-06-08 08:29:32 +01:00
Alex Potsides
3babbbd75a
chore: update ipfs-http-client (#1234)
Updates to ESM version of ipfs-http-client
2022-06-06 15:04:00 +01:00
github-actions[bot]
893f8c280f
chore: release 0.37.2 (#1232)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.37.2
2022-05-31 17:45:54 +01:00
Alex Potsides
824720fb8f
fix: reduce identify message size limit (#1230)
Adds a config option to specify a maximum message size we'll accept
for an Identify message.

The default is 8KB, the same as go-libp2p - previously we fell back
to the default `maxMessageLength` option of `it-length-prefixed`
which is 4MB.

Also adds a default timeout for reading responses to identify
requests which is used if an AbortSignal is not passed in.

The default timeout also aligns with go-libp2p.
2022-05-31 17:10:40 +01:00
github-actions[bot]
4c0c2c6d3e
chore: release 0.37.1 (#1220)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.37.1
2022-05-26 08:30:50 +01:00
Alex Potsides
a1220d22f5
fix: time out slow reads (#1227)
There are a few places in the codebase where we send/receive data from the network without timeouts/abort controllers which means the user has to wait for the underlying socket to timeout which can take a long time depending on the platform, if at all.

This change ensures we can time out while running identify (both flavours), ping and fetch and adds tests to ensure there are no regressions.
2022-05-25 18:15:21 +01:00
Rakesh Shrestha
5934b13cce
Protocol muxing docs explanation (#1165)
* update examples

* prettier to single quotes

* protocol-muxing bidirectional code explanation

Co-authored-by: aomini daiki <rakesh.shrestha@hazesoft.co>
2022-05-24 10:34:22 -05:00
Alex Potsides
b09eb8fc53
fix: explicitly close streams when connnections close (#1221)
Make sure we don't leave streams open.

Updates all deps to close multiplexed streams when closing connections.
2022-05-23 13:45:20 +01:00
Robert Kiel
35f9c0c793
fix: fix unintended aborts in dialer (#1185)
Fix a bug where `DialRequest` can abort wrong dial attempts.

Co-authored-by: Robert Kiel <robert.kiel@hoprnet.io>
2022-05-18 14:53:58 +01:00
Alex Potsides
d5386df684
fix: do upnp hole punch after startup (#1217)
The transport manager configures it's addresses during the `start`
phase so access them during `afterStart` so they'll be ready for use.
2022-05-18 13:19:31 +01:00
Steve Loeppky
1f5d5c2de1
Added pubsub to the TOC (#1215) 2022-05-16 13:22:41 -05:00
github-actions[bot]
7678156cf3
chore: release 0.37.0 (#1178)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.37.0
2022-05-16 12:10:31 +01:00
Alex Potsides
f2fd4e30ff
docs: add migration guide (#1214)
Adds migration guide for `libp2p@0.37.x`
2022-05-16 10:58:56 +01:00
Alex Potsides
31480603f3
fix: simplify pnet exports (#1213)
Export the key generator from `libp2p/pnet`
2022-05-16 10:07:32 +01:00
Alex Potsides
4837430d8b
fix: encode enums correctly (#1210)
Updates protons and regenerates protobuf code to encode enums correctly
2022-05-10 12:35:33 +01:00
Alex Potsides
da3d19b309
fix: update interfaces (#1207)
Update to the latest interfaces version
2022-05-04 16:03:43 +01:00
Alex Potsides
a15254fdd4
fix: update to new interfaces (#1206)
Notably removes the `Dialer` interface as the `ConnectionManager` is now in charge of managing connections.
2022-05-04 10:19:04 +01:00
tuyennhv
d16817ca44
fix: emit peer:connect after all (#1171)
**Motivation**

In lodestar, when we handle "peer:connect" event, we dial the peer which gives another "peer:connect" event and it causes other issues

**Motivation**

In `onConnect` function, "peer:connect" event should be emitted after we add connection to the `connections` map so that when app dial the peer in "peer:connect" event handler, it uses the same/existing connection
2022-04-22 20:56:47 +01:00
Alex Potsides
fab4f1385c
fix: update pubsub interfaces (#1194)
Update to latest version of pubsub interface
2022-04-22 20:49:35 +01:00
Alex Potsides
5397137c65
fix: use placeholder dht/pubsub (#1193)
Instead of making the `.dht` and `.pubsub` properties optional, use dummy implementations that throw exceptions if they are not configured.

This way we don't have to null guard everywhere they are accessed.
2022-04-21 15:46:06 +01:00
Alex Potsides
147304449e
fix: expose getPublicKey (#1188)
This is used externally by IPFS so expose the method
2022-04-14 18:00:21 +01:00
Alex Potsides
1b9bab68ed
chore: update deps (#1190) 2022-04-14 08:05:43 +01:00
Alex Potsides
c64a586a20
chore: update aegir to the latest version (#1186)
Removes boilerplate config that is no longer necessary
2022-04-09 09:26:25 +01:00
Alex Potsides
64bfcee509
fix: expose metrics and registrar, use dht for peer discovery (#1183)
Exposes fields used by bitswap and also uses dht for peer discovery which was missed.
2022-04-02 10:11:01 +01:00
Alex Potsides
cc60cfde1a
fix: add transport manager to exports map and fix docs (#1182)
Addresses PR comments from #1172 - fixes syntax of examples in docs, adds the transport manager to the exports map and renames fault tolerance enum for consistency.
2022-03-29 15:39:50 +01:00
Alex Potsides
8cca8e4bfc
fix: update deps (#1181)
Update to released versions of interop suite and webrtc-direct
2022-03-28 16:09:43 +01:00