1842 Commits

Author SHA1 Message Date
Elena Frank
a414afd83c
swarm/: include ListenerId in SwarmEvents (#2123)
Co-authored-by: Max Inden <mail@max-inden.de>
2021-07-08 11:41:33 +02:00
Thomas Eizinger
c1ef4bffd2
core/: Redesign upgrade::{write_one, write_with_len_prefix, read_one} (#2111)
1. Deprecating the `write_one` function

  Semantically, this function is a composition of `write_with_len_prefix` and
  `io.close()`. This represents a footgun because the `close` functionality is
  not obvious and only mentioned in the docs. Using this function multiple times
  on a single substream will produces hard to debug behaviour.

2. Deprecating `read_one` and `write_with_len_prefix` functions

3. Introducing `write_length_prefixed` and `read_length_prefixed`

- These functions are symmetric and do exactly what you would expect, just
  writing to the socket without closing
- They also have a symmetric interface (no more custom errors, just `io::Error`)

Co-authored-by: Max Inden <mail@max-inden.de>
2021-07-03 16:23:10 +02:00
Sergey O. Boyko
4eb0659e4d
swarm/: Allow disconnecting from Swarm and NetworkBehaviour (#2110)
Add `ExpandedSwarm::disconnect_peer_id` and
`NetworkBehaviourAction::CloseConnection` to close connections to a specific
peer via an `ExpandedSwarm` or `NetworkBehaviour`.

Co-authored-by: Max Inden <mail@max-inden.de>
2021-07-02 19:35:51 +02:00
r-zig
f9491e7e81
protocols/relay: Simplify running the relay example (#2080)
Simplify running the relay example with all peers run via docker compose.

Co-authored-by: Max Inden <mail@max-inden.de>
2021-06-30 22:13:36 +02:00
Oliver Wangler
e038f87c60
transports/dns: Document caveats of using the trust-dns-resolver crate (#2114)
Ref https://github.com/libp2p/rust-libp2p/issues/2064
2021-06-30 21:02:20 +02:00
Tejas Sanap
b96996febf
muxers/mplex: Allow up to 60 bit long stream IDs (#2094)
Resolving issue: #2061

Co-authored-by: Max Inden <mail@max-inden.de>
2021-06-28 17:47:59 +02:00
Max Inden
904880f5e9
protocols/kad: Extend emitted events with basic information (#2087)
* Expose kbucket range on RoutingUpdated.

* Expose inbound request information.

* Expose whether routing update is new peer.
2021-06-28 14:14:31 +02:00
Elena Frank
e8fed53598
swarm/: Drive ExpandedSwarm via Stream trait only (#2100)
Change `Stream` implementation of `ExpandedSwarm` to return all
`SwarmEvents` instead of only the `NetworkBehaviour`'s events.

Remove `ExpandedSwarm::next_event`. Users can use `<ExpandedSwarm as
StreamExt>::next` instead.

Remove `ExpandedSwarm::next`. Users can use `<ExpandedSwarm as
StreamExt>::filter_map` instead.
2021-06-14 20:41:44 +02:00
David Craven
d45606ac97
protocols/gossipsub: Reduce log levels (#2101) 2021-06-12 08:11:55 +02:00
Max Inden
f874417562
README: Remove freenode IRC link (#2096) 2021-06-11 14:21:37 +02:00
Max Inden
762f4e35e7
core/CHANGELOG: Add entry for PR 2090 (#2097)
Include changelog entry for a24e4221bdeeffc9260e6e08636bc7f8f231e168.
2021-06-08 10:14:31 +02:00
Max Inden
a24e4221bd
core/src/identity: Implement Keypair::from_protobuf_encoding for ed25519 (#2090)
Implement `Keypair` decoding from Protobuf according to [peer id
specification]. For now support ed25519 keys only. Future commits might
add RSA secp256k1 and ecdsa.

[peer id specification]: https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#keys
2021-06-07 10:17:46 +02:00
Max Inden
3b0f5a4f96
README: Remove compatibility warning (#2077)
With the ethereum 2 [lighthouse client] and the Filecoin [forest client]
we have two rust-libp2p users demonstrating compatibility of the
rust-libp2p library with other libp2p implementations on a daily basis
on their corresponding live networks.

That in mind the compatibility warning is out of date. While we could do
better, especially in regards to automated compatibility testing across
implementations, rust-libp2p is in fact compatible with the libp2p
specification as well as other libp2p implementations.

[lighthouse client]: https://github.com/sigp/lighthouse

[forest client]: https://github.com/ChainSafe/forest
2021-05-28 14:28:08 +02:00
dependabot[bot]
339a9971ab
build(deps): Bump actions/cache from 2.1.5 to 2.1.6 (#2084)
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.5...v2.1.6)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-28 11:43:43 +02:00
Max Inden
28fe6eda28
*: Use upstream multiaddr crate (#2075)
Use multiaddr instead of parity-multiaddr, removing the latter from the
repository.
2021-05-27 14:04:33 +02:00
Age Manning
a4728198a4
protocols/gossipsub: Fix minor lints and spelling (#2079) 2021-05-26 14:54:42 +02:00
dependabot[bot]
bf0cdbbff1
build(deps): Update libsecp256k1 requirement from 0.3.1 to 0.5.0 (#2074)
* build(deps): Update libsecp256k1 requirement from 0.3.1 to 0.5.0

Updates the requirements on [libsecp256k1](https://github.com/paritytech/libsecp256k1) to permit the latest version.
- [Release notes](https://github.com/paritytech/libsecp256k1/releases)
- [Changelog](https://github.com/paritytech/libsecp256k1/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/libsecp256k1/commits)

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

* core/identity/scp256k1: Use libsecp256k1::SecretKey::random directly

* core/: Update changelog and cargo toml

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-05-21 14:15:51 +02:00
Max Inden
d9f1c71b2a
misc/multistream-select: Cleanup trait bounds and remove unused file (#2067)
* misc/multistream-select: Remove unused file error.rs

* misc/multistream-select: Remove unnecessary trait bounds
2021-05-17 13:13:35 +02:00
Max Inden
0b7ee3fa92
*: Prepare v0.38.0 (#2072) 2021-05-17 12:43:24 +02:00
Age Manning
c5bcada2c2
protocols/gossipsub: Rework connection keep-alive (#2043)
Keep connections to peers in a mesh alive. Allow closing idle connections to
peers not in a mesh.

Co-authored-by: Max Inden <mail@max-inden.de>
2021-05-14 09:16:50 +02:00
dependabot[bot]
9c5dd84099
build(deps): Update snow requirement from 0.7.1 to 0.8.0 (#2068)
* build(deps): Update snow requirement from 0.7.1 to 0.8.0

Updates the requirements on [snow](https://github.com/mcginty/snow) to permit the latest version.
- [Release notes](https://github.com/mcginty/snow/releases)
- [Commits](https://github.com/mcginty/snow/compare/v0.7.1...v0.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-05-12 18:33:31 +02:00
dependabot[bot]
1fdac073fc
build(deps): Bump actions-rs/toolchain from 1 to 1.0.7 (#2069)
Bumps [actions-rs/toolchain](https://github.com/actions-rs/toolchain) from 1 to 1.0.7.
- [Release notes](https://github.com/actions-rs/toolchain/releases)
- [Changelog](https://github.com/actions-rs/toolchain/blob/master/CHANGELOG.md)
- [Commits](https://github.com/actions-rs/toolchain/compare/v1...v1.0.7)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 14:05:10 +02:00
dependabot[bot]
10fcc1c485
build(deps): Bump actions-rs/cargo from 1 to 1.0.3 (#2070)
Bumps [actions-rs/cargo](https://github.com/actions-rs/cargo) from 1 to 1.0.3.
- [Release notes](https://github.com/actions-rs/cargo/releases)
- [Changelog](https://github.com/actions-rs/cargo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/actions-rs/cargo/compare/v1...v1.0.3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 12:04:46 +02:00
dependabot[bot]
82c8b1a4b3
build(deps): Bump actions/checkout from 2 to 2.3.4 (#2071)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 2.3.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v2.3.4)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-12 11:12:41 +02:00
Max Inden
43a8ad8fc2
protocols/relay/examples: Add client server instructions (#2060)
Add instructions on how to run a three node example where a listening
relay client listens via a relay server and a dialing relay client dials
the listening relay client via the relay server.
2021-05-10 15:39:56 +02:00
David Craven
8988ac247e
protocols/mdns: Fix discovered event emission. (#2065)
mdns keeps rediscovering nodes. this PR changes that to only emit events for new
nodes it discovered. In addition we make sure to only send a query if it is
really needed. Some logging is added for debugging purposes.
2021-05-06 17:08:29 +02:00
dependabot[bot]
5c541a16f1
build(deps): update salsa20 requirement from 0.7 to 0.8 (#2062)
* build(deps): update salsa20 requirement from 0.7 to 0.8

Updates the requirements on [salsa20](https://github.com/RustCrypto/stream-ciphers) to permit the latest version.
- [Release notes](https://github.com/RustCrypto/stream-ciphers/releases)
- [Commits](https://github.com/RustCrypto/stream-ciphers/compare/ctr-v0.7.0...salsa20-v0.8.0)

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

* *: Update changelog and cargo tomls

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-30 10:09:13 +02:00
Andre-Philippe Paquet
d931f36428
transport/wasm-ext: Support dialing Multiaddr with /p2p protocol (#2058)
Changes in 45f07bf8 now seem to append `/p2p/<peer>` to multiaddr passed to
transports. The regex in transport/wasm-ext doesn't support this fully qualified
format. This commit adjusts the regex accordingly.
2021-04-27 19:28:53 +02:00
Tomas Zemanovic
6257a8d402
protocols/gossipsub: Remove regex-filter feature flag (#2056)
Remove `regex-filter` feature flag thus always enabling
`regex::RegexSubscriptionFilter`.
2021-04-27 15:00:13 +02:00
Artem Vorotnikov
5ee003b76e
core/src/identity: Fix build with secp256k1 disabled (#2057) 2021-04-26 16:53:50 +02:00
David Craven
29d969be34
protocols/mdns: Fix timely discovery after listening on new address (#2053)
If you start listening after mdns joined a multicast group, the peers may not
discover eachother until the 5min timeout expires.

Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-21 16:07:38 +02:00
Max Inden
40c4287bc9
*: Prepare libp2p-swarm-derive v0.23.0 and libp2p v0.37.1 2021-04-14 20:25:16 +02:00
Max Inden
42441dbd86
*: Prepare v0.37.0 release (#2049) 2021-04-13 20:15:15 +02:00
dependabot[bot]
807ce10656
build(deps): bump actions/cache from v2.1.4 to v2.1.5 (#2050)
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-13 14:32:43 +02:00
David Craven
05aa794552
Derive debug for RelayConfig. (#2048)
Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-12 22:30:09 +02:00
dependabot[bot]
426a20c66b
Update yamux requirement from 0.8.0 to 0.9.0 (#1960)
* Update yamux requirement from 0.8.0 to 0.9.0

Updates the requirements on [yamux](https://github.com/paritytech/yamux) to permit the latest version.
- [Release notes](https://github.com/paritytech/yamux/releases)
- [Changelog](https://github.com/paritytech/yamux/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/paritytech/yamux/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-12 22:06:01 +02:00
Max Inden
8ccb96a9f3
*: Drop generic wasm32-unknown-unknown support (#2038)
With `rand` `v0.8.0` platform support changed [1] due to its upgrade to
`getrandom` `v0.2`. With `getrandom` `v0.2` `wasm32-unknown-unknown` is no
longer supported out of the box:

> This crate fully supports the wasm32-wasi and wasm32-unknown-emscripten
> targets. However, the wasm32-unknown-unknown target is not automatically
> supported since, from the target name alone, we cannot deduce which JavaScript
> interface is in use (or if JavaScript is available at all).
>
> Instead, if the "js" Cargo feature is enabled, this crate will assume that you
> are building for an environment containing JavaScript, and will call the
> appropriate methods. Both web browser (main window and Web Workers) and
> Node.js environments are supported, invoking the methods described above using
> the wasm-bindgen toolchain.
>
> This feature has no effect on targets other than wasm32-unknown-unknown.

This commit drops support for wasm32-unknown-unknown in favor of the two more
specific targets wasm32-wasi and wasm32-unknown-emscripten.

Note on `resolver = "2"`: The new resolver is required to prevent features
being mixed, more specifically to prevent libp2p-noise to build with the
`ring-resolver` feature. See [3] for details.

---

[1] https://github.com/rust-random/rand/blob/master/CHANGELOG.md#platform-support
[2] https://docs.rs/getrandom/0.2.2/getrandom/#webassembly-support
[3] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
2021-04-12 21:41:48 +02:00
David Craven
687145d784
protocols: Derive debug for MemoryStoreConfig and IdentifyConfig (#2029) 2021-04-12 13:30:30 +02:00
dependabot[bot]
b1b6f2bafe
build(deps): bump styfle/cancel-workflow-action from 0.8.0 to 0.9.0 (#2045)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.8.0...89f242ee29e10c53a841bfe71cc0ce7b2f065abc)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-12 10:16:14 +02:00
Max Inden
de261d5280
.github: Only test benchmarks, don't run them (#2042)
Instead of fully executing benchmarks, i.e. running multiple iterations,
each measured and recorded, only test that they compile and run them
with a single execution to make sure they work. The benefit is a reduced
CI runtime.

Flag documentation:

> To test that the benchmarks run successfully without performing the
measurement or analysis (eg. in a CI setting), use cargo test --benches.

https://bheisler.github.io/criterion.rs/book/user_guide/command_line_options.html

The above assumes that (a) the benchmark results from CI are likely
noisy and thus (b) no one actually looks at the benchmark results.
2021-04-10 22:25:11 +02:00
Max Inden
2d995a62e7
*: Fix redundant_semicolons warnings (#2039) 2021-04-10 21:40:06 +02:00
Max Inden
7cf8ac0862
protocols/identify: Emit Push event after successful identification push (#2030) 2021-04-10 19:46:57 +02:00
OnikenX
6fdfb44a54
examples/chat-tokio: Fix run example feature (#2037) 2021-04-09 18:54:23 +02:00
Thomas Eizinger
385af35047
Implement std::error::Error for InboundFailure and OutboundFailure (#2033)
Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-08 13:14:34 +02:00
Max Inden
7386fd7fd8
README: Link to Code of Conduct (#2028) 2021-04-06 14:10:25 +02:00
Max Inden
48f3f0606c
transports/dns: Prepave v0.28.1 2021-04-01 16:16:07 +02:00
Pierre Krieger
2017c5c73a
transports/dns: Remove fqdn function optimization (#2027)
Co-authored-by: Max Inden <mail@max-inden.de>
2021-04-01 16:11:36 +02:00
Max Inden
a2e774992d
src: Move introduction to new tutorial.rs (#2018)
This commit extends the ping example in `src/tutorial.rs, by walking a
newcomer through the implementation of a simple ping node step-by-step,
introducing all the core libp2p concepts along the way.

With the ping tutorial in place, there is no need for the lengthy libp2p
crate level introduction, which is thus removed with this commit.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2021-04-01 15:46:41 +02:00
Max Inden
a0bdc206dc
transports/wasm-ext: Prepare v0.28.1 2021-04-01 14:28:32 +02:00
David
c0f74aa408
transports/wasm-ext: Require at least js-sys v0.3.50 (#2023) 2021-04-01 14:25:27 +02:00