Commit Graph

2766 Commits

Author SHA1 Message Date
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
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
636966697e deps: bump tokio-util from 0.7.8 to 0.7.9
Pull-Request: #4552.
2023-09-25 08:45:20 +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
8e1944c6e1 deps: bump curve25519-dalek from 4.1.0 to 4.1.1
Pull-Request: #4550.
2023-09-25 08:21:51 +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
b4d9e5294b refactor(examples): change chat from async-std to tokio
Related: #4449.

Pull-Request: #4539.
2023-09-23 09:47:53 +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
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
484fc5693c deps: bump docker/login-action from 2 to 3
Pull-Request: #4494.
2023-09-21 08:27:35 +00:00
2157052794 examples: employ consistent naming
Resolves: #4459.

Pull-Request: #4533.
2023-09-21 01:10:24 +00:00
c97f86f61e docs: remove old multiaddr README
Pull-Request: #4532.
2023-09-21 00:58:31 +00:00
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
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
efea4902a5 refactor(relay): move stream-handling away from {In,Out}boundUpgrade
Fixes: #4075.

Pull-Request: #4275.
2023-09-20 08:11:36 +00:00
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
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
ff92ba0f90 docs(roadmap): mark UPnP as done
Marks UPnP as `done` in the ROADMAP.md

Pull-Request: #4518.
2023-09-18 23:20:52 +00:00
7b5d815389 deps: bump syn from 2.0.32 to 2.0.37
Pull-Request: #4517.
2023-09-18 10:14:43 +00:00
4f5b9e3afb deps: bump libc from 0.2.147 to 0.2.148
Pull-Request: #4516.
2023-09-18 09:54:13 +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
589ca19f6d deps: bump rust-embed from 6.8.1 to 8.0.0
Pull-Request: #4514.
2023-09-18 09:29:47 +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
7f27b58a32 deps: bump trybuild from 1.0.84 to 1.0.85
Pull-Request: #4511.
2023-09-18 09:05:59 +00:00
c37d9d56d7 deps: bump proc-macro2 from 1.0.66 to 1.0.67
Pull-Request: #4512.
2023-09-18 08:52:41 +00:00
f5e644da8f feat(webrtc): add WebRTC for WASM environments
This PR implements `Transport` for WebRTC for browsers by using web-sys. Only the `webrtc-direct` spec is implemented. The `webrtc` spec for connecting two browsers with each other is left to a future PR.

Related: https://github.com/libp2p/specs/issues/475.
Related #2617.
Supersedes: #4229.

Pull-Request: #4248.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2023-09-17 19:13:11 +00:00
508cad1f0d feat(kad): migrate to quick-protobuf-codec crate
Resolves #4487.

Pull-Request: #4501.
2023-09-15 21:11:09 +00:00
2c3d6ad6da deps: bump docker/setup-buildx-action from 2 to 3
Pull-Request: #4492.
2023-09-14 03:49:28 +00:00
350b21bbd3 deps: bump docker/build-push-action from 4 to 5
Pull-Request: #4493.
2023-09-14 00:54:11 +00:00
768952a913 deps: bump docker/metadata-action from 4 to 5
Pull-Request: #4491.
2023-09-14 00:16:23 +00:00
def4ac48ed fix(ci): only push docker image if we have the necessary permissions
We run this workflow in several contexts: `pull_request`, `tags` and `push`. For the events that are not `pull_request`, this property won't be defined, i.e. be `undefined`. Negating that should yield `true` which is what we want: push the image for the `master` branch and on new tags that start with `libp2p-server-*`.

Pull-Request: #4502.
2023-09-13 23:46:08 +00:00
1fff308d19 feat(interop-tests): avoid re-building wasm-pack and wasm-opt
These two are currently always re-built on every run. We don't need `wasm-opt` if we build the WASM in debug mode and we can install `wasm-pack` by downloading it from a URL.

Pull-Request: #4497.
2023-09-13 10:04:28 +00:00
34b37987ca deps: bump Swatinem/rust-cache from 2.6.2 to 2.7.0
Pull-Request: #4498.
2023-09-13 09:15:41 +00:00
4ea42c99eb refactor(server): remove spawning of 2nd tokio runtime
Closes #4448.

Pull-Request: #4454.
2023-09-13 02:45:50 +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
b0c3da7f87 feat(swarm): log local peer id on swarm creation
Closes https://github.com/libp2p/rust-libp2p/issues/4394.

Pull-Request: #4439.
2023-09-12 10:09:27 +00:00
581b1e42d0 deps: bump webrtc from 0.8.0 to 0.9.0
Pull-Request: #4475.
2023-09-12 09:30:16 +00:00
b8f47aa988 ci: use docker/metadata-action
Current approach is not robust to more complex branch names.

Related https://github.com/libp2p/rust-libp2p/pull/4311#discussion_r1303958188.

Pull-Request: #4421.
2023-09-12 05:54:29 +00:00
92b5721ccb deps: bump stun from 0.4.4 to 0.5.0
Pull-Request: #4482.
2023-09-12 05:34:12 +00:00
0e64d71196 fix(server): filter out /quic in favor of /quic-v1
Configuration files generated by Kubo <= v0.22 list both `/quic` and `/quic-v1` listen addresses with the same UDP port. Given that we enable draft-29, the two addresses are treated the same by rust-libp2p's QUIC implementation. Though calling `listen_on` with both results in an "Address already in use" error by the OS on the second call. To prevent this from happening filter out `/quic` addresses in favor of `/quic-v1`.

Pull-Request: #4467.
2023-09-12 03:03:38 +00:00
d1d358ca43 deps: bump syn from 2.0.31 to 2.0.32
Pull-Request: #4473.
2023-09-12 00:53:23 +00:00
ca9fdf8b0d deps: bump curve25519-dalek from 4.0.0 to 4.1.0
Pull-Request: #4472.
2023-09-12 00:33:35 +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
240019f809 deps: update webpki to 0.22.1
A simple update to our lockfile to help fix #4375.

Pull-Request: #4483.
2023-09-11 20:53:38 +00:00
ce8f38cc16 feat(misc/server): add libp2p-lookup to rust-libp2p-server
As mentioned in #4444, we need to include https://github.com/mxinden/libp2p-lookup/ in the image so that we can enable a healthcheck when it starts up.

Pull-Request: #4466.
2023-09-11 16:51:54 +00:00
ae3cef14cb deps: bump serde_json from 1.0.105 to 1.0.106
Pull-Request: #4481.
2023-09-11 14:13:30 +00:00
3609423628 deps: bump trybuild from 1.0.83 to 1.0.84
Pull-Request: #4471.
2023-09-11 13:53:24 +00:00