Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols: Implement Direct Connection Upgrade through Relay (dcutr) #2076

Closed
wants to merge 205 commits into from
Closed
Show file tree
Hide file tree
Changes from 107 commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
3bd6602
protocols/relay: Implement circuit relay v2 protocol
mxinden Apr 16, 2021
125e3c3
misc/multistream-select: Ignore simultaneous open 'iamclient'
mxinden Apr 26, 2021
4281bd5
protocols/relay: Ensure connections of HOP connect are kept alive
mxinden Apr 30, 2021
778512d
protocols/relay: Improve documentation
mxinden May 3, 2021
8ecd5f4
misc/multistream-select: Implement simultaneous open extension
mxinden May 4, 2021
dfe1285
protocols/relay: Implement v2 client logic
mxinden May 8, 2021
ca19fe4
Merge branch 'libp2p/master' into relay-v2
mxinden May 16, 2021
59c8741
protocols/relay: Handle dial failure
mxinden May 16, 2021
54cc9db
protocols/relay: Reuse connection
mxinden May 16, 2021
8e7b6a0
protocols/relay: Rename Connection to RelayedConnection
mxinden May 17, 2021
a1589cc
protocols/relay: Update transport doc examples
mxinden May 17, 2021
4af855e
protocols/relay: Pass relay addr to transport
mxinden May 17, 2021
8934664
protocols/relay: Implement inbound stop denial
mxinden May 18, 2021
79fd6be
protocols/relay: Renew reservations
mxinden May 18, 2021
0ed3153
protocols/relay: Handle invalid expiration in the past
mxinden May 18, 2021
1318636
protocols/relay: Handle in and outbound failure
mxinden May 18, 2021
5df655e
protocols/relay: Implement client handler keep alive
mxinden May 18, 2021
643ffb0
protocols/relay: Handle handler listener closed channel
mxinden May 19, 2021
570980d
protocols/relay: Handle handler to listener failure
mxinden May 19, 2021
037a398
protocols/relay: Return all new listener addresses
mxinden May 19, 2021
91ee924
protocols/dcutr: Implement Direct Connection Upgrade through Relay
mxinden May 21, 2021
b71abd8
Merge branch 'libp2p/master' into sim-open
mxinden Jun 2, 2021
183e182
Merge branch 'libp2p/master' into dcutr
mxinden Jun 3, 2021
0cd01ef
protocols/dcutr: Carry observed addresses in Connect
mxinden Jun 3, 2021
c758fbe
protocols/dcutr: Reply to Syn
mxinden Jun 8, 2021
b28b678
protocols/dcutr: Dial as initiator
mxinden Jun 25, 2021
2cfaec9
core/: Integrate Simultaneous Open extension
mxinden Jun 30, 2021
1213669
Merge branch 'libp2p/master' into sim-open
mxinden Jun 30, 2021
806fd93
protocols/relay/v2: Update to latest protobuf definition
mxinden Jul 1, 2021
5b170d7
Merge branch 'libp2p/master' into relay-v2
mxinden Jul 1, 2021
be923a8
Merge branch 'relay-v2' into dcutr
mxinden Jul 2, 2021
ec46fc3
protocols/dcutr/examples: Add client
mxinden Jul 2, 2021
1723e92
Revert "misc/multistream-select: Ignore simultaneous open 'iamclient'"
mxinden Jul 2, 2021
2d84d77
Merge branch 'relay-v2' into dcutr
mxinden Jul 2, 2021
0987fa7
Merge branch 'sim-open' into dcutr
mxinden Jul 2, 2021
11542d1
core/src/transport/upgrade: Make DialFuture aware of SimOpenRole
mxinden Jul 4, 2021
618ccd5
core/src/transport: Use Transport::and_then for Authenticated::apply
mxinden Jul 4, 2021
1134173
core/: Clean type structure
mxinden Jul 4, 2021
dab4ceb
core/: Enforce upgrade version at compile time
mxinden Jul 4, 2021
9861a53
Merge branch 'libp2p/master' into sim-open
mxinden Jul 4, 2021
227363f
misc/multistream-select: Document V1SimOpen
mxinden Jul 7, 2021
224141e
*: Rename V1SimOpen to V1SimultaneousOpen
mxinden Jul 7, 2021
cadb065
misc/multistream-select: Document SimOpenRole
mxinden Jul 7, 2021
bd76946
*: Rename SimOpenRole to Role
mxinden Jul 7, 2021
ade2aff
misc/multistream-select: Document reponder role process
mxinden Jul 7, 2021
b66b4eb
misc/multistream-select: Bump version and add changelog entry
mxinden Jul 7, 2021
16da533
core/CHANGELOG: Add entry
mxinden Jul 7, 2021
4a9fef3
core/src/upgrade: Assert Initiator when not using SimOpen
mxinden Jul 7, 2021
41c884c
core/upgrade/apply: Document different versions
mxinden Jul 7, 2021
cf2e3ef
misc/multistream-select: Derive Eq for Role
mxinden Jul 7, 2021
a4264fc
*: Fix documentation links
mxinden Jul 7, 2021
94793bc
misc/multistream-select: Fix doc link
mxinden Jul 7, 2021
deb5e10
src/lib: Call upgrade without Version
mxinden Jul 7, 2021
cfcb810
Merge branch 'libp2p/master' into relay-v2
mxinden Jul 9, 2021
ea53ad7
protocols/relay/v2: Report back to transport
mxinden Jul 9, 2021
599aa09
protocols/relay/v2: Disconnect when stop protocol not supported
mxinden Jul 9, 2021
0b8d54c
protocols/relay/v2: Document max_duration not exceed u32::MAX
mxinden Jul 9, 2021
3082efb
protocols/relay/v2: Don't append p2p-circuit as relay
mxinden Jul 9, 2021
5f073c6
protocols/relay/v2: Implement rate limiter
mxinden Jul 11, 2021
fdacc1b
protocols/relay/v2: Document caveats on rate limiter with high volume
mxinden Jul 21, 2021
93f0979
protocols/relay: Prevent possible false positive in quickcheck
mxinden Jul 21, 2021
334ffc6
protocols/relay: Reword Prost error message
mxinden Jul 21, 2021
8803bd0
protocols/relay: Allow users to specify generic rate limiters
mxinden Jul 21, 2021
c51f9e2
protocols/relay: Move rate limiting logic into module
mxinden Jul 22, 2021
8777d70
protocols/relay: Prevent reservation and connection over relayed conn
mxinden Jul 22, 2021
4e5f99d
protocols/relay: Add circuit src rate limiting
mxinden Jul 22, 2021
d55a5b9
protocols/relay/v2: Simplify example
mxinden Jul 22, 2021
e5f63bc
protocols/relay: Add myself to authors
mxinden Jul 22, 2021
f8d0047
protocols/relay: Use thiserror
mxinden Jul 22, 2021
55dd0a2
protocols/relay/v2: Set rate limits
mxinden Jul 22, 2021
7e11439
Merge branch 'libp2p/master' into relay-v2
mxinden Jul 22, 2021
126f971
protocols/relay: Use wasm_timer::Instant
mxinden Jul 22, 2021
75f5616
protocols/relay/v2: Apply clippy suggestions
mxinden Jul 22, 2021
6dc961a
protocols/relay: Fix intra doc link
mxinden Jul 22, 2021
35cecd9
Merge branch 'relay-v2' into dcutr
mxinden Jul 23, 2021
2ef7050
Merge branch 'libp2p/master' into relay-v2
mxinden Jul 23, 2021
a40a74a
Merge branch 'relay-v2' into dcutr
mxinden Jul 23, 2021
b251211
Merge branch 'libp2p/master' into sim-open
mxinden Jul 23, 2021
c61a779
Merge branch 'sim-open' into dcutr
mxinden Jul 23, 2021
fbebc3f
protocols/dcutr/tests: Fix connect test
mxinden Jul 27, 2021
0d3b639
protocols/dcutr: Run cargo fix
mxinden Jul 27, 2021
8397fdb
protocols/dcutr: Attempt direct connection upgrade as listener only
mxinden Jul 27, 2021
818aa35
protocols/dcutr: Emit event when attempting direct connection upgrade
mxinden Jul 27, 2021
de91c93
protocols/dcutr: Emit event when remote initiates direct connection up
mxinden Jul 27, 2021
b07257d
Merge branch 'libp2p/master' into relay-v2
mxinden Jul 28, 2021
31f8424
protocols/relay: Fix clippy warnings
mxinden Jul 28, 2021
c4d599f
protocols/dcutr: Extend with TODOs
mxinden Aug 3, 2021
aea3b09
swarm/src/behaviour: Update DialAddress doc comment
mxinden Aug 3, 2021
49fdc31
swarm/src/protocols_handler: Add EitherHandler
mxinden Aug 13, 2021
c9333e4
protocols/dcutr: Deny upgrades on non-relayed connections
mxinden Aug 13, 2021
53e6ece
protocols/dcutr: Properly expect size of data container
mxinden Aug 13, 2021
da747c9
protocols/dcutr: Enforce maximum message size on incoming msgs
mxinden Aug 13, 2021
8dc98bf
Merge branch 'libp2p/master' into relay-v2
mxinden Aug 13, 2021
9dc1271
Merge commit '008561283ed0a0530d449fdc7ff4dc9f3ab9ce73' into sim-open
mxinden Aug 13, 2021
d49cedd
*: Format with rustfmt
mxinden Aug 13, 2021
58d8131
Merge branch 'libp2p/master' into sim-open
mxinden Aug 13, 2021
313ffa3
Merge branch 'sim-open' into dcutr
mxinden Aug 13, 2021
df116f1
Merge branch 'relay-v2' into dcutr
mxinden Aug 13, 2021
ed0ef92
Merge branch 'libp2p/master' into sim-open
mxinden Aug 23, 2021
cfa459d
Merge branch 'libp2p/master' into relay-v2
mxinden Aug 23, 2021
7d8f399
Merge branch 'sim-open' into dcutr
mxinden Aug 23, 2021
82ebd5b
Merge branch 'relay-v2' into dcutr
mxinden Aug 23, 2021
ae26a87
Merge branch 'libp2p/master' into sim-open
mxinden Sep 26, 2021
7e51e54
Merge branch 'libp2p/master' into relay-v2
mxinden Sep 26, 2021
6576f12
Merge branch 'relay-v2' into dcutr
mxinden Sep 26, 2021
3a451b5
protocols/dcutr: Tell handler what it is going to be used for
mxinden Aug 23, 2021
b26d89f
protocols/dcutr: Retry on upgrade failure
mxinden Sep 26, 2021
832f069
Merge branch 'libp2p/master' into relay-v2
mxinden Oct 7, 2021
2c79813
misc/metrics: Add basic instrumentation for libp2p-relay
mxinden Oct 7, 2021
fa82385
Merge branch 'libp2p/master' into relay-v2
mxinden Nov 18, 2021
00532e0
Merge branch 'libp2p/master' into sim-open
mxinden Nov 18, 2021
7beb473
Merge branch 'sim-open' into dcutr
mxinden Nov 18, 2021
7ee8814
Merge branch 'relay-v2' into dcutr
mxinden Nov 18, 2021
3efddb9
protocols/dcutr: Report successful connection upgrade
mxinden Nov 18, 2021
068b7c7
protocols/dcutr/examples: Use structopts
mxinden Nov 18, 2021
765b478
protocols/dcutr: Do not panic on connection closing
mxinden Nov 19, 2021
d51fa72
protocols/relay: Return NetworkBehaviourAction::NotifyHandler right away
mxinden Nov 19, 2021
4ada201
Merge branch 'relay-v2' into dcutr
mxinden Nov 19, 2021
541de95
protocols/dcutr/src/behaviour: Do not send relayed addresses
mxinden Nov 19, 2021
40800b7
protocols/dcutr/examples: Log on info level
mxinden Nov 19, 2021
c742335
protocols/relay: Run rust fmt
mxinden Nov 20, 2021
8ed86c4
protocols/relay/src/v2/relay: Accept mutable config
mxinden Nov 20, 2021
62e88f8
misc/multistream-select/src/protocol.rs: Fix typo
mxinden Nov 20, 2021
b9ba67d
Merge branch 'mxinden/relay-v2' into dcutr
mxinden Nov 20, 2021
9d8b299
protocols/dcutr/build: Run rust fmt
mxinden Nov 20, 2021
92540e9
protocols/dcutr/src/behaviour: Remove outdated comment
mxinden Nov 20, 2021
624c2de
misc/multistream-select: Supress needless collect warning
mxinden Nov 20, 2021
ad28adb
Merge branch 'mxinden/sim-open' into dcutr
mxinden Nov 20, 2021
f2b030b
protocols/dcutr/: Do not attempt upgrade if direct connection exists
mxinden Nov 20, 2021
3b2989c
protocols/dcutr/src/handler: Remove DirectConnection Prototype variant
mxinden Nov 20, 2021
99665ff
protocols/dcutr: Deny incoming substreams as dialer
mxinden Nov 20, 2021
f585b51
protocols/dcutr/src/handler: Split into relayed and direct
mxinden Nov 20, 2021
cc2d604
protocols/dcutr: Don't abbreviate negotiated with neg
mxinden Nov 20, 2021
93c30a6
protocols/dcutr/src/protocol: Use correct protocol name
mxinden Nov 20, 2021
7338d4d
protocols/dcutr/src/message.proto: Make type field required
mxinden Nov 20, 2021
3f446da
protocols/dcutr/src/protocol: Use thiserror
mxinden Nov 20, 2021
81dcf55
protocols/dcutr/src/handler/relayed: Refine keep alive handling
mxinden Nov 21, 2021
b8e8881
protocols/dcutr/src/protocol: Split into outbound and inbound
mxinden Nov 21, 2021
d810244
protocols/dcutr/src/handler/relayed: Handle stream upgrade errors
mxinden Nov 21, 2021
9ea09f2
Merge branch 'relay-v2' into dcutr
mxinden Nov 21, 2021
0780206
Merge branch 'master' into relay-v2
mxinden Nov 25, 2021
b9d7fa8
Merge branch 'master' into dcutr
mxinden Nov 25, 2021
69b2fc1
protocols/relay/src/v2/relay: Accept mutable config
mxinden Nov 20, 2021
580f668
protocols/relay/examples: Structure command line args
r-zig Nov 4, 2021
06707e6
Merge branch 'relay-v2' into dcutr
mxinden Nov 26, 2021
7c9f3bc
protocols/relay/src/v2/client: Return NetworkBehaviourAction on Liste…
mxinden Dec 7, 2021
ad79422
Refactor suggestion
MarcoPolo Dec 6, 2021
517075d
protocols/relay/src/v2/client/handler: Check status of lend out subst…
mxinden Dec 7, 2021
da7f5e4
protocols/relay/src/v2/client: Use void::Void for drop_notifer
mxinden Dec 7, 2021
45163df
protocols/relay/src/v2/client/handler: Log dropped oneshot Sender to …
mxinden Dec 7, 2021
1d20392
protocols/relay/src/v2/client/handler: Await send call to transport l…
mxinden Dec 7, 2021
395f43a
protocols/relay/src/v2/client/handler: Remove unnecessary boxing
mxinden Dec 7, 2021
2de96d6
Merge branch 'libp2p/master' into relay-v2
mxinden Dec 7, 2021
c0c0880
protocols/relay/src/v2/client: Extend unreacheable! text
mxinden Dec 9, 2021
746c75e
protocols/relay/src/v2/: Document pending_error and send_error_futs
mxinden Dec 9, 2021
08d6637
protocols/relay/src/v2: Use OrTransport
mxinden Dec 9, 2021
bfd92a1
protocols/relay/src/v2: Fix typo
mxinden Dec 9, 2021
a60ffba
protocols/relay/src/v2: Renew reservation after 3/4 of expiration
mxinden Dec 9, 2021
1123952
protocols/relay/v2: Use AcceptReservationReqBuilder concept
mxinden Dec 8, 2021
1af928a
protocols/relay: Capitalize I in NoAddressesInReservation
mxinden Dec 12, 2021
a9d9b41
misc/metrics: Derive Debug for event types
mxinden Dec 12, 2021
a8f21ae
protocols/relay/src/v2/client/handler: Consistent mpsc and oneshot im…
mxinden Dec 12, 2021
daa0686
protocols/relay/src/v2/client/transport: Loop on from_behaviour
mxinden Dec 12, 2021
8856fde
protocols/relay: Fix intra doc link
mxinden Dec 12, 2021
a1fad8c
protocols/relay/: Allow large enum variant
mxinden Dec 12, 2021
5d9f95a
protocols/relay/src/v2/client/transport: Remove destination address
mxinden Dec 13, 2021
eaab34e
protocols/relay/src/v2: Don't override NetworkBehaviour methods with …
mxinden Dec 13, 2021
26aaa6e
protocols/relay/src/v2/client: Pass event at handler initialization
mxinden Dec 13, 2021
49a6327
protocols/relay/src/v2: Use lent instead of lend
mxinden Dec 13, 2021
2e4e743
protocols/relay/v2: Use Renewing instead of Renewal
mxinden Dec 13, 2021
bce3ba0
protocols/relay/src/v2/client: Introduce Reservation::None
thomaseizinger Dec 8, 2021
01e12f7
protocols/relay/src/v2: Fix intra doc link
mxinden Dec 13, 2021
b1646f4
Merge branch 'libp2p/master' into relay-v2
mxinden Dec 13, 2021
912d314
protocols/relay/src/v2/client/handler: Inject event at creation time
mxinden Dec 15, 2021
dbfe25b
protocols/relay/src/v2/client/handler: Refactor Reservation::poll
MarcoPolo Dec 15, 2021
c09861b
protocols/relay/src/v2/client/handler.rs: Fix typo
mxinden Dec 16, 2021
5afa13b
protocols/relay/src/v2/client/transport.rs: Make doc examples consistent
mxinden Dec 16, 2021
9a0f886
protocols/relay/src/v2: Stress required usage of other Transport
mxinden Dec 16, 2021
a15bf3d
protocols/relay/src/v2/protocol/inbound_stop.rs: Remove src_peer_id p…
mxinden Dec 16, 2021
7b2eeb5
protocols/relay/src/v2/relay/handler: Remove wrong unused variable as…
mxinden Dec 16, 2021
8e6ce38
protocols/relay/src/v2/client: Garbage collect unconnected nodes
mxinden Dec 17, 2021
451d86c
protocols/relay/src/v2: Prevent nested relay on incoming relayed conn
mxinden Dec 17, 2021
a0750ef
protocols/relay/tests/v2: Test new reservation replacing old
mxinden Dec 17, 2021
4b90626
protocols/relay/src/v2: Close listener when channel from behaviour dr…
mxinden Dec 17, 2021
45f7e21
protocols/relay/src/v2: Expose connection limit via OutEvent
mxinden Dec 17, 2021
1b5cb8e
protocols/relay/v2: Use Option::transpose
mxinden Dec 17, 2021
a056b4b
protocols/relay/src/v2/client: Queue Event and not Action
mxinden Dec 18, 2021
7a4cf0a
protocols/relay/src/v2/client: Remove loop in NetworkBehaviour::poll
mxinden Dec 18, 2021
ed79c72
protocols/relay/src/v2/client/: Refactor parse_relayed_multiaddr
mxinden Dec 18, 2021
0b6aca3
protocols/relay/src/v2: Use ready! in RelayListener as Stream
mxinden Dec 18, 2021
0e17512
protocols/relay/src/v2: Remove unnecessary else
mxinden Dec 18, 2021
be9b94e
protocols/relay/src/v2/protocol: Use Vec::with_capacity
mxinden Dec 18, 2021
b9eb0f0
protocols/relay/src/v2: Separate error paths and happy path
mxinden Dec 18, 2021
93691a8
protocols/relay/src/v2/copy_future.rs: Add unit tests
mxinden Dec 18, 2021
0cdb1b6
protocols/relay/src/v2/relay: Remove unnecessary unwrap_or
mxinden Dec 18, 2021
b68f5a2
Merge remote-tracking branch 'libp2p/master' into relay-v2
mxinden Dec 19, 2021
040909e
protocols/relay/src/v2: Use ConnectedPoint::is_relayed
mxinden Dec 19, 2021
7b291a7
Merge branch 'relay-v2' into dcutr
mxinden Dec 19, 2021
e99854e
protocols/dcutr: Use ConnectedPoing::is_relayed
mxinden Dec 19, 2021
364f842
protocols/dcutr: Use ConnectedPoing::is_relayed 2
mxinden Dec 19, 2021
45a00af
protocols/dcutr/: Remove unnecessary pub export of handler
mxinden Dec 27, 2021
1520cae
protocols/dcutr: Use ActionBuilder construct
mxinden Dec 27, 2021
0a719d1
protocols/dcutr: Refactor error handling
mxinden Dec 27, 2021
d1ac064
misc/metrics: Add support for libp2p-dcutr
mxinden Dec 27, 2021
869cd39
protocols/dcutr/Cargo: Update rust version
mxinden Dec 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ default = [
"websocket",
"yamux",
]
dcutr = ["libp2p-dcutr"]
deflate = ["libp2p-deflate"]
dns-async-std = ["libp2p-dns", "libp2p-dns/async-std"]
dns-tokio = ["libp2p-dns", "libp2p-dns/tokio"]
Expand Down Expand Up @@ -69,6 +70,7 @@ bytes = "1"
futures = "0.3.1"
lazy_static = "1.2"
libp2p-core = { version = "0.30.0", path = "core", default-features = false }
libp2p-dcutr = { version = "0.1.0", path = "protocols/dcutr", optional = true }
libp2p-floodsub = { version = "0.31.0", path = "protocols/floodsub", optional = true }
libp2p-gossipsub = { version = "0.33.0", path = "./protocols/gossipsub", optional = true }
libp2p-identify = { version = "0.31.0", path = "protocols/identify", optional = true }
Expand Down Expand Up @@ -116,6 +118,7 @@ members = [
"misc/peer-id-generator",
"muxers/mplex",
"muxers/yamux",
"protocols/dcutr",
"protocols/floodsub",
"protocols/gossipsub",
"protocols/rendezvous",
Expand Down
36 changes: 36 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,43 @@
Introduce `upgrade::read_length_prefixed` and `upgrade::write_length_prefixed`.
See [PR 2111](https://github.com/libp2p/rust-libp2p/pull/2111).

- Add support for multistream-select [simultaneous open extension] to assign _initiator_ and
_responder_ role during authentication protocol negotiation on simultaneously opened connection.

This is one important component of the greater effort to support hole punching in rust-libp2p.

- `Transport::upgrade` no longer takes a multistream-select `Version`. Instead the
multistream-select `Version`s `V1`, `V1Lazy` and `V1SimultaneousOpen` can be selected when
setting the authentication upgrade via `Builder::authenticate_with_version` and the
multistream-select `Version`s `V1` and `V1Lazy` can be selected when setting the multiplexing
upgrade via `Builder::multiplex_with_version`.

Users merely wanting to maintain the status quo should use the following call chain depending
on which `Version` they previously used:

- `Version::V1`

```rust
my_transport.upgrade()
.authenticate(my_authentication)
.multiplex(my_multiplexer)
```
- `Version::V1Lazy`

```rust
my_transport.upgrade()
.authenticate_with_version(my_authentication, Version::V1Lazy)
.multiplex_with_version(my_multiplexer, Version::V1Lazy)
```

- `Builder::multiplex_ext` is removed in favor of the new simultaneous open workflow. Please reach
out in case you depend on `Builder::multiplex_ext`.

See [PR 2066].

[PR 2090]: https://github.com/libp2p/rust-libp2p/pull/2090
[simultaneous open extension]: https://github.com/libp2p/specs/blob/master/connections/simopen.md
[PR 2066]: https://github.com/libp2p/rust-libp2p/pull/2066

# 0.28.3 [2021-04-26]

Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libsecp256k1 = { version = "0.6.0", optional = true }
log = "0.4"
multiaddr = { version = "0.13.0" }
multihash = { version = "0.14", default-features = false, features = ["std", "multihash-impl", "identity", "sha2"] }
multistream-select = { version = "0.10", path = "../misc/multistream-select" }
multistream-select = { version = "0.11", path = "../misc/multistream-select" }
parking_lot = "0.11.0"
pin-project = "1.0.0"
prost = "0.8"
Expand Down
34 changes: 22 additions & 12 deletions core/src/connection/listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ where

#[cfg(test)]
mod tests {
use futures::{future::BoxFuture, stream::BoxStream};

use super::*;
use crate::transport;

Expand Down Expand Up @@ -443,12 +441,18 @@ mod tests {
impl transport::Transport for DummyTrans {
type Output = ();
type Error = std::io::Error;
type Listener = BoxStream<
'static,
Result<ListenerEvent<Self::ListenerUpgrade, std::io::Error>, std::io::Error>,
type Listener = Pin<
Box<
dyn Stream<
Item = Result<
ListenerEvent<Self::ListenerUpgrade, std::io::Error>,
std::io::Error,
>,
>,
>,
>;
type ListenerUpgrade = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type Dial = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type ListenerUpgrade = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;
type Dial = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;

fn listen_on(
self,
Expand Down Expand Up @@ -499,12 +503,18 @@ mod tests {
impl transport::Transport for DummyTrans {
type Output = ();
type Error = std::io::Error;
type Listener = BoxStream<
'static,
Result<ListenerEvent<Self::ListenerUpgrade, std::io::Error>, std::io::Error>,
type Listener = Pin<
Box<
dyn Stream<
Item = Result<
ListenerEvent<Self::ListenerUpgrade, std::io::Error>,
std::io::Error,
>,
>,
>,
>;
type ListenerUpgrade = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type Dial = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type ListenerUpgrade = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;
type Dial = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;

fn listen_on(
self,
Expand Down
5 changes: 2 additions & 3 deletions core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ pub use self::boxed::Boxed;
pub use self::choice::OrTransport;
pub use self::memory::MemoryTransport;
pub use self::optional::OptionalTransport;
pub use self::upgrade::Upgrade;

/// A transport provides connection-oriented communication between two peers
/// through ordered streams of data (i.e. connections).
Expand Down Expand Up @@ -198,12 +197,12 @@ pub trait Transport {

/// Begins a series of protocol upgrades via an
/// [`upgrade::Builder`](upgrade::Builder).
fn upgrade(self, version: upgrade::Version) -> upgrade::Builder<Self>
fn upgrade(self) -> upgrade::Builder<Self>
where
Self: Sized,
Self::Error: 'static,
{
upgrade::Builder::new(self, version)
upgrade::Builder::new(self)
}
}

Expand Down
Loading