Commit Graph

1034 Commits

Author SHA1 Message Date
3e824d9639 Merge branch 'master' into rand-feature 2023-10-17 12:22:29 +04:00
411824ad50 feat(kad): deprecate Config::set_connection_idle_timeout
Related: #3844.
Related: #4659.

Pull-Request: #4675.
2023-10-17 07:46:19 +00:00
21c7ee88ba deps: bump regex from 1.10.0 to 1.10.2
Pull-Request: #4668.
2023-10-17 03:41:05 +00:00
82902fc9f9 fix(kad): re-export NodeStatus
The `EntryView` struct exposes the node status however its type is not public making it impossible to use the status field. This change re-exports `NodeStatus`.

Related: #4108.

Pull-Request: #4645.
2023-10-16 23:54:36 +00:00
ce91c1c22c chore: apply clippy lints to public API
By default, clippy doesn't suggest changes if it would break the public API. Whilst a sensible default, it makes us miss certain opportunities to follow conventions correctly. When a new lint is added, we can always temporarily allow it and make a change in the next breaking release but I think it is better to be aware of the lint than having it automatically silenced.

Pull-Request: #4653.
2023-10-16 21:57:36 +00:00
5d54f705f7 Merge branch 'master' into rand-feature 2023-10-16 21:57:44 +04:00
7c6f75eaf2 feat(swarm): deprecate KeepAlive::Until
In preparation for removing this variant, we are issuing a deprecation notice. The linked issue describes why and guides users in migrating away from it. This deprecation is backwards-compatible and allows us to remove the variant in the next breaking release. We haven't migrated all internal protocols yet but that isn't strictly necessary to issue the deprecation.

Related: #3844.

Pull-Request: #4656.
2023-10-16 16:32:09 +00:00
e1c1f038fe chore(perf): remove unused module
Related: #3844.

Pull-Request: #4655.
2023-10-16 07:05:10 +00:00
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
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
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
4686ce8e66 feat(rendezous): refresh registration on change to external addresses
Resolves #4627.

Pull-Request: #4629.
2023-10-15 08:40:13 +00:00
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
ee4f2f55b0 Merge branch 'master' into rand-feature 2023-10-14 11:24:57 +04:00
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
d6351eead7 deps: bump if-watch from 3.0.1 to 3.1.0
Pull-Request: #4635.
2023-10-13 06:10:06 +00:00
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
7fbd4f1e56 Fix compilation in certain crates 2023-10-11 13:16:19 +04:00
fe1b8b7b8f Add rand feature to tests where required 2023-10-10 18:00:36 +04:00
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
3ae72557ab deps: bump tokio from 1.32.0 to 1.33.0
Pull-Request: #4615.
2023-10-10 05:17:02 +00:00
6cc40fe533 deps: bump byteorder from 1.4.3 to 1.5.0
Pull-Request: #4614.
2023-10-10 05:04:05 +00:00
5efcb8ff6d deps: bump regex from 1.9.6 to 1.10.0
Pull-Request: #4617.
2023-10-10 01:13:45 +00:00
1bfaf1c67d deps: bump lru from 0.11.1 to 0.12.0
Pull-Request: #4610.
2023-10-09 12:04:49 +00:00
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
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
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
980bda088d deps: bump regex from 1.9.5 to 1.9.6
Pull-Request: #4577.
2023-10-03 02:03:02 +00:00
3ff354f1ef deps: bump thiserror from 1.0.48 to 1.0.49
Pull-Request: #4578.
2023-10-03 01:50:38 +00:00
90a9752dc7 deps: bump sha2 from 0.10.7 to 0.10.8
Pull-Request: #4579.
2023-10-02 09:03:11 +00:00
ecdd0ff767 refactor(identify): use ReadyUpgrade for {In,Out}boundUpgrade
Related: #2863.

Pull-Request: #4563.
2023-09-28 23:23:54 +00:00
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
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
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
fffd47b69f refactor(plaintext): rename symbols to follow naming convention
Related: #2217.

Pull-Request: #4535.
2023-09-27 19:42:45 +00:00
f6b5a1376a chore(kad): update kad caching docs for clarity about write mechanism
Pull-Request: #4564.
2023-09-27 19:30:33 +00:00
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
94432d83ad deps: bump smallvec from 1.11.0 to 1.11.1
Pull-Request: #4551.
2023-09-25 08:33:29 +00:00
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
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
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
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
efea4902a5 refactor(relay): move stream-handling away from {In,Out}boundUpgrade
Fixes: #4075.

Pull-Request: #4275.
2023-09-20 08:11:36 +00:00
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
3ee8ab6581 deps: bump serde_json from 1.0.106 to 1.0.107
Pull-Request: #4515.
2023-09-18 09:41:40 +00:00
8a523f950f deps: bump socket2 from 0.5.3 to 0.5.4
Pull-Request: #4513.
2023-09-18 09:17:45 +00:00
508cad1f0d feat(kad): migrate to quick-protobuf-codec crate
Resolves #4487.

Pull-Request: #4501.
2023-09-15 21:11:09 +00:00
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
f798572e78 deps: bump lru from 0.11.0 to 0.11.1
Pull-Request: #4478.
2023-09-11 23:57:05 +00:00
0df1a96e3c deps: bump base64 from 0.21.3 to 0.21.4
Pull-Request: #4479.
2023-09-11 23:32:09 +00:00