11 Commits

Author SHA1 Message Date
Thomas Eizinger
d7363a53d3
fix: Remove circular dependencies across workspace (#3023)
Circular dependencies are problematic in several ways:

- They result in cognitive overhead for developers, in trying to figure out what depends on what.
- They present `cargo` with limits in what order the crates can be compiled in.
- They invalidate build caches unnecessarily thus forcing `cargo` to rebuild certain crates.
- They cause problems with tooling such as `release-please`.

To actually break the circular dependencies, this patch inlines the uses of `development_transport` in the examples and tests for all sub-crates. This is only meant to be a short-term fix until https://github.com/libp2p/rust-libp2p/issues/3111 and https://github.com/libp2p/rust-libp2p/pull/2888 are fixed.

To ensure we don't accidentally reintroduce this dependency, we add a basic CI that queries `cargo metadata` using `jq`.

Resolves https://github.com/libp2p/rust-libp2p/issues/3053.
Fixes https://github.com/libp2p/rust-libp2p/issues/3223.
Related: https://github.com/libp2p/rust-libp2p/pull/2918#discussion_r976514245
Related: https://github.com/googleapis/release-please/issues/1662
2022-12-12 20:58:01 +00:00
Hannes
8cb79f4c79
chore(swarm): Remove deprecated functions (#3170)
Remove functions deprecated in 0.41.0.
2022-12-09 15:44:08 +01:00
Thomas Eizinger
1da75b2b25
protocols/ping: Properly deprecate types with Ping prefix (#2937)
Co-authored-by: Elena Frank <elena.frank@protonmail.com>
Co-authored-by:  João Oliveira <hello@jxs.pt>
2022-10-01 00:19:34 +10:00
Max Inden
1d6b08b0b6
protocols/dcutr/examples: Wait to tell relay its public addr (#2659)
As a listening client, when requesting a reservation with a relay, the relay
responds with its public addresses. The listening client can then use the public
addresses of the relay to advertise itself as reachable under a relayed
address (`/<public-relay-addr>/p2p-circuit/p2p/<listening-client-peer-id>`).

The above operates under the assumption that the relay knows its public address.
A relay learns its public address from remote peers, via the identify protocol.
In the case where the relay just started up, the listening client might be the
very first node to connect to it.

Such scenario allows for a race condition. The listening client requests a
reservation from the relay, while the relay requests its public address from the
listening client. The former needs to contain the response from the latter.

This commit serializes the two requests, making sure, in the case of a freshly
started relay, that the listening client tells the relay its public address
before requesting a reservation from the relay.

Co-authored-by: Elena Frank <elena.frank@protonmail.com>
2022-05-20 21:59:32 +02:00
Max Inden
0e9ab1c960
protocols/dcutr/example: Wait for relay to accept reservation request (#2642)
When in listening mode, wait for the relay to accept our reservation
request. Only then can a client in dialing mode establish a relayed
connection to us via the relay.

See also
https://github.com/libp2p/rust-libp2p/issues/2621#issuecomment-1123549348
2022-05-19 20:08:32 +02:00
Chiu-Hsiang Hsu
f46fecd4d7
src/tutorials/ping: Fix typo in multiaddress (#2623) 2022-04-27 08:48:22 +02:00
Wink Saville
0c1ac781a2
src/tutorials/hole-punching: Clarify use of libp2p-lookup & server IP (#2616) 2022-04-18 14:41:25 +02: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
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
861e15dabb
src/tutorials: Add hole punching tutorial (#2460) 2022-02-10 16:36:20 +01:00