1930 Commits

Author SHA1 Message Date
Max Inden
8dc0188a1d
swarm/src/connection: Test max_negotiating_inbound_streams (#2785)
Test that `HandlerWrapper` upholds the provided
`max_negotiating_inbound_streams` limit.
2022-08-16 10:15:31 +02:00
dependabot[bot]
6a9fa3d930
build(deps): Update prost requirement from 0.10 to 0.11 (#2788)
* build(deps): Update prost-build requirement from 0.10 to 0.11

Updates the requirements on [prost-build](https://github.com/tokio-rs/prost) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: prost-build
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): Update prost requirement from 0.10 to 0.11

Updates the requirements on [prost](https://github.com/tokio-rs/prost) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: prost
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-16 08:49:09 +02:00
Max Inden
878c49fa14
swarm/src/behaviour: Deprecate NetworkBehaviourEventProcess (#2784)
In preparation for https://github.com/libp2p/rust-libp2p/pull/2751.
2022-08-16 06:58:17 +02:00
qidu
0e5a25dea8
examples/file-sharing: Support binary files (#2786) 2022-08-16 05:12:28 +02:00
Thomas Eizinger
cef505685c
core/muxing: Generalise StreamMuxer::poll_address_change to poll (#2797)
This is to allow general-purpose background work to be performed
by implementations.
2022-08-16 04:50:17 +02:00
Elena Frank
06aaea67f3
*: Fix clippy::derive-partial-eq-without-eq (#2818) 2022-08-14 04:03:04 +02:00
Max Inden
0a01c81c7b
misc/multistream-select: Replace msg.get(0) with msg.first() (#2816) 2022-08-13 12:46:45 +02:00
Kourosh
a4110a2b69
*: Remove inject_connected / inject_disconnected from docs (#2805) 2022-08-10 10:20:31 +02:00
Kourosh
1012579d77
protocols/: Remove passing default variant to WithPeerId::condition (#2802) 2022-08-10 09:50:24 +02:00
Max Inden
3da8b423c2
README: Point to security@libp2p.io (#2799) 2022-08-08 10:57:11 +02:00
Max Inden
e2b83b7c8f
SECURITY.md: Document supported releases and security mail addr (#2800) 2022-08-08 08:14:46 +02:00
Max Inden
579b1be5d5
swarm-derive/: Generate OutEvent if not provided (#2792)
Generate `NetworkBehaviour::OutEvent` if not provided through
`#[behaviour(out_event = "MyOutEvent")]` and event processing is
disabled (default).
2022-08-08 07:18:32 +02:00
Thomas Eizinger
028decec69
core/muxing: Have functions on StreamMuxer take Pin<&mut Self> (#2765)
Co-authored-by: Elena Frank <elena.frank@protonmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-08-03 23:12:11 +10:00
Luke Hinds
2b9e212682
examples/README.md: Fix tutorial link (#2790) 2022-08-02 08:46:50 +02:00
Elena Frank
eaf3f3a7fb
.cargo: Check all features in custom-clippy (#2771) 2022-07-28 03:35:35 +02:00
Elena Frank
09c690862e
protocols/dcutr: Fix clippy lints (#2772) 2022-07-28 03:04:36 +02:00
Thomas Eizinger
56c492cf41
core/muxing: Drop Sync requirement for StreamMuxer on StreamMuxerBox (#2775)
`StreamMuxerBox` is never shared across threads but owned by a single
connection. Restricting it to be `Sync` unnecessarily limits the design
space around the `StreamMuxer` trait and its implementations.
2022-07-27 08:23:07 +02:00
Elena Frank
ce963dfcaa
core: fix clippy::op-ref, clippy::needless-borrow (#2770) 2022-07-25 17:57:50 +02:00
Elena Frank
74f01e47c9
transports/tcp: fix clippy::from-over-into (#2774) 2022-07-25 17:33:31 +02:00
Thomas Eizinger
0ec3bbccb2
core/muxing: Remove Unpin requirement from StreamMuxer::Substream (#2776) 2022-07-25 16:49:22 +02:00
Elena Frank
c19a211dfd
misc/metrics: fix clippy::assign-op-pattern (#2773) 2022-07-25 10:45:43 +02:00
Thomas Eizinger
f85a9909ac
core/tests: Remove unnecessary util module (#2764) 2022-07-25 17:34:05 +10:00
Elena Frank
95713ab91c
core: fix PR number in changelog entry (#2769) 2022-07-23 19:48:52 +01:00
Thomas Eizinger
2e2c117dab
core/tests: Remove unnecessary Arc (#2763) 2022-07-22 11:59:55 +02:00
Thomas Eizinger
f15a3dc4e0
core/muxing: Drop Unpin requirement from SubstreamBox (#2762)
We are already boxing the given object so we might as well pin to
to avoid the `Unpin` trait bound.
2022-07-22 11:40:27 +02:00
dependabot[bot]
51a847128c
build(deps): Update prometheus-client requirement from 0.16.0 to 0.17.0 (#2761)
* build(deps): Update prometheus-client requirement from 0.16.0 to 0.17.0

Updates the requirements on [prometheus-client](https://github.com/prometheus/client_rust) to permit the latest version.
- [Release notes](https://github.com/prometheus/client_rust/releases)
- [Changelog](https://github.com/prometheus/client_rust/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_rust/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: prometheus-client
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-22 11:20:39 +02:00
Hubert
163c5c1752
README.md: Add crates.io and docs.rs badges (#2766) 2022-07-22 06:58:41 +10:00
tgmichel
c8066df232
*: Update to if-watch 1.1.1 (#2754) 2022-07-19 09:14:00 +02:00
Max Inden
66c2319230
transports/tcp: Bump to v0.35.0 (#2760)
Follow up on https://github.com/libp2p/rust-libp2p/pull/2724/. Given that
libp2p-core is bumped to v0.35.0, libp2p-tcp needs to be bumped as well.
2022-07-19 08:57:50 +02:00
dependabot[bot]
e95232cfaa
build(deps): Bump Swatinem/rust-cache from 1.4.0 to 2.0.0 (#2759)
* build(deps): Bump Swatinem/rust-cache from 1.4.0 to 2.0.0

Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 1.4.0 to 2.0.0.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](cb2cf0cc7c...6720f05bc4)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 04:04:26 +02:00
Thomas Eizinger
1a553db596
core/muxing: Flatten StreamMuxer interface to poll_{inbound,outbound,address_change,close} (#2724)
Instead of having a mix of `poll_event`, `poll_outbound` and `poll_close`, we
flatten the entire interface of `StreamMuxer` into 4 individual functions:

- `poll_inbound`
- `poll_outbound`
- `poll_address_change`
- `poll_close`

This design is closer to the design of other async traits like `AsyncRead` and
`AsyncWrite`. It also allows us to delete the `StreamMuxerEvent`.
2022-07-18 05:20:11 +02:00
Max Inden
d4f8ec2d48
misc/metrics: Track # connected nodes supporting specific protocol (#2734)
* misc/metrics: Explicitly delegate event recording to each recorder

This allows delegating a single event to multiple `Recorder`s. That enables e.g. the
`identify::Metrics` `Recorder` to act both on `IdentifyEvent` and `SwarmEvent`. The latter enables
it to garbage collect per peer data on disconnects.

* protocols/dcutr: Expose PROTOCOL_NAME

* protocols/identify: Expose PROTOCOL_NAME and PUSH_PROTOCOL_NAME

* protocols/ping: Expose PROTOCOL_NAME

* protocols/relay: Expose HOP_PROTOCOL_NAME and STOP_PROTOCOL_NAME

* misc/metrics: Track # connected nodes supporting specific protocol

An example metric exposed with this patch:

```
libp2p_identify_protocols{protocol="/ipfs/ping/1.0.0"} 10
```

This implies that 10 of the currently connected nodes support the ping protocol.
2022-07-15 09:16:03 +02:00
Max Inden
7c8a97739f
swarm/src/handler: Document responsibility limiting inbound streams (#2752)
Document that the `ConnectionHandler` implementation has to enforce a limit on
the number of inbound substreams.
2022-07-14 06:15:19 +02:00
Chad Nehemiah
d0da3a0973
swarm/: Set default dial concurrency factor to 8 (#2741) 2022-07-07 11:20:03 +02:00
Roman
2f2b7cbec1
*: Bump swarm-derive version and prepare v0.46.1 (#2747) 2022-07-06 01:48:30 +02:00
Max Inden
7df6bae520
*: Prepare v0.46.0 (#2730) 2022-07-05 13:09:58 +02:00
Elena Frank
62622a1bad
core/src/transport: Poll Transport directly, remove Transport::Listener (#2652)
Remove the concept of individual `Transport::Listener` streams from `Transport`.
Instead the `Transport` is polled directly via `Transport::poll`. The
`Transport` is now responsible for driving its listeners.
2022-07-04 04:16:57 +02:00
Max Inden
b28cdb31f9
protocols/identify: Fix race condition in discover_peer_after_disconnect (#2744)
**Summary** of the plot of the `discover_peer_after_disconnect` test:

1. `swarm2` connects to `swarm1`.
2. `swarm2` requests an identify response from `swarm1`.
3. `swarm1` sends the response to `swarm2`.
4. `swarm2` disconnects from `swarm1`.
5. `swarm2` tries to disconnect.

**Problem**

`libp2p-identify` sets `KeepAlive::No` when it identified the remote. Thus `swarm1` might
identify` `swarm2` before `swarm2` identified `swarm1`. `swarm1` then sets `KeepAlive::No` and thus closes the
connection to `swarm2` before `swarm2` identified `swarm1`. In such case the unit test
`discover_peer_after_disconnect hangs indefinitely.

**Solution**

Add an initial delay to `swarm1` requesting an identification from `swarm2`, thus ensuring `swarm2`
is always able to identify `swarm1`.
2022-07-04 03:58:16 +02:00
bernardo
6db57121e9
protocols/gossipsub/: Allow custom protocol id (#2718)
Allow for custom protocol ID via `GossipsubConfigBuilder::protocol_id()`.
2022-07-02 10:30:02 +02:00
Max Inden
31f1d66138
Cargo.toml: Undo version bump to v0.47.0 as v0.46.0 is unreleased (#2733) 2022-07-01 16:33:27 +02:00
Max Inden
862ae14ae2
protocols/rendezvous/src/client: Fix clippy warning let-unit-value (#2742) 2022-07-01 16:13:21 +02:00
Akihito Nakano
748588e3f0
protocols/gossipsub: Fix a typo in error message (#2739)
* protocols/gossipsub: Fix a typo in error message

* protocols/gossipsub: Make the error message accurately
2022-06-30 10:20:26 +02:00
Elena Frank
423adca0bf
protocols/identify: Fix dev deps for example (#2737) 2022-06-29 06:37:57 +02:00
dependabot[bot]
9f7d0fe0ac
build(deps): Bump styfle/cancel-workflow-action from 0.9.1 to 0.10.0 (#2731)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.9.1 to 0.10.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](a40b8845c0...bb6001c4ea)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 05:23:35 +02:00
Max Inden
71909522cf
transports/tcp/: Call take_error on tokio TcpStream (#2725)
See e04e95a for the rational.

With tokio `v1.19.0` released, `TcStream` exposes `take_error`.

This commit applies the same fix from e04e95a to the tokio TCP provider.
2022-06-27 09:36:33 +02:00
pj50
f814b21f5a
protocols/relay: Don't duplicate p2p protocol in relay reservation (#2696) (#2701) 2022-06-27 06:54:40 +02:00
dadepo
40744beec1
protocols/identify/: Add example (#2689) 2022-06-27 04:17:59 +02:00
Max Inden
072d7364a1
swarm/CHANGELOG: Merge unreleased section v0.36.2 with v0.37.0 (#2727) 2022-06-26 14:24:50 +02:00
Max Inden
2c70c59618
protocols/identify: Extend log message on second identify push (#2726)
Print remote peer ID when seeing a second identify push stream coming in.
2022-06-26 10:37:29 +02:00
Thomas Eizinger
0f40e513cc
core/muxing: Replace Into<io::Error> bound on StreamMuxer with std::error::Error (#2710)
* core/muxing: Remove `Into<io::Error>` bound from `StreamMuxer::Error`

This allows us to preserve the type information of a muxer's concrete
error as long as possible. For `StreamMuxerBox`, we leverage `io::Error`'s
capability of wrapping any error that implements `Into<Box<dyn Error>>`.

* Use `?` in `Connection::poll`

* Use `?` in `muxing::boxed::Wrap`

* Use `futures::ready!` in `muxing::boxed::Wrap`

* Fill PR number into changelog

* Put `Error + Send + Sync` bounds directly on `StreamMuxer::Error`

* Move `Send + Sync` bounds to higher layers

* Use `map_inbound_stream` helper

* Update changelog to match new implementation
2022-06-24 08:26:49 +02:00