332 Commits

Author SHA1 Message Date
Max Inden
1a85e24ef9
fix(quic): Downgrade driver shutdown log line from info to debug
No need to inform the user each time the quic socket driver is shutting down.

Pull-Request: #3672.
2023-03-24 17:09:22 +00:00
dependabot[bot]
7e9581c4ef
deps: bump thiserror from 1.0.39 to 1.0.40
Pull-Request: #3637.
2023-03-24 14:17:02 +00:00
Anton
0e468655a4
feat(webrtc): make Fingerprint type public
`Certificate#fingerprint()` returns `Fingerprint`, but since it's not
public, I was not able to test it in my project. I.e. before this change it was
not possible to do:

```
cert.fingerprint() == Fingerprint::raw([1u8 ...])
```

Pull-Request: #3648.
2023-03-21 22:33:43 +00:00
dependabot[bot]
06d644b63d
deps: bump x509-parser from 0.14.0 to 0.15.0
Pull-Request: #3640.
2023-03-20 15:30:09 +00:00
Victor Ermolaev
2ec5402474
feat(swarm): enforce creation of Swarm via SwarmBuilder
Mark constructors `Swarm::with_X_executor` as deprecated.
Move the deprecated functionality to `SwarmBuilder::with_X_executor`
Use `SwarmBuilder` throughout.

Resolves #3186.
Resolves #3107.

Pull-Request: #3588.
2023-03-13 19:53:14 +00:00
dependabot[bot]
34d7af818b
deps: bump snow from 0.9.1 to 0.9.2
Pull-Request: #3600.
2023-03-13 12:05:06 +00:00
dependabot[bot]
9d0ec7e074
deps: bump futures from 0.3.26 to 0.3.27
Pull-Request: #3597.
2023-03-13 11:35:04 +00:00
dependabot[bot]
2e6564f786
deps: bump libc from 0.2.139 to 0.2.140
Pull-Request: #3601.
2023-03-13 11:00:58 +00:00
Max Inden
3959b2ccef
docs: Prepare v0.51.1 (#3594) 2023-03-12 16:42:57 +01:00
Thomas Eizinger
2a14df25eb
feat: introduce libp2p-identity crate
This patch combines the `libp2p_core::identity` and `libp2p_core::peer_id` modules into a new crate: `libp2p-identity`.

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

Pull-Request: #3350.
2023-03-12 15:46:58 +01:00
Doug A
83ef657500
fix(webrtc): gracefully handle resets of individual connections
Fixes https://github.com/libp2p/rust-libp2p/issues/3574

Pull-Request: #3575.
2023-03-10 17:40:59 +00:00
Max Inden
aedecf709c
feat(tls): Promote to v0.1.0
Promotes `libp2p-tls` to `v0.1.0` thus removing the complexity of cargo's handling of `-alpha` releases for `libp2p-tls`.

Pull-Request: #3581.
2023-03-10 11:49:03 +00:00
Thomas Eizinger
0cad636eba
fix: move changelog entries to correct version
Whilst https://github.com/libp2p/rust-libp2p/pull/3312 was in development, we pushed a new release out and forgot to move the changelog entries to the new version. Unfortunately, this is all still very manual until we have a solution for https://github.com/libp2p/rust-libp2p/issues/2902 so this stuff keeps happening.

Pull-Request: #3541.
2023-03-10 10:59:49 +00:00
dependabot[bot]
645b229d43
deps: bump thiserror from 1.0.38 to 1.0.39
Pull-Request: #3554.
2023-03-08 12:59:53 +00:00
Max Inden
2c10cd838a
refactor(uds): Move WASM feature flagging to root Cargo.toml
Crates that don't compile for WASM are feature flagged in the root `Cargo.toml`, expcept for `libp2p-uds`. This commit removes the inconsistency.

As a side-effect, this might help prevent bugs like https://github.com/libp2p/rust-libp2p/pull/3502 going forward.

Pull-Request: #3503.
2023-03-07 14:02:13 +00:00
Thomas Eizinger
6b73dac59b
feat(noise): remove tests for deprecated protocol
With `0.51`, we finally officially deprecated the non-spec compliant version of noise. This one needs a very heavy dependency for testing: `libsodium-sys-stable`.

I propose to remove the tests now. The actual implementation is not yet removed because it would be a breaking change. Once we decide to make the next breaking change, we can also include the removal of the deprecated API.

Pull-Request: #3510.
2023-03-07 13:30:47 +00:00
ozwaldorf
050504fbe5
fix(libp2p-quic): pin and update tls prerelease dep
Pin libp2p-quic's tls prerelease dependency and update it

Pull-Request: #3548.
2023-03-03 20:16:00 +00:00
Miguel Guarniz
db82e0210e
feat: migrate to quick-protobuf
Instead of relying on `protoc` and buildscripts, we generate the bindings using `pb-rs` and version them within our codebase. This makes for a better IDE integration, a faster build and an easier use of `rust-libp2p` because we don't force the `protoc` dependency onto them.

Resolves #3024.

Pull-Request: #3312.
2023-03-02 10:45:07 +00:00
hanabi1224
52a32ffac1
fix(pnet): flush nonce in handshake
Previously, we did not flush the nonce within the handshake to the stream. This caused problems when `pnet` was composed with the websocket transport. Inserting a flush fixes these compatibility problems.

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

Pull-Request: #3476.
2023-02-28 04:34:54 +00:00
dependabot[bot]
b8d95ff974
deps: bump tempfile from 3.3.0 to 3.4.0
Pull-Request: #3520.
2023-02-28 03:25:42 +00:00
Max Inden
1a9cf4f776
fix(uds): Bump version
https://github.com/libp2p/rust-libp2p/pull/3196/ forgot to bump `libp2p-uds`. `libp2p-uds` was updated to `libp2p-core` `v0.39.0` thus requiring the version bump.

This has happened before, see https://github.com/libp2p/rust-libp2p/pull/2720.

Pull-Request: #3502.
2023-02-24 13:21:06 +00:00
Max Inden
71015ee16f
docs: prepare v0.51.0
A large release with lots of changes I am looking forward to. Sorry for the long release cadence.

Anything folks would like to see included that is not yet in `master`? As usual I would like to only block on bug fixes.

Pull-Request: #3491.
2023-02-24 10:42:29 +00:00
dependabot[bot]
462ddeacb7
deps: bump wasm-bindgen-futures from 0.4.33 to 0.4.34
Pull-Request: #3427.
2023-02-17 04:53:54 +00:00
dependabot[bot]
0d72e810c6
deps: bump js-sys from 0.3.60 to 0.3.61 (#3428) 2023-02-16 08:58:06 +00:00
dependabot[bot]
6d689ed420
deps: bump once_cell from 1.17.0 to 1.17.1 (#3466) 2023-02-16 07:13:37 +00:00
Max Inden
eddbb2bda0
docs(quic): Add changelog entry for #3420 (#3452) 2023-02-10 11:32:36 +01:00
tim gretler
3c120322a9
fix(quic): discard correct waker upon accepting inbound stream (#3420) 2023-02-07 08:08:26 +00:00
dependabot[bot]
063aab5909
deps: bump bytes from 1.3.0 to 1.4.0 (#3422) 2023-02-01 11:34:26 +00:00
dependabot[bot]
4569e498b4
deps: bump snow from 0.9.0 to 0.9.1 (#3421) 2023-02-01 11:02:18 +00:00
Victor Ermolaev
6880469340
fix(webrtc): unwoken task in webrtc transport (#3408)
Add an explicit waker to report the last event.
2023-02-01 06:11:28 +00:00
Victor Ermolaev
96c93b9a52
fix(quic): unwoken task in quic transport (#3407)
Add an explicit waker to report the last event.
2023-02-01 05:34:48 +00:00
dependabot[bot]
0c94237e16
deps: bump futures from 0.3.25 to 0.3.26 (#3405) 2023-01-31 23:34:17 +00:00
Victor Ermolaev
c15e6517b1
refactor(tcp): use SelectAll for driving listener streams (#3361)
The PR optimizes polling of the listeners in the TCP transport by using `futures::SelectAll` instead of storing them in a queue and polling manually.

Resolves #2781.
2023-01-30 22:09:51 +00:00
Anton
47c1d5a019
docs(websocket): showcase wrapping dns and tcp transport (#3385) 2023-01-30 15:11:27 +00:00
Jordan Santell
d344406235
fix(tcp): remove correct listener inTransport::remove_listener (#3387)
`libp2p_tcp::Transport::remove_listener` previously removed the first listener that *did not match* the provided `ListenerId`. This small fix brings it inline with other implementations.
2023-01-27 17:32:40 +00:00
Elena Frank
dcfa7ecf5d
feat(quic): Wake transport when adding a new dialer or listener (#3342)
Wake `quic::GenTransport` if a new dialer or listener is added.
2023-01-23 23:39:13 +00:00
Thomas Eizinger
4b41f5a994
refactor(core)!: remove EitherOutput (#3341)
The trick with this one is to use `futures::Either` everywhere where we may wrap something that implements any of the `futures` traits. This includes the output of `EitherFuture` itself. We also need to implement `StreamMuxer` on `future::Either` because `StreamMuxer`s may be the the `Output` of `InboundUpgrade`.
2023-01-23 12:31:30 +00:00
João Oliveira
735945db30
refactor(tcp): Rename TcpListenStream to ListenStream (#3324) 2023-01-17 10:58:16 +00:00
Thomas Eizinger
91ebe7b395
fix(ci): revert "Trigger Quic as Transport wakeup on dial" (#3322) 2023-01-13 11:31:32 +00:00
Max Inden
7665e74cdb
fix(quic): Trigger Quic as Transport wakeup on dial (#3306)
Scenario: rust-libp2p node A dials rust-libp2p node B. B listens on a QUIC address. A dials B via the `libp2p-quic` `Transport` wrapped in a `libp2p-dns` `Transport`.

Note that `libp2p-dns` in itself is not relevant here. Only the fact that `libp2p-dns` delays a dial is relevant, i.e. that it first does other async stuff (DNS lookup) before creating the QUIC dial. In fact, dialing an IP address through the DNS `Transport` where no DNS resolution is needed triggers the below just fine.

1. A calls `Swarm::dial` which creates a `libp2p-dns` dial.
2. That dial is spawned onto the connection `Pool`, thus starting the DNS resolution.
3. A continuously calls `Swarm::poll`.
4. `libp2p-quic` `Transport::poll` is called, finding no dialers in `self.dialer` given that the spawned dial is still only resolving the DNS address.
5. On the spawned connection task:
1. The DNS resolution finishes.
2. Thus calling `Transport::dial` on `libp1p-quic` (note that the DNS dial has a clone of the QUIC `Transport` wrapped in an `Arc<Mutex<_>>`).
3. That adds a dialer to `self.dialer`. Note that there are no listeners, i.e. `Swarm::listen_on` was never called.
4. `DialerState::new_dial` is called which adds a message to `self.pending_dials` and wakes `self.waker`. Given that on the last `Transport::poll` there was no `self.dialer`, that waker is empty.

Result: The message is stuck in the `DialerState::pending_dials`. The message is never send to the endpoint driver. The dial never succeeds.

This commit fixes the above, waking the `<Quic as Transport>:poll` method.
2023-01-11 14:41:34 +00:00
Thomas Eizinger
cafa37ea21
feat(noise): deprecate LegacyConfig without replacement (#3265)
As the name implies, `LegacyConfig` allows users to interact with older versions of the noise protocol. These are not interoperable and we've been supporting them for a long time now. Hopefully, users have migrated away from it since. To not directly break them, we officially deprecate now without a replacement.
2023-01-11 05:36:35 +00:00
Max Inden
5b8c3d2901
fix(quic): Identify /quic as QUIC address (#3288)
Identify multiaddress with `/quic` (draft 29) as QUIC address in case `support_draft_29` is `true`.

Without this patch the Rust punchr client would discard any QUIC addresses with `/quic` in its `Transport::address_translation`. Thus `/quic` based observed addresses from `libp2p-identify` would not be added to the local set of external addresses and thus QUIC would not be available as a transport for hole punching.
2023-01-06 09:32:18 +00:00
Pasha Podolsky
929cbb4670
deps!: Update multiaddr & multihash to 0.17.0 (#3196) 2022-12-20 08:52:08 +00:00
dependabot[bot]
ee775137f3
deps(noise): Update ed25519-compact requirement from 1.0.11 to 2.0.4 (#3232) 2022-12-20 01:48:15 +00:00
Thomas Eizinger
5458446205
feat(noise): deprecate non-compliant implementation (#3227)
For the last [two years](https://github.com/libp2p/rust-libp2p/blob/master/CHANGELOG.md#version-0190-2020-05-18), we have been carrying around a non-compliant implementation of the noise protocol for libp2p. It is time to follow through on the announcement in that changelog entry and deprecate it. Users should use the spec compliant implementation instead.

1. This will reduce the maintenance effort of our codebase.
2. We will improve compile-times because we no longer need to depend on `libsodium` to test cryptography that is only part of the non-compliant implementation.
3. It will simplify usage of `rust-libp2p` because users cannot accidentally choose the wrong implementation.
2022-12-19 13:28:07 +00:00
Thomas Eizinger
e960aabefa
docs(pnet): use backticks for referencing types (#3252)
With the update to Rust 1.66, rustdoc is (rightfully) complaining about us writing bad HTML. `<u8>` is interpreted as an unclosed HTML tag. See https://github.com/libp2p/rust-libp2p/actions/runs/3708901592/jobs/6286942010#step:6:1380 for example.
2022-12-16 20:37:31 +00:00
Max Inden
856e7516ef
fix(quic): Feature flag via async-std and not async-io (#3245)
Feature flag `RECEIVE_BUFFER_SIZE` via `async-std` and not `async-io` feature.
2022-12-15 15:42:22 +00:00
Hannes
d79c93abdb
chore: Implement latest clippy warnings (#3220)
As I do frequently, I corrected for the latest clippy warnings. This will make sure the CI won't complain in the future. We could automate this btw and maybe run the nightly version of clippy.
2022-12-14 15:45:04 +00:00
João Oliveira
7dedc351d7
fix: feature-gate symbols to resolve dead-code warning (#3175) 2022-12-13 01:33:00 +00:00
Thomas Eizinger
d7363a53d3
fix: Remove circular dependencies across workspace (#3023)
Circular dependencies are problematic in several ways:

- They result in cognitive overhead for developers, in trying to figure out what depends on what.
- They present `cargo` with limits in what order the crates can be compiled in.
- They invalidate build caches unnecessarily thus forcing `cargo` to rebuild certain crates.
- They cause problems with tooling such as `release-please`.

To actually break the circular dependencies, this patch inlines the uses of `development_transport` in the examples and tests for all sub-crates. This is only meant to be a short-term fix until https://github.com/libp2p/rust-libp2p/issues/3111 and https://github.com/libp2p/rust-libp2p/pull/2888 are fixed.

To ensure we don't accidentally reintroduce this dependency, we add a basic CI that queries `cargo metadata` using `jq`.

Resolves https://github.com/libp2p/rust-libp2p/issues/3053.
Fixes https://github.com/libp2p/rust-libp2p/issues/3223.
Related: https://github.com/libp2p/rust-libp2p/pull/2918#discussion_r976514245
Related: https://github.com/googleapis/release-please/issues/1662
2022-12-12 20:58:01 +00:00