5 Commits

Author SHA1 Message Date
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
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
TotalKrill
90140a6eaf
*: Change structopt to native clap derive implementations (#2600)
Co-authored-by: Max Inden <mail@max-inden.de>
2022-04-05 21:56:44 +02: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