1707 Commits

Author SHA1 Message Date
Addy Bryant
b0dc4bc1c7
swarm-derive/: Allow mixing of ignored fields (#2570) 2022-03-18 16:37:00 +01:00
dependabot[bot]
7f97d49073
build(deps): Update derive_builder requirement from 0.10.0 to 0.11.1 (#2568)
Updates the requirements on [derive_builder](https://github.com/colin-kiegel/rust-derive-builder) to permit the latest version.
- [Release notes](https://github.com/colin-kiegel/rust-derive-builder/releases)
- [Commits](https://github.com/colin-kiegel/rust-derive-builder/compare/v0.10.0...v0.11.1)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-18 15:46:33 +01:00
Pawan Dhananjay
b98d23263a
protocols/gossipsub: Fix metric name (#2558) 2022-03-17 17:44:52 +01:00
Max Inden
ca9d53886d
Revert ".github/workflow: Use ubuntu-18.04 fixing missing protoc binary " (#2554)
* Revert ".github/workflow: Use ubuntu-18.04 fixing missing protoc binary  (#2368)"

* .github: Use llvm installation script
2022-03-17 17:27:17 +01:00
Mitali Bisht
a30d93e34b
src/tutorials/hole-punching: Correct commands to use ip4 instead of dns4 (#2563) 2022-03-17 17:09:19 +01:00
Frederik-Baetens
fe5bc277e2
src/swarm/behaviour: Clarify custom NetworkBehaviour deriviation (#2501) 2022-03-17 16:24:43 +01:00
Akihito Nakano
96103ee590
protocols/autonat: Fix wrong parameter name in examples (#2555) 2022-03-13 10:23:15 +11:00
Gheorghe
69cde63ac7
examples/chat: Fix typo (#2553)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-03-11 13:34:59 +01:00
Fabricio Demattê
e38eb09f5d
misc/keygen: Implement cli tool to handle key material (#2453)
- Load keys from file
- Generate new keys (with optional prefix)
- Replaces peer-id-generator

Co-authored-by: Fabricio Dematte <fabriciodematte7p@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-03-11 12:44:05 +01:00
Max Inden
108c970a59
protocols/relay: Remove support for Circuit Relay v1 protocol (#2549) 2022-03-11 12:12:10 +01:00
Thomas Eizinger
5291011c73
core/: Add PeerId::try_from_multiaddr (#2551) 2022-03-10 10:43:16 +01:00
Max Inden
a168410dbe
src/tutorials/hole-punching: Update to published blog post (#2550) 2022-03-06 18:06:35 +01:00
413umc
7dfc15fa3d
src/tutorials: Do minor text improvements (#2547) 2022-03-06 17:43:09 +01:00
Max Inden
85f71746c6
README: Remove mention of Network in libp2p-core (#2548) 2022-03-05 20:29:15 +01:00
John Hall
19bc106b9c
misc/metrics: Move from tide to hyper (#2528)
Metrics example server based on hyper replaces a component based on Tide
framework. This removes dependency on Tide which triggered audit warnings.

Co-authored-by: Max Inden <mail@max-inden.de>
2022-03-05 15:15:10 +01:00
dependabot[bot]
59bba65ac0
build(deps): Update async-std-resolver requirement from 0.20 to 0.21 (#2543)
* build(deps): Update async-std-resolver requirement from 0.20 to 0.21

Updates the requirements on [async-std-resolver](https://github.com/bluejekyll/trust-dns) to permit the latest version.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.20.0...v0.21.1)

---
updated-dependencies:
- dependency-name: async-std-resolver
  dependency-type: direct:production
...

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

* build(deps): Update trust-dns-resolver requirement from 0.20 to 0.21

Updates the requirements on [trust-dns-resolver](https://github.com/bluejekyll/trust-dns) to permit the latest version.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.20.0...v0.21.1)

---
updated-dependencies:
- dependency-name: trust-dns-resolver
  dependency-type: direct:production
...

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

* transports/dns: Bump patch version

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-03-02 14:10:53 +01:00
Max Inden
b919d0002a
swarm/src/lib: Improve connection counting for test_behaviour_disconnect_all (#2532) 2022-03-02 12:10:57 +01:00
dependabot[bot]
a179dbb449
build(deps): Bump actions/checkout from 2.4.0 to 3 (#2544)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [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.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-02 11:26:08 +01:00
Thomas Eizinger
d1f472b3c0
core/src/transport: Don't print inner error when returning as source (#2533)
According to
https://github.com/rust-lang/project-error-handling/issues/44#issuecomment-858151860,
we should not be printing the inner error AND returning it as source. Libraries
like `anyhow` will traverse the chain of `source` errors and build up a composed
error message. Printing it and returning the same error from `source` results in
duplicate error messages in that case.
2022-03-01 15:39:01 +01:00
Karatus
fd31d61a7f
examples/chat-tokio.rs: Fix typo (#2541) 2022-02-28 10:50:07 +01:00
Friedel Ziegelmayer
e2fcc47da6
swarm/src/behaviour: Remove Send bound from NetworkBehaviour (#2535)
The bound is no longer needed across the libp2p-XXX crates.

Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-28 10:27:58 +01:00
Max Inden
99855b1d10
*: Apply clippy suggestions (#2540) 2022-02-28 10:05:17 +01:00
Max Inden
b1859464c9
*: Prepare v0.43.0 (#2531) 2022-02-22 14:05:19 +01:00
Max Inden
fd2be38faf
swarm/: Rename ProtocolsHandler to ConnectionHandler (#2527)
A `ProtocolsHandler`, now `ConnectionHandler`, handels a connection, not
a protocol. Thus the name `CONNECTIONHandler` is more appropriate.

Next to the rename of `ProtocolsHandler` this commit renames the `mod
protocols_handler` to `mod handler`. Finally all combinators (e.g.
`ProtocolsHandlerSelect`) are renamed appropriately.
2022-02-21 13:32:24 +01:00
Marco Munizaga
6511e6ba45
core/src/signed_envelope/: Return signing key with payload (#2522)
Remove `SignedEnvelope::payload` in favor of
`SignedEnvelope::payload_and_signing_key`. The caller is expected to check that
the returned signing key makes sense in the payload's context.
2022-02-21 10:45:57 +01:00
Max Inden
2ff9acee22
swarm/: Make NodeHandlerWrapper an impl detail of connection (#2523)
Previously one would wrap a `ProtocolsHandler` into a
`NodeHandlerWrapper` as early as possible, even though the functionality
of `NodeHandlerWrapper` is only needed within `mod connection`.

This commit makes `NodeHandlerWrapper` an implementation detail of `mod
connection`, thus neither `mod protocols_handler`, `mod pool` nor the
root level (`libp2p-swarm`) need to bother about the abstraction.

In addition to the above, this commit:

- Renames `NodeHandlerWrapper` to `HandlerWrapper`. The word `Node` is
  outdated.
- Removes `NodeHandlerWrapperBuilder`. With this simplification it is no
  longer needed.
- Folds `NodeHandlerWrapperError` into `ConnectionError`. No need for
  upper layers to be aware of the fact that `ProtocolHandler`s are
  wrapped.
2022-02-18 11:32:58 +01:00
Max Inden
eeb3504d5f
swarm/src/lib: Rework connection exports (#2525) 2022-02-17 21:12:37 +01:00
Nazar Mokrynskyi
65cc8994a6
*: Derive Debug and Clone(#2495)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-16 16:16:54 +01:00
Age Manning
9f1114d8b9
protocols/gossipsub: Add IWANT and memcache misses metrics (#2518)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-16 15:54:24 +01:00
dependabot[bot]
80bbb6224f
build(deps): Update parking_lot requirement from 0.11.0 to 0.12.0 (#2463)
* build(deps): Update parking_lot requirement from 0.11.0 to 0.12.0

Updates the requirements on [parking_lot](https://github.com/Amanieu/parking_lot) to permit the latest version.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.11.0...0.12.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-16 15:16:04 +01:00
Max Inden
8ffa84e786
swarm/src: Remove ConnectionHandler (#2519)
The `ConnectionHandler` trait is not exposed to users. The only
implementor of `ConnectionHandler` is `NodeHandlerWrapper`. Thus
`ConnectionHandler` is a superfluous abstraction. This commit removes
`ConnectionHandler`.

Next to this large change, this commit removes the `Tmuxer` trait
parameter. `Swarm` enforces dynamic dispatching via `StreamMuxerBox`
anyways, thus the trait parameter is useless.

As a follow up to this commit one could rename `ProtocolsHandler` to
`ConnectionHandler` and `NodeHandlerWrapper` to
`ConnectionHandlerWrapper` or just `Wrapper`.
2022-02-16 13:15:52 +01:00
Laurent Senta
df4905d798
core/src: Take ref of key in SignedEnvelope & PeerRecord (#2516) 2022-02-15 23:47:32 +01:00
Elena Frank
dceb72bfe2
protocols/autonat: Fix flaky test (#2480) 2022-02-15 14:12:41 +01:00
Max Inden
146ed5f45e
swarm/: Report aborted connections (#2517)
Disconnect pending connections with `Swarm::disconnect` and eport aborted
connections via `SwarmEvent::OutgoingConnectionError`.

Co-authored-by: Jack Maloney <git@jmmaloney4.xyz>
Co-authored-by: Marco Munizaga <git@marcopolo.io>
2022-02-15 10:19:55 +01:00
Divma
e66f04f41b
protocols/gossipsub: Do not overwrite msg's peers if put again into mcache (#2493)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-14 15:49:00 +01:00
Age Manning
60666f5455
protocols/gossipsub: Revert back to wasm_timer for interval (#2506)
Removed the custom interval implementation and removes support for
wasm32-unknown-unknown. See https://github.com/libp2p/rust-libp2p/issues/2497
for details.

Co-authored-by: Diva M <divma@protonmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-14 11:24:58 +01:00
Max Inden
7fc342e6c0
{core,swarm}: Remove Network abstraction (#2492)
This commit removes the `Network` abstraction, thus managing `Listeners`
and the connection `Pool` in `Swarm` directly. This is done under the
assumption that noone uses the `Network` abstraction directly, but
instead everyone always uses it through `Swarm`. Both `Listeners` and
`Pool` are moved from `libp2p-core` into `libp2p-swarm`. Given that they
are no longer exposed via `Network`, they can be treated as an
implementation detail of `libp2p-swarm` and `Swarm`.

This change does not include any behavioural changes.

This change has the followin benefits:

- Removal of `NetworkEvent`, which was mostly an isomorphism of
  `SwarmEvent`.
- Removal of the never-directly-used `Network` abstraction.
- Removal of now obsolete verbose `Peer` (`core/src/network/peer.rs`)
  construct.
- Removal of `libp2p-core` `DialOpts`, which is a direct mapping of
  `libp2p-swarm` `DialOpts`.
- Allowing breaking changes to the connection handling and `Swarm` API
  interface without a breaking change in `libp2p-core` and thus a
  without a breaking change in `/transport` protocols.

This change enables the following potential future changes:

- Removal of `NodeHandler` and `ConnectionHandler`. Thus allowing to
  rename `ProtocolsHandler` into `ConnectionHandler`.
- Moving `NetworkBehaviour` and `ProtocolsHandler` into `libp2p-core`,
  having `libp2p-xxx` protocol crates only depend on `libp2p-core` and
  thus allowing general breaking changes to `Swarm` without breaking all
  `libp2p-xxx` crates.
2022-02-13 21:57:38 +01:00
Max Inden
861e15dabb
src/tutorials: Add hole punching tutorial (#2460) 2022-02-10 16:36:20 +01:00
Frederik-Baetens
b39770b8e9
swarm/src/behaviour: Document impact of blocking code (#2482)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-09 20:26:59 +01:00
Max Inden
44d63d8ed4
core/src/: Validate PeerRecord signature matching peer ID (#2491)
Co-authored-by: Marco Munizaga <git@marcopolo.io>
2022-02-09 16:39:02 +01:00
Age Manning
e6f034c132
protocols/gossipsub: Remove outdated warning (#2496)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-09 16:24:08 +01:00
Max Inden
4eb3d15db1
protocols/dcutr: Add changelog (#2499) 2022-02-09 16:09:00 +01:00
Divma
dc8433e3fc
swarm/src/behaviour: Merge inject_* paired methods (#2445)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-09 16:08:28 +01:00
Frederik-Baetens
5a95a46cd3
protocols/: Add documentation on peer discovery (#2465)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-09 15:54:07 +01:00
Max Inden
0bb8ee98d5
protocols/: Implement Direct Connection Upgrade through Relay (DCUtR) (#2438)
Enables two peers to coordinate a hole punch (direct connection upgrade)
via a relayed connection.

See https://github.com/libp2p/specs/blob/master/relay/DCUtR.md for
specification.
2022-02-08 15:56:35 +01:00
Nazar Mokrynskyi
bd41e0461e
protocols/kad: Require owned key in get_record (#2477)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-07 22:56:30 +01:00
Divma
78f5981856
protocols/gossipsub: Emit gossip of all non empty topics (#2481)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-07 20:00:46 +01:00
Jacob
ab7ed43b4a
core/src/transport/memory: Test parse_memory_addr with PeerId (#2468)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-07 19:32:07 +01:00
dependabot[bot]
8d13666167
build(deps): Update snow requirement from 0.8.0 to 0.9.0 (#2472)
* build(deps): Update snow requirement from 0.8.0 to 0.9.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.8.0...v0.9.0)

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

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>
2022-02-04 17:05:10 +01:00
Volker Mische
a2c93fc766
*: Update multihash and multiaddr (#2469)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-02-03 17:38:41 +01:00