1012 Commits

Author SHA1 Message Date
Thomas Sénéchal
4d637aedb7
docs: fix last OutboundQueryCompleted in kad doc
`OutboundQueryCompleted` hasn't been fully replaced by `OutboundQueryProgressed` in kad doc.

Pull-Request: #4257.
2023-08-02 10:43:37 +00:00
arsenron
23d7d1a247
feat(kad): implement common traits on RoutingUpdate
A few weeks ago when I was debugging my wrong setup with kademlia, I could not conveniently debug `RoutingUpdate` after adding an address to the DHT. It would be nice to have a few derivable traits on a public enum.

Pull-Request: #4270.
2023-07-31 14:23:45 +00:00
Darius Clark
8ff2cf3a37
fix(relay): export RateLimiter type
The `rate-limiter` module  was not made publicly available. This change exports the `RateLimiter` trait defined within that module which allows users to define their own rate limiters. To make common usecases easy, we also provide a set of constructor functions for common rate limiters.

Resolves #3741.

Pull-Request: #3742.
2023-07-31 13:58:20 +00:00
Benno
cf3cff147c
fix(kad): prevent simultaneous dials to peer
By default, dialing is prevented when already connected. `kad` already checks this manually before doing dials. By changing the condition from `Disconnected` to `NotDialing`, we prevent simultaneous dials to a peer.

Pull-Request: #4224.
2023-07-24 17:06:48 +00:00
dependabot[bot]
12c98dca35
deps: bump either from 1.8.1 to 1.9.0
Pull-Request: #4243.
2023-07-24 16:02:14 +00:00
dependabot[bot]
521eea2d01
deps: bump thiserror from 1.0.43 to 1.0.44
Pull-Request: #4242.
2023-07-24 15:46:36 +00:00
Zeeshan Lakhani
52cf26f530
refactor(request-reponse): replace serde_cbor with cbor4ii
As per `RUSTSEC-2021-0127`, serde_cbor is unmaintained.

Fixes #4182.
Related: https://github.com/rustsec/advisory-db/pull/1114.

Pull-Request: #4187.
2023-07-20 13:18:36 +00:00
Darius Clark
f0b1b122e6
feat(relay): add functions to Limit to access its data
Currently, `Limit` is supplied to many of relay client events, however there is no way to access the fields. This PR adds functions to allow access to the data from those fields.

Pull-Request: #4162.
2023-07-20 08:06:33 +00:00
dependabot[bot]
6ac15bdb98
deps: bump lru from 0.10.1 to 0.11.0
Pull-Request: #4198.
2023-07-19 13:41:32 +00:00
dependabot[bot]
132688961f
deps: bump clap from 4.3.11 to 4.3.12
Pull-Request: #4206.
2023-07-19 13:10:14 +00:00
dependabot[bot]
c70f3245dc
deps: bump prometheus-client from 0.21.1 to 0.21.2
Pull-Request: #4173.
2023-07-19 11:01:53 +00:00
dependabot[bot]
efdba39f83
deps: bump thiserror from 1.0.40 to 1.0.43
Pull-Request: #4174.
2023-07-17 08:45:14 +00:00
Benno
30024f38d4
fix: clippy useless_conversion and useless_vec
Pull-Request: #4190.
2023-07-16 03:31:37 +00:00
Max Inden
df1caa0da9
chore: prepare libp2p-swarm v0.43.1 and libp2p-kad v0.44.2
Pull-Request: #4166.
2023-07-13 01:58:30 +00:00
dependabot[bot]
2f288523b0
deps: bump clap from 4.3.10 to 4.3.11
Pull-Request: #4178.
2023-07-11 11:44:04 +00:00
dependabot[bot]
1246d832a4
deps: bump serde_json from 1.0.99 to 1.0.100
Pull-Request: #4172.
2023-07-11 09:31:49 +00:00
dependabot[bot]
a92a801cce
deps: bump smallvec from 1.10.0 to 1.11.0
Pull-Request: #4171.
2023-07-11 08:58:09 +00:00
dependabot[bot]
a6c427483c
deps: bump regex from 1.8.4 to 1.9.1
Pull-Request: #4170.
2023-07-11 08:19:26 +00:00
dependabot[bot]
185cb4a2e3
deps: bump tokio from 1.28.2 to 1.29.1
Pull-Request: #4148.
2023-07-10 09:31:15 +00:00
Darius Clark
cbb9c7c0f3
feat(kad): allow to explicitly set Mode::{Client,Server}
The current implementation in Kademlia relies on an external address to determine if it should be in client or server mode. However there are instances where a node, which may know an external address, wishes to remain in client mode and switch to server mode at a later point.

This PR introduces `Kademlia::set_mode`, which accepts an `Option<Mode>` that would allow one to set `Mode::Client` for client mode, `Mode::Server` for server mode, or `None` to determine if we should operate as a client or server based on our external addresses.

Resolves #4074.

Pull-Request: #4132.
2023-07-04 06:07:56 +00:00
dependabot[bot]
00ffa04afc
deps: bump lru from 0.10.0 to 0.10.1
Pull-Request: #4141.
2023-07-03 17:59:11 +00:00
dependabot[bot]
62ab42aecb
deps: bump clap from 4.3.8 to 4.3.10
Pull-Request: #4144.
2023-07-03 16:46:28 +00:00
Thomas Eizinger
f335697573
fix(kad): allow for different order of events in assertion
Fixes the test failure witnessed in https://github.com/libp2p/rust-libp2p/actions/runs/5392115337/jobs/9790198947?pr=4128#step:6:162.

Pull-Request: #4129.
2023-06-28 12:26:44 +00:00
joshuef
93aa21aba9
fix(kad): re-expose Distance as KBucketDistance
Adds back in Distance as a public type. Follows `KBucketKey` naming for clarity.

Resolves #4108.

Pull-Request: #4109.


  
Co-Authored-By: Josh Wilson <joshuef@gmail.com>
  

  
Co-Authored-By: Max Inden <mail@max-inden.de>
2023-06-27 01:58:22 +00:00
Thomas Eizinger
d5475fccde
fix(test): only listen on 127.0.0.1 for ephemeral swarm
This resolves an issue where our tests were depending on the number of network interfaces available on the local machine.

Related #4110.

Pull-Request: #4122.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-27 01:21:47 +00:00
dependabot[bot]
6241b92fe4
deps: bump clap from 4.3.3 to 4.3.8
Pull-Request: #4118.
2023-06-26 10:43:20 +00:00
dependabot[bot]
26801481fa
deps: bump serde_json from 1.0.97 to 1.0.99
Pull-Request: #4119.
2023-06-26 10:19:34 +00:00
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
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]
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]
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
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
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
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
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
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
Thomas Eizinger
61128713eb
feat(core): remove deprecated identity module
Related: #3647.

Pull-Request: #4040.
2023-06-06 19:22:50 +00:00
Max Inden
86e8018016
chore(rendezvous): remove unused dependency mplex
Pull-Request: #4034.
2023-06-06 05:25:40 +00:00
dependabot[bot]
c723df461f
deps: bump clap from 4.3.0 to 4.3.1
Pull-Request: #4027.
2023-06-05 10:59:28 +00:00
dependabot[bot]
1dbdb6a008
deps: bump futures_ringbuf from 0.3.1 to 0.4.0
Pull-Request: #4023.
2023-06-05 09:53:02 +00:00
Max Inden
c9b386b2e3
fix(relay): log when accepting reservation without external addresses
Pull-Request: #4022.
2023-06-05 03:36:09 +00:00
Thomas Coratger
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
Thomas Coratger
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
Thomas Eizinger
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
Arpan Kapoor
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