1023 Commits

Author SHA1 Message Date
Thomas Eizinger
c91ecbc8a2
ci: don't run changelog check on chores and refactor PRs
We don't always want to write a changelog entry or bump the version of a crate when we make changes to it. This especially applies to refactorings and other chores. We can automatically detect such PRs based on our conventional commit title.

At the moment, this is not per crate but could be extended in the future. For now, this should be good enough to unblock PRs that are currently stuck on this workflow.

Pull-Request: #4658.
2023-10-16 06:43:06 +00:00
Thomas Eizinger
29c44e8576
ci: run clippy on all targets
A small left-over mistake from moving towards `Cargo.toml` controlled lint configuration.

Pull-Request: #4654.
2023-10-16 06:26:08 +00:00
Leonz
15ad4ea1d1
feat(gossipsub): deprecate Config::idle_timeout
Deprecate the `Config::idle_timeout` function in preparation for removing the `KeepAlive::Until` entirely.

Related: #3844.

Pull-Request: #4648.
2023-10-15 12:05:08 +00:00
Darius Clark
4686ce8e66
feat(rendezous): refresh registration on change to external addresses
Resolves #4627.

Pull-Request: #4629.
2023-10-15 08:40:13 +00:00
Thomas Eizinger
d72c67d94e
fix(kad): actually report unsupported protocol
It turns out, we never actually used `ProtocolStatus::NotSupported`. Or at least, we never constructed it within the `Handler`. This didn't get flagged by rustc because

a) we allowed the `dead_code` lint across `libp2p-kad`
b) the `HandlerEvent` enum is public and thus could be constructed by users

Related: #4632.
Related: #4633.

Pull-Request: #4639.
2023-10-14 22:43:40 +00:00
Thomas Eizinger
50a7ffe119
refactor(kad): delete unused code
We have a fair bit of unused code in `libp2p-kad` that was ignored because we had `#[allow(dead_code)]` at the top of the crate.

Pull-Request: #4633.
2023-10-13 08:00:02 +00:00
dependabot[bot]
d6351eead7
deps: bump if-watch from 3.0.1 to 3.1.0
Pull-Request: #4635.
2023-10-13 06:10:06 +00:00
Thomas Eizinger
7120529c6d
fix(kad): rewrite tests to be less flaky
Not sure why but these tests have recently been quite flaky and are blocking several PRs.

Pull-Request: #4634.
2023-10-13 04:18:19 +00:00
Max Inden
d605255fec
feat(libp2p): add SwarmBuilder
Introduce the new `libp2p::SwarmBuilder`. Users should use the new `libp2p::SwarmBuilder` instead of the now deprecated `libp2p::swarm::SwarmBuilder`. See `libp2p::SwarmBuilder` docs on how to use the new builder.

Fixes #3657.
Fixes #3563.
Fixes #3179.

Pull-Request: #4120.
2023-10-10 06:55:14 +00:00
dependabot[bot]
3ae72557ab
deps: bump tokio from 1.32.0 to 1.33.0
Pull-Request: #4615.
2023-10-10 05:17:02 +00:00
dependabot[bot]
6cc40fe533
deps: bump byteorder from 1.4.3 to 1.5.0
Pull-Request: #4614.
2023-10-10 05:04:05 +00:00
dependabot[bot]
5efcb8ff6d
deps: bump regex from 1.9.6 to 1.10.0
Pull-Request: #4617.
2023-10-10 01:13:45 +00:00
dependabot[bot]
1bfaf1c67d
deps: bump lru from 0.11.1 to 0.12.0
Pull-Request: #4610.
2023-10-09 12:04:49 +00:00
Hannes
3458950bea
chore(upnp, webrtc): add missing docs.rs metadata
Includes necessary package metadata to improve documentation on docs.rs (shows which items are behind a cfg).
Read more on: #2983

Pull-Request: #4599.
2023-10-09 02:46:32 +00:00
Binston Sukhael Cardoza
0e9d339bd2
ci: use workspace inheritance to enforce lints in all crates
Starting with nightly-2023-09-10, the `[lints]` section in `Cargo.toml` files is stable. Together with workspace inheritance, this can be used to declare all lints we want to enforce in a single place.

Resolves: #4484.

Pull-Request: #4575.
2023-10-09 02:20:46 +00:00
Max Inden
d862b40383
refactor(examples): remove #[behaviour(to_swarm = "Event")]
Removes the usage of the `to_swarm` `libp2p-swarm-derive` attribute in favor of the automatically generated event through the `NetworkBehaviour` derive macro.

Pull-Request: #4580.
2023-10-03 22:21:17 +00:00
dependabot[bot]
980bda088d
deps: bump regex from 1.9.5 to 1.9.6
Pull-Request: #4577.
2023-10-03 02:03:02 +00:00
dependabot[bot]
3ff354f1ef
deps: bump thiserror from 1.0.48 to 1.0.49
Pull-Request: #4578.
2023-10-03 01:50:38 +00:00
dependabot[bot]
90a9752dc7
deps: bump sha2 from 0.10.7 to 0.10.8
Pull-Request: #4579.
2023-10-02 09:03:11 +00:00
Denis Garus
ecdd0ff767
refactor(identify): use ReadyUpgrade for {In,Out}boundUpgrade
Related: #2863.

Pull-Request: #4563.
2023-09-28 23:23:54 +00:00
Hannes
665181efb5
chore: address latest clippy lints
I ran clippy on the current nightly and fixed issues found by it. Noteworthy are two instances of the [never_loop](https://rust-lang.github.io/rust-clippy/master/index.html#/never_loop) lint.

Pull-Request: #4571.
2023-09-28 10:08:51 +00:00
Arpan Kapoor
d30eb9daa7
fix(upnp): do not return failure events repeatedly
When a gateway is not found or is not routable, UPnP `NetworkBehaviour`'s `poll` repeatedly returns the same failure state, which increases CPU usage.

Pull-Request: #4569.
2023-09-28 07:52:24 +00:00
Panagiotis Ganelis
c8b5f49ec2
refactor(kad): rename to follow naming convention across repository
Renamed the following

`kad::Kademlia` -> `kad::Behaviour`
`kad::KademliaEvent` -> `kad::Event`
`kad::KademliaBucketInserts` -> `kad::BucketInserts`
`kad::KademliaStoreInserts` -> `kad::StoreInserts`
`kad::KademliaConfig` -> `kad::Config`
`kad::KademliaCaching` -> `kad::Caching`
`kad::KademliaEvent` -> `kad::Event`
`kad::KademliaConnectionType` -> `kad::ConnectionType`
`KademliaHandler` -> `Handler`
`KademliaHandlerEvent` -> `HandlerEvent`
`KademliaProtocolConfig` -> `ProtocolConfig`
`KademliaHandlerIn` -> `HandlerIn`
`KademliaRequestId` -> `RequestId`
`KademliaHandlerQueryErr` -> `HandlerQueryErr`

Resolves: #4485

Pull-Request: #4547.
2023-09-27 20:25:22 +00:00
Thomas Eizinger
fffd47b69f
refactor(plaintext): rename symbols to follow naming convention
Related: #2217.

Pull-Request: #4535.
2023-09-27 19:42:45 +00:00
joshuef
f6b5a1376a
chore(kad): update kad caching docs for clarity about write mechanism
Pull-Request: #4564.
2023-09-27 19:30:33 +00:00
Arpan Kapoor
38ea7ad453
fix(upnp): use correct mapping protocol for UDP
Return `PortMappingProtocol::UDP` when the multiaddress protocol is UDP.

Pull-Request: #4542.
2023-09-25 10:50:12 +00:00
dependabot[bot]
94432d83ad
deps: bump smallvec from 1.11.0 to 1.11.1
Pull-Request: #4551.
2023-09-25 08:33:29 +00:00
Marcel Gleeson
ad45d23d94
fix(identify): handle partial push messages
According to the [spec], all fields within push messages are optional. To handle missing fields, we deserialize push messages into a different struct, patch the previously received, full identify message with it and emit this as the new info.

Previously, we failed to parse the message which causes incompatibility with js-libp2p nodes as they don't send the public key in push messages. See 88c47f51f9/packages/libp2p/src/identify/identify.ts (L205-L210).

[spec]: https://github.com/libp2p/specs/tree/master/identify#identifypush

Pull-Request: #4495.
2023-09-24 11:36:58 +00:00
whtsht
95890b550b
refactor(dns): unify symbol naming
Renamed the following
- `dns::GenDnsConfig`  ->  `dns::Config`
- `dns::DnsConfig` -> `dns::async_std::Config`
- `dns::TokioDnsConfig` -> `dns::tokio::Config`

If async-std feature is enable, use `dns::async_std::Config`. When using tokio, import `dns::tokio::Config` . There is no need to use `dns::Config` directly.

Resolves #4486.
Related: #2217.

Pull-Request: #4505.
2023-09-24 05:31:42 +00:00
Max Inden
600b6af314
chore: prepare non-breaking releases
Crates to be released:

- core
- misc/futures-bounded
- misc/server
- misc/webrtc-utils
- protocols/kad
- protocols/ping
- protocols/upnp
- swarm
- transports/webrtc-websys
- transports/webrtc

Pull-Request: #4537.
2023-09-22 11:02:02 +00:00
Thomas Eizinger
32df6e8747
refactor(relay): delete now unused Action
This is a relict from when we still had to delay the construction of `ToSwarm` commands because some data was only available in `poll` via `PollParameters`. This is now resolved and `PollParameters` will go away.

Pull-Request: #4536.
2023-09-22 04:50:05 +00:00
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