2799 Commits

Author SHA1 Message Date
Ivan Boldyrev
8d9881d965 ed25519 feature doens't depend on rand directly 2023-10-05 20:41:05 +04:00
Ivan Boldyrev
719a6e0cf1 Merge branch 'master' into rand-feature 2023-10-05 19:02:35 +04:00
Ivan Boldyrev
4fe58a1a3b libp2p-identity version bump 2023-10-05 18:27:30 +04:00
Thomas Eizinger
7d1d67cad3
ci: create dependency cache layer of interop tests
Currently, the Docker images for the HEAD branch of the pull-request get re-built completely every time we push a new commit to a branch. That is because the RUN caches use the local disk of the host system but those are ephemeral in GitHub actions.

To fix this, we rewrite the dockerfiles to use `cargo chef`, a tool developed to create a cached layer of built dependencies that doesn't get invalidated as the application source changes.

Normally, these layers are also cached on the local filesystem. To have them available across pull-requests and branches, we instruct buildkit to use the same S3 cache as we use in the interop tests already for docker layers. As a result, this should greatly speed up our CI.

Resolves: #3925.

Pull-Request: #4593.
2023-10-05 04:14:45 +00:00
Marco Inacio
246acfd425
refactor(examples): change ipfs-kad from async-std to tokio
Related: #4449.

Pull-Request: #4590.
2023-10-05 03:27:02 +00:00
Marco Inacio
0e94bc24c7
refactor(examples): change ipfs-private from async-std to tokio
Related: #4449.

Pull-Request: #4591.
2023-10-04 23:18:25 +00:00
Ivan Boldyrev
554e09762f Fix wasm-tests 2023-10-04 15:28:01 +04:00
Ivan Boldyrev
afde3f84a6 Add identity's rand feature to libp2p 2023-10-04 12:18:27 +04: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
Ivan Boldyrev
ea1a136ab9 Merge branch 'master' into rand-feature 2023-10-03 22:38:09 +04:00
Ivan Boldyrev
2fe25c725c Restore a comment with doctest 2023-10-03 21:56:26 +04:00
Ivan Boldyrev
866cc1a21a identity doesn't have rand as default 2023-10-03 21:54:32 +04:00
Arpan Kapoor
399eaa3915
refactor(examples): change ping from async-std to tokio
Related: #4449.

Pull-Request: #4570.
2023-10-03 06:35:13 +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]
5c7a18bc1f
deps: bump reqwest from 0.11.20 to 0.11.21
Pull-Request: #4584.
2023-10-03 00:24:14 +00:00
Thomas Eizinger
60650d8b90
chore(identity): release version 0.2.4
`libp2p-identity` gets a special treatment in our workspace because it is the only crate that is a dependency of crates _outside_ the workspace, in particular `multiaddr`. We however also depend on `multiaddr` again in the workspace. As a result, we need to use `[patch.crates-io]` to replace the `libp2p-identity` version across the entire dependency tree. This however doesn't work well with `cargo semver-checks` as it doesn't copy over `[patch]` sections into its workspace where it does the docs building.

To fix the semver checks error, we need to release a new version of `libp2p-identity`.

Pull-Request: #4583.
2023-10-03 00:04:57 +00:00
Thomas Eizinger
ef1cd354d8
fix(identity): address clippy lint
Pull-Request: #4582.
2023-10-02 22:59:39 +00:00
Ivan Boldyrev
11de754832 Merge branch 'master' into rand-feature 2023-10-02 16:56:11 +04:00
Ivan Boldyrev
6c03b8c6ae Merge branch 'master' into rand-feature 2023-10-02 16:36:16 +04: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
João Oliveira
7f92cb0725
feat(quic): support stateless resets
Resolves #3419.

Pull-Request: #4554.
2023-10-02 00:28:32 +00:00
Dominik Vogt
c86d1117be
refactor(examples): change autonat example from async-std to tokio
Changed the `autonat` example to use `tokio` instead of `async-std` as runtime.

Related: #4449.

Pull-Request: #4574.
2023-10-01 21:38:40 +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
Thomas Eizinger
91fb6a16eb
feat(deflate): deprecate in preparation for removal
Resolves: #4522.

Pull-Request: #4540.
2023-09-27 08:32:40 +00:00
Thomas Eizinger
9cd0f3dbed
fix(swarm): prevent overflow in keep-alive computation
When adding a very large `Duration` to an `Instant`, an overflow can occur. To fix this, we check this before instantiating `Delay` and half the given duration until it no longer overflows.

Fixes: #4555.

Pull-Request: #4559.
2023-09-27 07:38:03 +00:00
Ivan Boldyrev
4143eafbff Make ed25519-dalek's rand_core feature optional
It has to be enabled by rand feature only.
2023-09-26 14:24:19 +04: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]
636966697e
deps: bump tokio-util from 0.7.8 to 0.7.9
Pull-Request: #4552.
2023-09-25 08:45:20 +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
dependabot[bot]
8e1944c6e1
deps: bump curve25519-dalek from 4.1.0 to 4.1.1
Pull-Request: #4550.
2023-09-25 08:21:51 +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
Marco Inacio
b4d9e5294b
refactor(examples): change chat from async-std to tokio
Related: #4449.

Pull-Request: #4539.
2023-09-23 09:47:53 +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
Divma
89b4bf4d7f
deps(quic): upgrade quinn to address RUSTSEC-2023-0063
https://rustsec.org/advisories/RUSTSEC-2023-0063 was recently published, this address it.

Pull-Request: #4538.
2023-09-21 22:07:11 +00:00
dependabot[bot]
484fc5693c
deps: bump docker/login-action from 2 to 3
Pull-Request: #4494.
2023-09-21 08:27:35 +00:00
Thomas Eizinger
2157052794
examples: employ consistent naming
Resolves: #4459.

Pull-Request: #4533.
2023-09-21 01:10:24 +00:00
Thomas Eizinger
c97f86f61e
docs: remove old multiaddr README
Pull-Request: #4532.
2023-09-21 00:58:31 +00:00
Thomas Eizinger
02d0ee0b3d
refactor(webrtc): remove example in favor of browser-webrtc example
We've moved away from having individual examples in crates in #3111. This one in `transports/webrtc` seems to have slipped through.

Pull-Request: #4531.
2023-09-21 00:47:05 +00:00
João Oliveira
854a6ae868
refactor(swarm): update ConnectionDenied::new
This allows us to input `String`'s and `&str` on ConnectionDenied::new() as there's [`From<String> for Box<dyn Error + Send + Sync>`](https://doc.rust-lang.org/std/error/trait.Error.html#impl-From%3CString%3E-for-Box%3Cdyn+Error+%2B+Send+%2B+Sync,+Global%3E).

Pull-Request: #4530.
2023-09-20 22:03:41 +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
Panagiotis Ganelis
5d740a8665
refactor(core): blanket implementation of connection upgrade
Introduces blanket implementation of `{In,Out}boundConnectionUpgrade` and uses it in transport upgrade infrastructure.

Resolves: #4307.

Pull-Request: #4316.
2023-09-20 01:36:39 +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