992 Commits

Author SHA1 Message Date
Denis Garus
efea4902a5
refactor(relay): move stream-handling away from {In,Out}boundUpgrade
Fixes: #4075.

Pull-Request: #4275.
2023-09-20 08:11:36 +00:00
Sumit
c52a2fc3af
feat(swarm): allow configuration to idle connection timeout
Previously, a connection would be shut down immediately as soon as its `ConnectionHandler` reports `KeepAlive::No`. As we have gained experience with libp2p, it turned out that this isn't ideal.

For one, tests often need to keep connections alive longer than the configured protocols require. Plus, some usecases require connections to be kept alive in general.

Both of these needs are currently served by the `keep_alive::Behaviour`. That one does essentially nothing other than statically returning `KeepAlive::Yes` from its `ConnectionHandler`.

It makes much more sense to deprecate `keep_alive::Behaviour` and instead allow users to globally configure an `idle_conncetion_timeout` on the `Swarm`. This timeout comes into effect once a `ConnectionHandler` reports `KeepAlive::No`. To start with, this timeout is 0. Together with https://github.com/libp2p/rust-libp2p/issues/3844, this will allow us to move towards a much more aggressive closing of idle connections, together with a more ergonomic way of opting out of this behaviour.

Fixes #4121.

Pull-Request: #4161.
2023-09-19 22:32:29 +00:00
dependabot[bot]
3ee8ab6581
deps: bump serde_json from 1.0.106 to 1.0.107
Pull-Request: #4515.
2023-09-18 09:41:40 +00:00
dependabot[bot]
8a523f950f
deps: bump socket2 from 0.5.3 to 0.5.4
Pull-Request: #4513.
2023-09-18 09:17:45 +00:00
Ademola
508cad1f0d
feat(kad): migrate to quick-protobuf-codec crate
Resolves #4487.

Pull-Request: #4501.
2023-09-15 21:11:09 +00:00
João Oliveira
411a0495c5
feat(upnp): add implementation based on IGD protocol
Implements UPnP via the IGD protocol. The usage of IGD is an implementation detail and is planned to be extended to support NATpnp.

Resolves: #3903.

Pull-Request: #4156.
2023-09-12 10:29:27 +00:00
dependabot[bot]
f798572e78
deps: bump lru from 0.11.0 to 0.11.1
Pull-Request: #4478.
2023-09-11 23:57:05 +00:00
dependabot[bot]
0df1a96e3c
deps: bump base64 from 0.21.3 to 0.21.4
Pull-Request: #4479.
2023-09-11 23:32:09 +00:00
dependabot[bot]
ae3cef14cb
deps: bump serde_json from 1.0.105 to 1.0.106
Pull-Request: #4481.
2023-09-11 14:13:30 +00:00
dependabot[bot]
b08eb21794
deps: bump unsigned-varint from 0.7.1 to 0.7.2
Pull-Request: #4480.
2023-09-11 11:54:37 +00:00
dependabot[bot]
7a94dd820a
deps: bump bytes from 1.4.0 to 1.5.0
Pull-Request: #4476.
2023-09-11 09:36:26 +00:00
Darius Clark
cd32435d85
fix(ping): honor ping interval in case of errors
This PR adds a delay to ping connection handler after exceeding the failure rate to prevent opening a outbound stream right after an error.

Resolves #4410.

Pull-Request: #4423.
2023-09-09 09:37:25 +00:00
dependabot[bot]
0cc4881740
deps: bump thiserror from 1.0.44 to 1.0.48
Pull-Request: #4430.
2023-09-04 10:23:24 +00:00
dependabot[bot]
c1bccd5c1c
deps: bump base64 from 0.21.2 to 0.21.3
Pull-Request: #4401.
2023-09-04 09:43:13 +00:00
João Oliveira
50b8b637cf
deps: bump trust-dns-proto from 0.22.0 to 0.23.0
On https://github.com/libp2p/rust-libp2p/pull/3102 we left the `tokio-runtime` feature because of https://github.com/bluejekyll/trust-dns/issues/1830, meanwhile https://github.com/bluejekyll/trust-dns/pull/1831 was merged and `0.23.0` was released with it, so we no longer require the `tokio-runtime` feature.

Pull-Request: #4418.
2023-09-04 06:57:49 +00:00
dependabot[bot]
82e654c8a4
deps: bump regex from 1.9.3 to 1.9.5
Pull-Request: #4433.
2023-09-04 04:57:13 +00:00
Thomas Eizinger
06bc6777a1
chore: fix lint warnings introduced by beta clippy
Pull-Request: #4386.
2023-08-24 12:27:42 +00:00
dependabot[bot]
eb83367430
deps: bump clap from 4.3.21 to 4.3.23
Pull-Request: #4359.
2023-08-21 09:37:15 +00:00
dependabot[bot]
76797f8ad0
deps: bump tokio from 1.31.0 to 1.32.0
Pull-Request: #4356.
2023-08-21 09:16:26 +00:00
dependabot[bot]
608e2dbb19
deps: bump serde_json from 1.0.104 to 1.0.105
Pull-Request: #4347.
2023-08-19 22:41:44 +00:00
Max Inden
16b2f1563d
chore: use workspace rust-version
Pull-Request: #4344.
2023-08-18 09:02:22 +00:00
dependabot[bot]
2c4c961d69
deps: bump log from 0.4.19 to 0.4.20
Pull-Request: #4322.
2023-08-14 10:16:13 +00:00
dependabot[bot]
8022769daf
deps: bump clap from 4.3.19 to 4.3.21
Pull-Request: #4319.
2023-08-14 09:20:07 +00:00
dependabot[bot]
a4b8ff4673
deps: bump tokio from 1.29.1 to 1.31.0
Pull-Request: #4318.
2023-08-14 09:00:31 +00:00
Max Inden
5a8eb793fe
chore: prepare libp2p v0.52.2
Pull-Request: #4312.
2023-08-11 10:10:42 +00:00
shamil-gadelshin
e65155281e
fix(kad): reduce noise of "remote supports our protocol" log
This PR changes the logging of the Kademlia connection handler related to the remote Kademlia mode changes:
- Downgrade log level for the remote kademlia protocol report from `info` to `debug`.
- Introduce connection_id for the handler to improve logging.

Pull-Request: #4278.
2023-08-07 09:31:15 +00:00
dependabot[bot]
1278161603
deps: bump regex from 1.9.1 to 1.9.3
Pull-Request: #4295.
2023-08-07 08:35:57 +00:00
Akihito Nakano
f95f39f634
feat(gossipsub): add getter function to obtain TopicScoreParams
Added a getter function to obtain `TopicScoreParams`. I need this function for testing which checks if scoring parameters are updated as expected.

Pull-Request: #4231.
2023-08-03 15:19:25 +00:00
Thomas Eizinger
cb8a92026a
deps(yamux): update yamux to v0.12
Pull-Request: #3013.
2023-08-02 15:02:54 +00:00
quininer
37d57f41de
fix(relay): remove unconditional async-std dependency
`libp2p-relay` crate specifies the `libp2p-swarm/async-std` feature, which causes an `async-std` dependency to always be introduced.

Pull-Request: #4283.
2023-08-02 13:46:27 +00:00
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