2520 Commits

Author SHA1 Message Date
Max Inden
73dbde1519
refactor(perf): expose single latency measurement
Instead of exposing the time to establish a connection, the time to upload the bytes and the time to download the bytes, expose a single time including all three.

The rational here is, that differentiation of the three is flawed. E.g. when does one stop the upload timer and start the download timer? When the last byte is sent? When the last byte is flushed? When the first byte is received?

See https://github.com/libp2p/test-plans/pull/184#pullrequestreview-1482600521 for past discussion.

Pull-Request: #4105.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-26 03:56:17 +00:00
Max Inden
c1551d71b6
chore: prepare libp2p v0.52.1
Pull-Request: #4106.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-26 00:33:59 +00:00
Yiannis Marangos
85a846a7dd
feat(webtransport): add WebTransport for WASM environments
This PR implements `Transport` for WebTransport for browsers by using web-sys.

Related: #3846.
Resolves: #3825.

Pull-Request: #4015.


  
Co-Authored-By: Yiannis Marangos <yiannis@eiger.co>
  

  
Co-Authored-By: Maciej Zwoliński <mac.zwolinski@gmail.com>
  

  
Co-Authored-By: Yiannis Marangos <psyberbits@gmail.com>
2023-06-23 05:50:49 +00:00
Thomas Eizinger
b23a4a7b72
chore: add script for generating list of external contributors
Related: https://github.com/libp2p/blog/pull/84.

Pull-Request: #4095.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-22 10:34:39 +00:00
Max Inden
b3f48caf7e
fix(roadmap): correct table formatting
Pull-Request: #4100.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-22 06:53:05 +00:00
dependabot[bot]
59d17c206d
deps: bump wasm-bindgen-futures from 0.4.36 to 0.4.37
Pull-Request: #4082.
2023-06-21 13:12:22 +00:00
Anton
f8b3998661
deps(webrtc): update webrtc to 0.8.0
Pull-Request: #4099.


  
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
2023-06-21 09:11:32 +00:00
dependabot[bot]
e28f0326c7
deps: bump clap from 4.3.2 to 4.3.3
Pull-Request: #4061.
2023-06-20 15:23:15 +00:00
dependabot[bot]
8f9827043c
deps: bump js-sys from 0.3.63 to 0.3.64
Pull-Request: #4083.
2023-06-20 15:00:00 +00:00
dependabot[bot]
be54727326
deps: bump rustls from 0.21.1 to 0.21.2
Pull-Request: #4084.
2023-06-20 14:38:22 +00:00
dependabot[bot]
0d5c1eae16
deps: bump serde_json from 1.0.96 to 1.0.97
Pull-Request: #4085.
2023-06-20 14:16:12 +00:00
dependabot[bot]
84ccf26695
deps: bump wasm-bindgen from 0.2.86 to 0.2.87
Pull-Request: #4086.
2023-06-20 13:54:05 +00:00
dependabot[bot]
face06b05c
deps: bump arrayvec from 0.7.2 to 0.7.4
Pull-Request: #4087.
2023-06-20 13:32:36 +00:00
dependabot[bot]
04b7668c55
deps: bump sha2 from 0.10.6 to 0.10.7
Pull-Request: #4088.
2023-06-20 13:10:43 +00:00
dependabot[bot]
37d5174c7b
deps: bump actions/upload-pages-artifact from 1.0.8 to 1.0.9
Pull-Request: #4080.
2023-06-20 12:48:48 +00:00
Thomas Eizinger
78c150d0df
chore: don't use workspace inheritance for dev-dependencies
Using workspace inheritance breaks `cargo release` because it cannot resolve that the dev-dependencies should only use a `path` and not a version.

Pull-Request: #4097.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-20 12:24:28 +00:00
Max Inden
31da9b25c9
chore(roadmap): move QUIC hole punching to done
Pull-Request: #4096.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-20 10:45:58 +00:00
Max Inden
ce9821154a
fix(cargo.toml): specify muxer harness by path only
`libp2p-muxer-harness` is never published to crates.io. Specifying it with a version makes `cargo release` check crates.io for the the non-existing crate.

Pull-Request: #4093.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-20 10:20:27 +00:00
Max Inden
4195840f92
chore(roadmap): move kad client mode to done
Pull-Request: #4094.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-20 09:15:09 +00:00
Max Inden
fd803e2697
chore(quic,webrtc): prepare v0.8.0-alpha & v0.5.0-alpha
Pull-Request: #4089.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-20 07:27:10 +00:00
Thomas Eizinger
42566869b2
chore: use path dependencies for all cyclic dev-dependencies
We have two "interface" crates in our workspace: `libp2p-core` and `libp2p-swarm`. Most crates depend on both of these. To compile the tests for this crate, we often need a concrete implementation to some of these interfaces. When specifying a workspace-inherited dependency, we don't get to choose to omit the `version` field next to the path. If a dependency is `path`-only however, it will be tripped by `cargo` during the release process which is why all of this worked before our move to workspace inheritance.

With this patch, we change the minimum amount of dependencies necessary back to `path` dependencies to allowing releasing of our crates.

Related: #4053.

Pull-Request: #4091.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-20 06:42:53 +00:00
Thomas Eizinger
755de30757
fix(multistream-select): remove cyclic dependency to libp2p-core
All of the removed `dev-dependencies` are only for testing the upgrade procedure in `libp2p-core`. Ironically, this test does not use a single API of `multistream-select`. Thus, this test is simply misplaced in this crate. If we wanted to retain it, it should probably go into `libp2p` itself as that one already depends on all required crates.

Related: #4053.

Pull-Request: #4090.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-20 05:41:15 +00:00
Max Inden
8776fa8766
chore: prepare libp2p v0.52.0 release
Pull-Request: #4053.


  
Co-Authored-By: Max Inden <mail@max-inden.de>
  

  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-19 11:49:39 +00:00
Denis Garus
c4ab04c57c
feat(rendezvous): directly return error from register
Resolves #4070.

Pull-Request: #4073.
2023-06-17 11:19:41 +00:00
Denis Garus
b8ceeccdc6
refactor(rendezvous): rewrite using libp2p-request-response
Fixes [#3878](https://github.com/libp2p/rust-libp2p/issues/3878).

Pull-Request: #4051.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-14 17:49:23 +00:00
Thomas Eizinger
14530af261
ci: attribute co-authorship of a PR based on its commits
It often happens that multiple people contribute to a single PR. To correctly attribute authorship, GitHub supports the `Co-authored-by` convention. This line however needs to be at the very end of the commit message.

Because we are also automatically adding the pull-request number to the commit message, we cannot add these lines ourselves. Doing this manually is error-prone anyway so with this patch, we are extending the commit message template to automatically populate this from the commits within the pull request.

Pull-Request: #4069.
2023-06-14 18:00:19 +02:00
GitHub
2c6c058bb7 chore: Update .github/workflows/semantic-pull-request.yml [skip ci] 2023-06-14 09:04:10 +00:00
Yiannis M
755e3417f7
feat(noise): add WebTransport certhashes extension
The extension for WebTransport certhashes was added and can be configured via `Config::with_webtransport_certhashes`.

In case of initiator, these certhashes will be used to validate the ones reported by responder. In case of responder, these certhashes will be reported to initiator.

Resolves #3988.

Pull-Request: #3991.
2023-06-13 12:03:35 +00:00
Arpan Kapoor
cf3e4c6860
feat(quic): implement hole punching
Implement `Transport::dial_as_listener` for QUIC as specified by the [DCUtR spec](https://github.com/libp2p/specs/blob/master/relay/DCUtR.md).

To facilitate hole punching in QUIC, one side needs to send random UDP packets to establish a mapping in the routing table of the NAT device. If successful, our listener will emit a new inbound connection. This connection needs to then be sent to the dialing task. We achieve this by storing a `HashMap` of hole punch attempts indexed by the remote's `SocketAddr`. A matching incoming connection is then sent via a oneshot channel to the dialing task which continues with upgrading the connection.

Related #2883.

Pull-Request: #3964.
2023-06-13 11:42:18 +00:00
dependabot[bot]
2a6311f473
deps: bump serde from 1.0.163 to 1.0.164
Pull-Request: #4060.
2023-06-13 11:11:59 +00:00
dependabot[bot]
db93fa1657
deps: bump proc-macro2 from 1.0.59 to 1.0.60
Pull-Request: #4059.
2023-06-13 10:50:17 +00:00
dependabot[bot]
d263ee67a9
deps: bump log from 0.4.18 to 0.4.19
Pull-Request: #4058.
2023-06-13 10:29:36 +00:00
Thomas Eizinger
f93719cfd3
refactor(wasm-ext): replace parity-send-wrapper with send-wrapper
Co-authored-by: Yiannis Marangos <yiannis@eiger.co>

Related: #4065.

Pull-Request: #4066.
2023-06-12 16:14:42 +00:00
Nathaniel Cook
4a1703f046
feat(swarm): add ConnectionDenied::downcast_ref
Prior to this change it was only possible to downcast a `ConnectionDenied` error when you had ownership of it which isn't the case inside `NetworkBehaviour`s. This change allows downcasting by reference.

See https://github.com/libp2p/rust-libp2p/discussions/4018.

Pull-Request: #4020.
2023-06-12 15:26:09 +00:00
Max Inden
2910c985e8
fix(examples): call Swarm::add_external_address in dcutr and relay
> Observed addresses (aka. external address candidates) of the local node, reported by a remote node
> via `libp2p-identify`, are no longer automatically considered confirmed external addresses, in
> other words they are no longer trusted by default. Instead users need to confirm the reported
> observed address either manually, or by using `libp2p-autonat`. In trusted environments users can
> simply extract observed addresses from a `libp2p-identify::Event::Received { info:
> libp2p_identify::Info { observed_addr }}` and confirm them via `Swarm::add_external_address`.

Follow-up to https://github.com/libp2p/rust-libp2p/pull/3954.

Pull-Request: #4052.
2023-06-09 03:26:24 +00:00
Darius Clark
c2230f9948
feat(swarm): allow NetworkBehaviours to create and remove listeners
This extends `ToSwarm` to add `ToSwarm::ListenOn` and `ToSwarm::RemoveListener`, which allows creating and removing listeners from a `NetworkBehaviour`.

Resolves https://github.com/libp2p/rust-libp2p/issues/3291.

Pull-Request: #3292.
2023-06-09 01:34:33 +00:00
Thomas Coratger
4532302917
refactor(identity): fix import warnings in keypair.rs
- Adding conditional `cfg` in `keypair.rs` imports.
- Adding `#[allow(unused_variables)]` on the top of the `sign` function.

Pull-Request: #4047.
2023-06-08 09:27:33 +00:00
Thomas Eizinger
f66420c2b1
deps: run cargo update
This removes multiple duplicate dependencies from our lockfile. Unsure why dependabot hasn't done these yet.

Pull-Request: #4044.
2023-06-08 06:16:11 +00:00
Max Inden
e0f9de3683
chore(kad): extend changelog entry on client/server mode
Pull-Request: #4050.
2023-06-08 05:51:12 +00:00
Thomas Eizinger
ed14630672
feat: leverage type-safe /p2p in multiaddr
This updates `multiaddr` to version `0.19`.

Depends-On: #3656.
Depends-On: https://github.com/multiformats/rust-multiaddr/pull/83.
Resolves: #4039.

Pull-Request: #4037.
2023-06-08 01:38:18 +00:00
Thomas Coratger
d2dab94b76
feat(request-response): use cbor codec in ping example
Remove the use of the core `upgrade::transfer` module in `ping` example (`request-response` protocol) in favor of `cbor` codec.

Related #4011.

Pull-Request: #4046.
2023-06-07 13:01:40 +00:00
Max Inden
59f073df82
chore(identity): remove "unreleased" from v0.2.0 changelog entry
Pull-Request: #4048.
2023-06-07 10:44:26 +00:00
Max Inden
76cb76ca7d
fix(multistream-select): don't wait for negotiation in poll_close
With `Version::V1Lazy` and negotiation of a single protocol, a stream initiator optimistically
sends application data right after proposing its protocol. More specifically an application can
write data via `AsyncWrite::poll_write` even though the remote has not yet confirmed the stream protocol.

This saves one round-trip.

``` mermaid
sequenceDiagram
A->>B: "/multistream/1.0.0"
A->>B: "/perf/1.0.0"
A->>B: <some-perf-protocol-data>
B->>A: "/multistream/1.0.0"
B->>A: "/perf/1.0.0"
B->>A: <some-perf-protocol-data>
```

When considering stream closing, i.e. `AsyncWrite::poll_close`, and using stream closing as an
operation in ones protocol, e.g. using stream closing to signal the end of a request, this becomes tricky.

The behavior without this commit was as following:

``` mermaid
sequenceDiagram
A->>B: "/multistream/1.0.0"
A->>B: "/perf/1.0.0"
A->>B: <some-perf-protocol-data>
Note left of A: Call `AsyncWrite::poll_close` which first waits for the<br/>optimistic multistream-select negotiation to finish, before closing the stream,<br/> i.e. setting the FIN bit.
B->>A: "/multistream/1.0.0"
B->>A: "/perf/1.0.0"
Note right of B: Waiting for A to close the stream (i.e. set the `FIN` bit)<br/>before sending the response.
A->>B: FIN
B->>A: <some-perf-protocol-data>
```

The above takes 2 round trips:

1. Send the optimistic multistream-select protocol proposals as well as the initiator protocol
payload and waits for the confirmation of the protocols.
2. Close the stream, i.e. sends the `FIN` bit and waits for the responder protocol payload.

This commit proposes that the stream initiator should not wait for the multistream-select protocol
confirmation when closing the stream, but close the stream within the first round-trip.

``` mermaid
sequenceDiagram
A->>B: "/multistream/1.0.0"
A->>B: "/perf/1.0.0"
A->>B: <some-perf-protocol-data>
A->>B: FIN
B->>A: "/multistream/1.0.0"
B->>A: "/perf/1.0.0"
B->>A: <some-perf-protocol-data>
```

This takes 1 round-trip.

The downside of this commit is, that the stream initiator will no longer notice a negotiation error
when closing the stream. They will only notice it when reading from the stream. E.g. say that B does
not support "/perf/1.0.0", A will only notice on `AsyncRead::poll_read`, not on
`AsyncWrite::poll_close`. This is problematic for protocols where A only sends data, but never
receives data, i.e. never calls `AsyncRead::poll_read`. Though one can argue that such protocol is
flawed in the first place. With a response-less protocol, as even if negotiation succceeds, A
doesn't know whether B received the protocol payload.

Pull-Request: #4019.
2023-06-06 21:00:20 +00:00
Thomas Eizinger
a728cca27f
chore(libp2p): remove non-existent features from cfgs
These features have long been removed and the `cfg` statement can thus be simplified.

Pull-Request: #4042.
2023-06-06 20:41:19 +00:00
Thomas Coratger
90d6a77e6a
feat(examples): use cbor codec in file-sharing example
Remove the use of the core `upgrade::transfer` module in `file-sharing` example in favor of `cbor` codec.

Related #4011.

Pull-Request: #4036.
2023-06-06 20:10:22 +00:00
Thomas Eizinger
61128713eb
feat(core): remove deprecated identity module
Related: #3647.

Pull-Request: #4040.
2023-06-06 19:22:50 +00:00
Thomas Eizinger
23d499b9dd
feat(libp2p): remove quic and webrtc re-export
These two re-exports are deprecated because they are both in alpha status. Users should depend on them directly.

Related: #3647.

Pull-Request: #4041.
2023-06-06 18:30:56 +00:00
Thomas Eizinger
0db9937ee5
feat: remove multiaddr dependency from libp2p-identity
Related: https://github.com/multiformats/rust-multiaddr/issues/73.
Depends-On: https://github.com/libp2p/rust-libp2p/pull/3514.

Pull-Request: #3656.
2023-06-06 17:27:13 +00:00
Max Inden
86e8018016
chore(rendezvous): remove unused dependency mplex
Pull-Request: #4034.
2023-06-06 05:25:40 +00:00
Max Inden
38b7bd617e
chore(multistream-select): replace mplex with yamux in tests
Pull-Request: #4033.
2023-06-06 05:06:43 +00:00