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

Autonat v2 transport changes #3

Merged
merged 112 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6cc5d7c
Implement the request response part of AutoNATv2
umgefahren Oct 30, 2023
6d44a1e
First steps of implementing the client
umgefahren Nov 7, 2023
81cd442
Extract ip-global and implemented lot of behaviour
umgefahren Nov 8, 2023
c0fd889
Intermediate commit
umgefahren Nov 18, 2023
4ac520d
Resolved conflict
umgefahren Nov 18, 2023
fadf904
WIP client
umgefahren Nov 19, 2023
60b4ccc
Run cargo fix
umgefahren Nov 19, 2023
71487fc
Correct minor things
umgefahren Nov 20, 2023
63b31e9
Implement suggestions
umgefahren Nov 20, 2023
546d2b2
Merged master
umgefahren Dec 1, 2023
c16235f
Remove gloabl only
umgefahren Dec 1, 2023
3bc107e
Initial server implementation
umgefahren Dec 1, 2023
50fb5e4
Pass the basic test for the first time.
umgefahren Dec 6, 2023
d34782e
Move forwards to fewer bug fixes
umgefahren Dec 6, 2023
d1bd57d
Resolve merge conflict
umgefahren Dec 6, 2023
fee9de1
Make the things actually expire
umgefahren Dec 12, 2023
faa694a
Tests are working
umgefahren Dec 12, 2023
b01bae5
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Dec 19, 2023
6282cae
Implement in call suggested changes
umgefahren Dec 22, 2023
dab99d2
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Dec 22, 2023
da2a790
Implement all suggestions from the PR review
umgefahren Dec 22, 2023
be35e80
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Dec 27, 2023
101a325
Implement latest suggestions
umgefahren Dec 27, 2023
bf2662a
Implement old suggestions i overlooked
umgefahren Dec 27, 2023
efdbe35
Resolve conflict
umgefahren Dec 27, 2023
c7350f9
Port dns transport
umgefahren Dec 27, 2023
3079aa9
Port request response
umgefahren Dec 27, 2023
596bb06
Port websocket
umgefahren Dec 27, 2023
37cd309
Port allow block list and connection limits
umgefahren Dec 27, 2023
9eea564
Address more concerns
umgefahren Dec 29, 2023
9a85209
Move autonat down
umgefahren Dec 29, 2023
4399bab
Move autonatv2 to autonat
umgefahren Dec 29, 2023
663055e
Format code
thomaseizinger Dec 30, 2023
ba232cb
Alphabetically sort members list
thomaseizinger Dec 30, 2023
22b96b3
Undo changes to global-only transport
thomaseizinger Dec 30, 2023
a19d7c8
Make deprecation warning work
thomaseizinger Dec 30, 2023
46b8e84
Avoid diff in v1
thomaseizinger Dec 30, 2023
037aa99
Undo behaviour change in v1
thomaseizinger Dec 30, 2023
230ad08
Rename client config fields
thomaseizinger Dec 30, 2023
7cbf413
Streamline creation of `peer_info` state
thomaseizinger Dec 30, 2023
16b4d7c
Rewrite pending nonce handling
thomaseizinger Dec 30, 2023
fdc0c2d
A server might not support autonat on every connection
thomaseizinger Dec 30, 2023
a78c265
Prefer early-exit over `else`
thomaseizinger Dec 30, 2023
8f6c27a
Use shorthand field logging syntax
thomaseizinger Dec 30, 2023
170270a
Fix variable name
thomaseizinger Dec 30, 2023
589cf6c
Improve log message
thomaseizinger Dec 30, 2023
feea82f
Log error using `fmt::Display`
thomaseizinger Dec 30, 2023
8b0a544
Remove `server` field from `InternalStatusUpdate`
thomaseizinger Dec 30, 2023
86849e5
Loop instead of repeating code
thomaseizinger Dec 30, 2023
372d88d
Remove set that we never write to
thomaseizinger Dec 30, 2023
a2fcadd
Remove superflous tests
thomaseizinger Dec 30, 2023
90d7d07
Handle tick reset next to polling
thomaseizinger Dec 30, 2023
2a6ad94
Rewrite generation of dial requests
thomaseizinger Dec 30, 2023
b2d147f
Add docs and additional log statements for no candidates
thomaseizinger Dec 30, 2023
7e3da61
Add more docs and rename protocol name constants
thomaseizinger Dec 30, 2023
e2fe41d
Inline `DialBack` struct
thomaseizinger Dec 30, 2023
1e1aeca
Simplify handling of closed connection
thomaseizinger Dec 30, 2023
d5724c1
ConnectionIds are unique, meaning we can always just insert
thomaseizinger Dec 30, 2023
de91c55
Remove handling of `DialFailure`
thomaseizinger Dec 30, 2023
3719440
Disable connection for future autonat requests on error
thomaseizinger Dec 30, 2023
7b6d354
Remove unnecessary trait implementations
thomaseizinger Dec 30, 2023
8ce2a01
Add comment
thomaseizinger Dec 30, 2023
42ac03c
Rewrite dial-request to always index by nonce
thomaseizinger Dec 30, 2023
3181113
Reset TestStatus on errors
thomaseizinger Dec 30, 2023
c51f8cc
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Dec 30, 2023
88b1092
Merge pull request #2 from libp2p/autonatv2-thomas-followup
umgefahren Dec 30, 2023
4d96c33
Delay and use Result
umgefahren Dec 30, 2023
8a135ea
Perform sleep correct
umgefahren Dec 30, 2023
fac1196
Remove is_local
umgefahren Dec 30, 2023
9ed44d9
Remove the unnecessary check for confirmation
umgefahren Dec 30, 2023
a974707
Fix deprecation
umgefahren Dec 30, 2023
117075f
Merge completed
umgefahren Jan 28, 2024
3f2476a
Implement first jan suggestions
umgefahren Jan 28, 2024
9254faa
Implement an example and a public tester
umgefahren Jan 30, 2024
54e4c1f
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Feb 4, 2024
d723c50
Port quic
umgefahren Feb 4, 2024
daf2a0b
Make it compile
umgefahren Feb 5, 2024
6b85b82
Allow deprecated items
umgefahren Feb 5, 2024
e6afb5a
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Feb 5, 2024
0b94a01
Make the tests run
umgefahren Feb 5, 2024
a09e26d
Implement the latest changes to the protocol
umgefahren Feb 14, 2024
61ae32e
Fix minor nits
umgefahren Feb 14, 2024
ad6ad8f
Implement DialBackOk correctly
umgefahren Feb 14, 2024
fbdc85f
Format
umgefahren Feb 14, 2024
553511c
Fix issues raised by clippy
umgefahren Feb 14, 2024
9bf52d4
Update protocols/autonat/src/v2/client/behaviour.rs
umgefahren Feb 19, 2024
70f41f3
Update protocols/autonat/src/v2/client/handler/dial_back.rs
umgefahren Feb 19, 2024
0773694
Update protocols/autonat/src/v2/client/handler/dial_back.rs
umgefahren Feb 19, 2024
89acd28
Make error richer and trace it at a different point
umgefahren Feb 19, 2024
d571e51
Avoid stream close
umgefahren Feb 19, 2024
10e4cee
Better error handling
umgefahren Feb 19, 2024
d4d671e
Correct one failing CI and change the license
umgefahren Feb 19, 2024
2dc574e
Merge branch 'transport-redesign' into implement-autonat-v2
umgefahren Feb 19, 2024
330fc51
Correct minor things
umgefahren Mar 6, 2024
5f6f2f6
Resolve merge conflict
umgefahren Mar 6, 2024
367273a
Add quic and dns to the example
umgefahren Mar 7, 2024
d79bca3
Remove unused import
umgefahren Mar 7, 2024
8df0183
Change dial opts to make wasm tests pass
umgefahren Mar 7, 2024
5d24d03
Remove futures-time to compile on wasm
umgefahren Mar 7, 2024
41804be
Fix concerns by clippy
umgefahren Mar 7, 2024
bd495f9
Format
umgefahren Mar 7, 2024
38be2b4
Use workaround to make generated code CI pass
umgefahren Mar 7, 2024
ce7596c
Correct webtransport test
umgefahren Mar 7, 2024
0506c7b
Handle strange variable unused on windows
umgefahren Mar 7, 2024
0b6dbb1
Remove clippy nit
umgefahren Mar 7, 2024
d2fddd5
Simplify a little bit and get rid of every performance opt
umgefahren Mar 7, 2024
8f1fcbb
Version bumps and added author
umgefahren Mar 8, 2024
8095e84
Upstream transport changes
umgefahren Mar 8, 2024
0918ea8
Remove deprecated
umgefahren May 8, 2024
b07a463
Merge from master
umgefahren May 8, 2024
0724086
Merge branch 'transport-redesign' into autonat-v2-transport-changes
umgefahren May 8, 2024
45863c3
Formatting
umgefahren May 8, 2024
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
1,395 changes: 750 additions & 645 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ libp2p = { version = "0.54.0", path = "libp2p" }
libp2p-allow-block-list = { version = "0.3.0", path = "misc/allow-block-list" }
libp2p-autonat = { version = "0.12.0", path = "protocols/autonat" }
libp2p-connection-limits = { version = "0.3.1", path = "misc/connection-limits" }
libp2p-core = { version = "0.41.2", path = "core" }
libp2p-core = { version = "0.42.0", path = "core" }
libp2p-dcutr = { version = "0.11.0", path = "protocols/dcutr" }
libp2p-dns = { version = "0.41.1", path = "transports/dns" }
libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" }
Expand All @@ -89,7 +89,6 @@ libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" }
libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" }
libp2p-metrics = { version = "0.14.1", path = "misc/metrics" }
libp2p-mplex = { version = "0.41.0", path = "muxers/mplex" }
libp2p-muxer-test-harness = { path = "muxers/test-harness" }
libp2p-noise = { version = "0.44.0", path = "transports/noise" }
libp2p-perf = { version = "0.3.0", path = "protocols/perf" }
libp2p-ping = { version = "0.44.1", path = "protocols/ping" }
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-core"
edition = "2021"
rust-version = { workspace = true }
description = "Core traits and structs of libp2p"
version = "0.41.2"
version = "0.42.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 1 addition & 1 deletion core/src/transport/and_then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use crate::{
connection::ConnectedPoint,
transport::{ListenerId, Transport, TransportError, TransportEvent, DialOpts},
transport::{DialOpts, ListenerId, Transport, TransportError, TransportEvent},
};
use either::Either;
use futures::prelude::*;
Expand Down
4 changes: 2 additions & 2 deletions core/src/transport/global_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,14 @@ impl<T: crate::Transport + Unpin> crate::Transport for Transport<T> {
match addr.iter().next() {
Some(Protocol::Ip4(a)) => {
if !ipv4_global::is_global(a) {
tracing::debug!(ip=?a, "Not dialing non global IP address");
tracing::debug!(ip=%a, "Not dialing non global IP address");
return Err(TransportError::MultiaddrNotSupported(addr));
}
self.inner.dial(addr, opts)
}
Some(Protocol::Ip6(a)) => {
if !ipv6_global::is_global(a) {
tracing::debug!(ip=?a, "Not dialing non global IP address");
tracing::debug!(ip=%a, "Not dialing non global IP address");
return Err(TransportError::MultiaddrNotSupported(addr));
}
self.inner.dial(addr, opts)
Expand Down
2 changes: 1 addition & 1 deletion core/src/upgrade/ready.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct ReadyUpgrade<P> {
}

impl<P> ReadyUpgrade<P> {
pub fn new(protocol_name: P) -> Self {
pub const fn new(protocol_name: P) -> Self {
Self { protocol_name }
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "autonat-example"
version = "0.1.0"
edition = "2021"
publish = false
license = "MIT"
license = "MIT or Apache-2.0"

[package.metadata.release]
release = false
Expand Down
1 change: 1 addition & 0 deletions examples/autonat/src/bin/autonat_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// DEALINGS IN THE SOFTWARE.

#![doc = include_str!("../../README.md")]
#![allow(deprecated)]

use clap::Parser;
use futures::StreamExt;
Expand Down
1 change: 1 addition & 0 deletions examples/autonat/src/bin/autonat_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// DEALINGS IN THE SOFTWARE.

#![doc = include_str!("../../README.md")]
#![allow(deprecated)]

use clap::Parser;
use futures::StreamExt;
Expand Down
2 changes: 1 addition & 1 deletion examples/dcutr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
libp2p::SwarmBuilder::with_existing_identity(generate_ed25519(opts.secret_key_seed))
.with_tokio()
.with_tcp(
tcp::Config::default().port_reuse(true).nodelay(true),
tcp::Config::default().nodelay(true),
noise::Config::new,
yamux::Config::default,
)?
Expand Down
2 changes: 1 addition & 1 deletion hole-punching-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn main() -> Result<()> {
let mut swarm = libp2p::SwarmBuilder::with_new_identity()
.with_tokio()
.with_tcp(
tcp::Config::new().port_reuse(true).nodelay(true),
tcp::Config::new().nodelay(true),
noise::Config::new,
yamux::Config::default,
)?
Expand Down
2 changes: 2 additions & 0 deletions misc/allow-block-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
//! # }
//! ```

use libp2p_core::transport::PortUse;
use libp2p_core::{Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::{
Expand Down Expand Up @@ -225,6 +226,7 @@ where
peer: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
self.state.enforce(&peer)?;

Expand Down
4 changes: 3 additions & 1 deletion misc/connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use libp2p_core::{ConnectedPoint, Endpoint, Multiaddr};
use libp2p_core::{transport::PortUse, ConnectedPoint, Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::{
behaviour::{ConnectionEstablished, DialFailure, ListenFailure},
Expand Down Expand Up @@ -278,6 +278,7 @@ impl NetworkBehaviour for Behaviour {
peer: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
self.pending_outbound_connections.remove(&connection_id);

Expand Down Expand Up @@ -569,6 +570,7 @@ mod tests {
_peer: PeerId,
_addr: &Multiaddr,
_role_override: Endpoint,
_port_use: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
Err(ConnectionDenied::new(std::io::Error::new(
std::io::ErrorKind::Other,
Expand Down
3 changes: 2 additions & 1 deletion misc/memory-connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use libp2p_core::{Endpoint, Multiaddr};
use libp2p_core::{transport::PortUse, Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::{
dummy, ConnectionDenied, ConnectionId, FromSwarm, NetworkBehaviour, THandler, THandlerInEvent,
Expand Down Expand Up @@ -174,6 +174,7 @@ impl NetworkBehaviour for Behaviour {
_: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
Ok(dummy::ConnectionHandler)
}
Expand Down
3 changes: 2 additions & 1 deletion misc/memory-connection-limits/tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use std::task::{Context, Poll};

use libp2p_core::{Endpoint, Multiaddr};
use libp2p_core::{transport::PortUse, Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::{
dummy, ConnectionDenied, ConnectionId, FromSwarm, NetworkBehaviour, THandler, THandlerInEvent,
Expand Down Expand Up @@ -102,6 +102,7 @@ impl<const MEM_PENDING: usize, const MEM_ESTABLISHED: usize> NetworkBehaviour
_: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
self.handle_established();
Ok(dummy::ConnectionHandler)
Expand Down
17 changes: 4 additions & 13 deletions misc/metrics/src/bandwidth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures::{
};
use libp2p_core::{
muxing::{StreamMuxer, StreamMuxerEvent},
transport::{ListenerId, TransportError, TransportEvent},
transport::{DialOpts, ListenerId, TransportError, TransportEvent},
Multiaddr,
};
use libp2p_identity::PeerId;
Expand Down Expand Up @@ -84,24 +84,15 @@ where
self.transport.remove_listener(id)
}

fn dial(&mut self, addr: Multiaddr) -> Result<Self::Dial, TransportError<Self::Error>> {
let metrics = ConnectionMetrics::from_family_and_addr(&self.metrics, &addr);
Ok(self
.transport
.dial(addr.clone())?
.map_ok(Box::new(|(peer_id, stream_muxer)| {
(peer_id, Muxer::new(stream_muxer, metrics))
})))
}

fn dial_as_listener(
fn dial(
&mut self,
addr: Multiaddr,
dial_opts: DialOpts,
) -> Result<Self::Dial, TransportError<Self::Error>> {
let metrics = ConnectionMetrics::from_family_and_addr(&self.metrics, &addr);
Ok(self
.transport
.dial_as_listener(addr.clone())?
.dial(addr.clone(), dial_opts)?
.map_ok(Box::new(|(peer_id, stream_muxer)| {
(peer_id, Muxer::new(stream_muxer, metrics))
})))
Expand Down
2 changes: 1 addition & 1 deletion misc/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let mut swarm = libp2p::SwarmBuilder::with_existing_identity(local_keypair)
.with_tokio()
.with_tcp(
tcp::Config::default().port_reuse(true).nodelay(true),
tcp::Config::default().nodelay(true),
noise::Config::new,
yamux::Config::default,
)?
Expand Down
13 changes: 12 additions & 1 deletion muxers/mplex/benches/split_send_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use futures::prelude::*;
use futures::{channel::oneshot, future::join};
use libp2p_core::muxing::StreamMuxerExt;
use libp2p_core::transport::ListenerId;
use libp2p_core::Endpoint;
use libp2p_core::{multiaddr::multiaddr, muxing, transport, upgrade, Multiaddr, Transport};
use libp2p_identity as identity;
use libp2p_identity::PeerId;
Expand Down Expand Up @@ -146,7 +147,17 @@ fn run(
// Spawn and block on the sender, i.e. until all data is sent.
let sender = async move {
let addr = addr_receiver.await.unwrap();
let (_peer, mut conn) = sender_trans.dial(addr).unwrap().await.unwrap();
let (_peer, mut conn) = sender_trans
.dial(
addr,
transport::DialOpts {
role: Endpoint::Dialer,
port_use: transport::PortUse::Reuse,
},
)
.unwrap()
.await
.unwrap();
// Just calling `poll_outbound` without `poll` is fine here because mplex makes progress through all `poll_` functions. It is hacky though.
let mut stream = poll_fn(|cx| conn.poll_outbound_unpin(cx)).await.unwrap();
let mut off = 0;
Expand Down
13 changes: 11 additions & 2 deletions protocols/autonat/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use as_server::AsServer;
pub use as_server::{InboundProbeError, InboundProbeEvent};
use futures_timer::Delay;
use instant::Instant;
use libp2p_core::transport::PortUse;
use libp2p_core::{multiaddr::Protocol, ConnectedPoint, Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_request_response::{
Expand Down Expand Up @@ -338,6 +339,7 @@ impl Behaviour {
ConnectedPoint::Dialer {
address,
role_override: Endpoint::Dialer,
..
} => {
if let Some(event) = self.as_server().on_outbound_connection(&peer, address) {
self.pending_actions
Expand All @@ -347,6 +349,7 @@ impl Behaviour {
ConnectedPoint::Dialer {
address: _,
role_override: Endpoint::Listener,
..
} => {
// Outgoing connection was dialed as a listener. In other words outgoing connection
// was dialed as part of a hole punch. `libp2p-autonat` never attempts to hole
Expand Down Expand Up @@ -512,9 +515,15 @@ impl NetworkBehaviour for Behaviour {
peer: PeerId,
addr: &Multiaddr,
role_override: Endpoint,
port_use: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
self.inner
.handle_established_outbound_connection(connection_id, peer, addr, role_override)
self.inner.handle_established_outbound_connection(
connection_id,
peer,
addr,
role_override,
port_use,
)
}

fn on_swarm_event(&mut self, event: FromSwarm) {
Expand Down
1 change: 1 addition & 0 deletions protocols/autonat/src/behaviour/as_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl<'a> HandleInnerEvent for AsServer<'a> {
NonZeroU8::new(1).expect("1 > 0"),
)
.addresses(addrs)
.allocate_new_port()
.build(),
},
])
Expand Down
2 changes: 2 additions & 0 deletions protocols/autonat/tests/test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async fn test_dial_back() {
ConnectedPoint::Dialer {
address,
role_override: Endpoint::Dialer,
..
},
num_established,
concurrent_dial_errors,
Expand Down Expand Up @@ -300,6 +301,7 @@ async fn test_dial_multiple_addr() {
ConnectedPoint::Dialer {
address,
role_override: Endpoint::Dialer,
..
},
concurrent_dial_errors,
..
Expand Down
3 changes: 3 additions & 0 deletions protocols/dcutr/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::{handler, protocol};
use either::Either;
use libp2p_core::connection::ConnectedPoint;
use libp2p_core::multiaddr::Protocol;
use libp2p_core::transport::PortUse;
use libp2p_core::{Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::behaviour::{ConnectionClosed, DialFailure, FromSwarm};
Expand Down Expand Up @@ -206,12 +207,14 @@ impl NetworkBehaviour for Behaviour {
peer: PeerId,
addr: &Multiaddr,
role_override: Endpoint,
port_use: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
if is_relayed(addr) {
return Ok(Either::Left(handler::relayed::Handler::new(
ConnectedPoint::Dialer {
address: addr.clone(),
role_override,
port_use,
},
self.observed_addresses(),
))); // TODO: We could make two `handler::relayed::Handler` here, one inbound one outbound.
Expand Down
2 changes: 2 additions & 0 deletions protocols/floodsub/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::FloodsubConfig;
use bytes::Bytes;
use cuckoofilter::{CuckooError, CuckooFilter};
use fnv::FnvHashSet;
use libp2p_core::transport::PortUse;
use libp2p_core::{Endpoint, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_swarm::behaviour::{ConnectionClosed, ConnectionEstablished, FromSwarm};
Expand Down Expand Up @@ -346,6 +347,7 @@ impl NetworkBehaviour for Floodsub {
_: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
Ok(Default::default())
}
Expand Down
5 changes: 4 additions & 1 deletion protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ use prometheus_client::registry::Registry;
use rand::{seq::SliceRandom, thread_rng};

use instant::Instant;
use libp2p_core::{multiaddr::Protocol::Ip4, multiaddr::Protocol::Ip6, Endpoint, Multiaddr};
use libp2p_core::{
multiaddr::Protocol::Ip4, multiaddr::Protocol::Ip6, transport::PortUse, Endpoint, Multiaddr,
};
use libp2p_identity::Keypair;
use libp2p_identity::PeerId;
use libp2p_swarm::{
Expand Down Expand Up @@ -3011,6 +3013,7 @@ where
_: PeerId,
_: &Multiaddr,
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
Ok(Handler::new(self.config.protocol_config()))
}
Expand Down
Loading
Loading