diff --git a/Cargo.lock b/Cargo.lock index 6e1842797a3..5505357c8bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2522,7 +2522,7 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.43.0" +version = "0.44.0" dependencies = [ "async-std", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 99df44f569c..324154f6883 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ libp2p-deflate = { version = "0.40.0", path = "transports/deflate" } libp2p-dns = { version = "0.40.0", path = "transports/dns" } libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.45.1", path = "protocols/gossipsub" } -libp2p-identify = { version = "0.43.0", path = "protocols/identify" } +libp2p-identify = { version = "0.44.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.3" } libp2p-kad = { version = "0.44.4", path = "protocols/kad" } libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" } diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 79632954718..0914fae6b74 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -1,4 +1,8 @@ -## 0.43.0 +## 0.44.0 - unreleased + +- Added `Info` to the `libp2p-identify::Event::Pushed` to report what was pushed. + +## 0.43.0 - Observed addresses (aka. external address candidates) of the local node, reported by a remote node via `libp2p-identify`, are no longer automatically considered confirmed external addresses, in other words they are no longer trusted by default. Instead users need to confirm the reported observed address either manually, or by using `libp2p-autonat`. diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 6e892538669..8a301ba480a 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-identify" edition = "2021" rust-version = { workspace = true } description = "Nodes identifcation protocol for libp2p" -version = "0.43.0" +version = "0.44.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/identify/src/behaviour.rs b/protocols/identify/src/behaviour.rs index f572b937d38..b5509fc63c9 100644 --- a/protocols/identify/src/behaviour.rs +++ b/protocols/identify/src/behaviour.rs @@ -301,9 +301,9 @@ impl NetworkBehaviour for Behaviour { self.events .push_back(ToSwarm::GenerateEvent(Event::Sent { peer_id })); } - handler::Event::IdentificationPushed => { + handler::Event::IdentificationPushed(info) => { self.events - .push_back(ToSwarm::GenerateEvent(Event::Pushed { peer_id })); + .push_back(ToSwarm::GenerateEvent(Event::Pushed { peer_id, info })); } handler::Event::IdentificationError(error) => { self.events @@ -431,6 +431,8 @@ pub enum Event { Pushed { /// The peer that the information has been sent to. peer_id: PeerId, + /// The information pushed to the peer. + info: Info, }, /// Error while attempting to identify the remote. Error { diff --git a/protocols/identify/src/handler.rs b/protocols/identify/src/handler.rs index 5a1712e8c3d..cd04e75c53b 100644 --- a/protocols/identify/src/handler.rs +++ b/protocols/identify/src/handler.rs @@ -101,7 +101,7 @@ pub enum Event { /// We replied to an identification request from the remote. Identification, /// We actively pushed our identification information to the remote. - IdentificationPushed, + IdentificationPushed(Info), /// Failed to identify the remote, or to reply to an identification request. IdentificationError(StreamUpgradeError), } @@ -182,9 +182,12 @@ impl Handler { remote_info, ))); } - future::Either::Right(()) => self.events.push(ConnectionHandlerEvent::NotifyBehaviour( - Event::IdentificationPushed, - )), + future::Either::Right(()) => { + let local_info = self.build_info(); + self.events.push(ConnectionHandlerEvent::NotifyBehaviour( + Event::IdentificationPushed(local_info), + )); + } } }