Commit Graph

2614 Commits

Author SHA1 Message Date
c723df461f deps: bump clap from 4.3.0 to 4.3.1
Pull-Request: #4027.
2023-06-05 10:59:28 +00:00
49eed8c4fd deps: bump once_cell from 1.17.1 to 1.18.0
Pull-Request: #4026.
2023-06-05 10:41:11 +00:00
62441a07d4 deps: bump syn from 2.0.16 to 2.0.18
Pull-Request: #4025.
2023-06-05 10:22:07 +00:00
1dbdb6a008 deps: bump futures_ringbuf from 0.3.1 to 0.4.0
Pull-Request: #4023.
2023-06-05 09:53:02 +00:00
c9b386b2e3 fix(relay): log when accepting reservation without external addresses
Pull-Request: #4022.
2023-06-05 03:36:09 +00:00
a4450d41c0 feat(dcutr): keep connection alive while we are using it
Similar to #3876, we now compute `connection_keep_alive` based on whether we are still using the connection, applied to the `dcutr` protocol.

Related: https://github.com/libp2p/rust-libp2p/issues/3844.

Pull-Request: #3960.
2023-06-04 07:43:01 +00:00
75edcfcdb0 docs(examples): add a README to each example
Resolves #3853.

Pull-Request: #3974.
2023-06-01 07:40:22 +00:00
87e863e8c9 refactor(dcutr): remove direct::Handler
With recent refactorings in `libp2p-swarm`, there is no more need for `handler::direct` at all.

Resolves #4013.

Pull-Request: #4016.
2023-06-01 04:34:28 +00:00
92c8cc451f feat(kad): implement automatic client mode
Currently, the kademlia behaviour can only learn that the remote node supports kademlia on a particular connection if we successfully negotiate a stream to them.

Using the newly introduced abstractions from #3651, we don't have to attempt to establish a stream to the remote to learn whether they support kademlia on a connection but we can directly learn it from the `ConnectionEvent::RemoteProtocolsChange` event. This happens directly once a connection is established which should overall benefit the DHT.

Clients do not advertise the kademlia protocol and thus we will immediately learn that a given connection is not suitable for kadmelia requests. We may receive inbound messages from it but this does not affect the routing table.

Resolves: #2032.

Pull-Request: #3877.
2023-05-31 09:02:19 +00:00
7f865448c0 fix(metrics/swarm): correct metric, name and help
Pull-Request: #4014.
2023-05-31 02:10:41 +00:00
5321a4479b fix(dcutr): always check for relayed connection first
For a non-relay connection, check if it corresponds to a direct connection upgrade.

As discussed in #3964.

Pull-Request: #3982.
2023-05-31 01:14:10 +00:00
b73f7209c5 deps: bump bs58 from 0.4.0 to 0.5.0
Pull-Request: #3999.
2023-05-30 19:27:34 +00:00
ddc2b879e2 fix: apply suggestions from 1.71 clippy beta
Pull-Request: #4009.
2023-05-30 13:30:04 +00:00
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