Commit Graph

2601 Commits

Author SHA1 Message Date
efb117e236 fix(ping): remove debug_assert on protocol negotiation timeout
The negotiation of the ping protocol can timeout, thus a debug_assert is not correct. Return an `std::io::Error` instead.

Pull-Request: #3995.
2023-05-30 03:21:52 +00:00
a8a00e7ad7 fix(metrics/identify): remove newline in metric description
Pull-Request: #4005.
2023-05-30 03:03:16 +00:00
d67c133794 deps: bump quote from 1.0.27 to 1.0.28
Pull-Request: #4004.
2023-05-30 02:44:20 +00:00
616abb6c3b deps: bump regex from 1.8.1 to 1.8.3
Pull-Request: #4003.
2023-05-30 02:25:45 +00:00
34e1780498 deps: bump criterion from 0.4.0 to 0.5.1
Pull-Request: #4002.
2023-05-30 02:06:57 +00:00
e880d8380f deps: bump proc-macro2 from 1.0.58 to 1.0.59
Pull-Request: #3997.
2023-05-29 10:36:00 +00:00
34d87a8208 deps: bump log from 0.4.17 to 0.4.18
Pull-Request: #4000.
2023-05-29 10:17:23 +00:00
95eca886f2 deps: bump tokio from 1.28.1 to 1.28.2
Pull-Request: #4001.
2023-05-29 09:59:17 +00:00
21e26d7e23 fix(metrics/kad): don't add period to metric help text
This is added automatically by the `prometheus-client` crate.

Pull-Request: #3996.
2023-05-29 09:11:18 +00:00
9b765fa202 fix(perf): remove --secret-key-seed flag
There is no need for the flag, given that rust-libp2p allows dialing multiaddr without `/p2p`.

Pull-Request: #3994.
2023-05-29 08:04:52 +00:00
c5dd0a2e14 deps: bump base64 from 0.21.0 to 0.21.2
Pull-Request: #3993.
2023-05-28 06:36:18 +00:00
92af0d1281 refactor(perf): use libp2p-request-response
Rewrite `libp2p-perf` protocol using `libp2p-request-response`. Additionally adjust to latest conventions, e.g. the final JSON output.

Pull-Request: #3646.
2023-05-28 05:51:53 +00:00
d4c4078e6d fix(libp2p): don't re-export libp2p-perf
This commit removes the `libp2p-perf` protocol from `libp2p` crate. To use `libp2p-perf` one needs to import it directly. Rational beeing that `libp2p-perf`'s API is not yet stable enough and will most likely require breaking changes in the near future.

Pull-Request: #3990.
2023-05-26 08:38:55 +00:00
bbba8b3f65 fix(yamux): don't register waker on success
In case `self.poll_inner` returns `Poll::Ready` there is no need to register `self.inbound_stream_waker`. With this commit, `self.inbound_stream_waker` is only registered in case `self.poll_inner` returned `Poll::Pending`.

Pull-Request: #3989.
2023-05-26 04:40:57 +00:00
a5a00205c2 chore(roadmap): update
- Update target completions.
- Introduce QUIC hole punching item.
- Add address pipeline and AutoNATv2.
- Reword WebRTC item (not move to str0m) to entail both `/webrtc` and `/webrtc-direct`.

Pull-Request: #3958.
2023-05-26 01:42:36 +00:00
801023f468 feat(gossipsub): allow compiling for WASM
This modification removes deprecated dependency `wasm_timer` and enables wasm compatibility on the gossibsup protocol by simply substituting the `wasm_timer::Instant` with `instant::Instant`(which supports `fn checked_add`) and `wasm_timer::Interval` with `futures_ticker::Ticker`.

Pull-Request: #3973.
2023-05-25 06:19:47 +00:00
fc386a51a7 fix: remove obsolete event_process = false
The `libp2p-swarm-derive` `event_process` option was removed in https://github.com/libp2p/rust-libp2p/pull/2840.

Pull-Request: #3984.
2023-05-25 05:44:54 +00:00
67b26cce4f feat(mdns): adaptive initial interval peer discovery
Peer discovery with mDNS can be very slow, particularly if the first mDNS query is lost. This patch resolves it by adjusting the timer with an adaptive initial interval. We start with a very short timer (500 ms). If a peer is discovered before the end of the timer, then the timer is reset to the normal query interval value (300s), otherwise the timer's value is multiplied by 2 until it reaches the normal query interval value.

Related: https://github.com/libp2p/rust-libp2p/pull/3323.
Resolves: https://github.com/libp2p/rust-libp2p/issues/3319.

Pull-Request: #3975.
2023-05-25 04:09:24 +00:00
137443b9df feat(identify): push changed listen protocols to remote
Now that we have the infrastructure for notifying protocols about changes to our listen protocols, we can use this to actively push those changes to our remotes. This allows other peers to re-configure themselves with very low-latency instead of waiting for the periodic identify event.

Resolves: #3613.

Pull-Request: #3980.
2023-05-25 01:09:35 +00:00
6329d74334 feat(swarm): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3956.
2023-05-24 14:32:59 +00:00
25bc30f07e feat(ping): don't close connections upon failures
Previously, the `libp2p-ping` module came with a policy to close a connection after X failed pings. This is only one of many possible policies on how users would want to do connection management.

We remove this policy without a replacement. If users wish to restore this functionality, they can easily implement such policy themselves: The default value of `max_failures` was 1. To restore the previous functionality users can simply close the connection upon the first received ping error.

In this same patch, we also simplify the API of `ping::Event` by removing the layer of `ping::Success` and instead reporting the RTT to the peer directly.

Related: #3591.

Pull-Request: #3947.
2023-05-24 12:33:18 +00:00
a5cd0d0e03 feat(request-response): add modules for json and cbor messages
This patch adds two modules to `libp2p::request_response`:

- `cbor`
- `json`

Both define a `Behaviour` type-alias that comes with a `Codec` implementation which uses the respective `serde` crate to serialize and deserialize the messages.

Fixes #3905.

Pull-Request: #3952.
2023-05-24 11:13:12 +00:00
5e8f2e82e4 feat(swarm): replace address scoring with explicit candidates
Previously, a `NetworkBehaviour` could report an `AddressScore` for an external address. This score was a `u32` and addresses would be ranked amongst those.

In reality, an address is either confirmed to be publicly reachable (via a protocol such as AutoNAT) or merely represents a candidate that might be an external address. In a way, addresses are guilty (private) until proven innocent (publicly reachable).

When a `NetworkBehaviour` reports an address candidate, we perform address translation on it to potentially correct for ephemeral ports of TCP. These candidates are then injected back into the `NetworkBehaviour`. Protocols such as AutoNAT can use these addresses as a source for probing their NAT status. Once confirmed, they can emit a `ToSwarm::ExternalAddrConfirmed` event which again will be passed to all `NetworkBehaviour`s.

This simplified approach will allow us implement Kademlia's client-mode (https://github.com/libp2p/rust-libp2p/issues/2032) without additional configuration options: As soon as an address is reported as publicly reachable, we can activate server-mode for that connection.

Related: https://github.com/libp2p/rust-libp2p/pull/3877.
Related: https://github.com/libp2p/rust-libp2p/issues/3953.
Related: https://github.com/libp2p/rust-libp2p/issues/2032.
Related: https://github.com/libp2p/go-libp2p/issues/2229.

Co-authored-by: Max Inden <mail@max-inden.de>

Pull-Request: #3954.
2023-05-24 07:52:16 +00:00
a424310d60 fix(swarm): poll handler after injecting LocalProtocolsChange event
Previously, we would not call the handler upon injecting `ConnectionEvent::LocalProtocolsChange`. This would prevent protocols from being able to react to this change and e.g. issue events or open streams.

Pull-Request: #3979.
2023-05-24 06:25:05 +00:00
ccb6e9586d feat(transports): remove deprecated items in tcp
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3978.
2023-05-23 16:50:24 +00:00
fd53245889 feat(mergify): only queue PRs if they target master
This is useful for stacked PRs. One can apply the `send-it` label and wait for GitHub to retarget the PR to the actual base branch once the dependent PR merges.

Pull-request: #3941.
2023-05-23 09:12:12 +10:00
a7be3c0e6e deps: bump Swatinem/rust-cache from 2.3.0 to 2.4.0
Pull-Request: #3965.
2023-05-22 19:47:57 +00:00
61725ca772 deps: bump wasm-bindgen-futures from 0.4.35 to 0.4.36
Pull-Request: #3968.
2023-05-22 19:28:36 +00:00
ba5ca84292 deps: bump js-sys from 0.3.62 to 0.3.63
Pull-Request: #3969.
2023-05-22 19:08:57 +00:00
d090b58881 deps: bump clap from 4.2.7 to 4.3.0
Pull-Request: #3970.
2023-05-22 18:48:38 +00:00
ee38a0051f deps: bump proc-macro2 from 1.0.57 to 1.0.58
Pull-Request: #3971.
2023-05-22 18:30:09 +00:00
382b358c65 deps: bump data-encoding from 2.3.3 to 2.4.0
Pull-Request: #3972.
2023-05-22 18:10:10 +00:00
9867fcebb6 deps: bump quinn-proto from 0.9.3 to 0.10.1
Pull-Request: #3938.
2023-05-22 08:47:51 +00:00
c224ffe012 feat(kad): Remove TUserData and replace with QueryId
Kademlia `ConnectionHandler` used a generic `TUserData` that is replaced by `QueryId` always used in practice.

Resolves #3607.

Pull-Request: #3959.
2023-05-18 23:13:16 +00:00
b655e84d06 refactor(dcutr): fix typo in observed_addreses
Pull-Request: #3962.
2023-05-18 18:44:25 +00:00
a2ad916bc4 deps: bump wasm-bindgen from 0.2.85 to 0.2.86
Pull-Request: #3961.
2023-05-18 16:05:23 +00:00
74fa48b43f deps: bump tokio from 1.28.0 to 1.28.1
Pull-Request: #3931.
2023-05-18 15:47:10 +00:00
2651e197e6 deps: bump proc-macro2 from 1.0.56 to 1.0.57
Pull-Request: #3946.
2023-05-18 15:28:46 +00:00
b3fa954d4b deps: bump libc from 0.2.143 to 0.2.144
Pull-Request: #3932.
2023-05-18 15:08:56 +00:00
cc5b346a7c feat(swarm): expose ConnectionId and add conn duration metric
- Exposes the `ConnectionId` in the various `SwarmEvent` variants.
- Tracks connection duration in `libp2p-metrics::swarm`.

Pull-Request: #3927.
2023-05-17 05:19:53 +00:00
a580906a88 deps: bump Swatinem/rust-cache from 2.2.1 to 2.3.0
Pull-Request: #3929.
2023-05-16 19:41:17 +00:00
9f3c85164c feat(swarm): rename Custom variant to NotifyBehaviour
Rename `ConnectionHandlerEvent::Custom` to `ConnectionHandlerEvent::NotifyBehaviour`.

Related #3848.

Pull-Request: #3955.
2023-05-16 19:20:00 +00:00
fbd471cd79 feat(websocket): remove deflate compression option
This option is the only reason we pull in a dependency on the shared `zlib` library. Unfortunately, we cannot use a pure Rust backend here because that one does not support configuring the window bits of the deflate algorithm which is used in the deflate websocket extension.

Using websockets in libp2p is already crazy inefficient because you end up with double encryption when using `/wss` (which is enforced by browsers if your website is served via https). A good encryption algorithm like noise or TLS produces an output that looks completely random. Any attempt in compressing this is pretty much wasted CPU power.

Thus, I think removing this configuration option does not really hurt and allows us to remove the dependency on the `zlib` shared library.

Pull-Request: #3949.
2023-05-16 09:40:00 +00:00
4fdd83e42f fix(identity): remove unused file secp256r1.pk8
Introduced in https://github.com/libp2p/rust-libp2p/pull/3863/.

Pull-Request: #3950.
2023-05-16 05:31:30 +00:00
3f88fb6059 deps: bump js-sys from 0.3.61 to 0.3.62
Pull-Request: #3930.
2023-05-15 21:00:03 +00:00
7c64c422ad chore(relay): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3948.
2023-05-15 20:31:30 +00:00
2512b6cd18 deps: bump pin-project from 1.0.12 to 1.1.0
Pull-Request: #3937.
2023-05-15 17:49:21 +00:00
3021814e6b deps: bump socket2 from 0.5.2 to 0.5.3
Pull-Request: #3934.
2023-05-15 17:30:19 +00:00
86ea8fe4aa deps: bump wasm-bindgen-futures from 0.4.34 to 0.4.35
Pull-Request: #3935.
2023-05-15 17:08:16 +00:00
21c003701d deps: bump serde from 1.0.162 to 1.0.163
Pull-Request: #3933.
2023-05-15 16:49:23 +00:00