mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 17:01:58 +00:00
protocols/identify: Revise symbol naming (#2927)
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
use futures::StreamExt;
|
||||
use libp2p::core::identity;
|
||||
use libp2p::core::PeerId;
|
||||
use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent};
|
||||
use libp2p::identify;
|
||||
use libp2p::ping;
|
||||
use libp2p::swarm::{Swarm, SwarmEvent};
|
||||
use libp2p::{development_transport, rendezvous};
|
||||
@@ -42,7 +42,7 @@ async fn main() {
|
||||
let mut swarm = Swarm::new(
|
||||
development_transport(identity.clone()).await.unwrap(),
|
||||
MyBehaviour {
|
||||
identify: Identify::new(IdentifyConfig::new(
|
||||
identify: identify::Behaviour::new(identify::Config::new(
|
||||
"rendezvous-example/1.0.0".to_string(),
|
||||
identity.public(),
|
||||
)),
|
||||
@@ -75,7 +75,7 @@ async fn main() {
|
||||
log::error!("Lost connection to rendezvous point {}", error);
|
||||
}
|
||||
// once `/identify` did its job, we know our external address and can register
|
||||
SwarmEvent::Behaviour(MyEvent::Identify(IdentifyEvent::Received { .. })) => {
|
||||
SwarmEvent::Behaviour(MyEvent::Identify(identify::Event::Received { .. })) => {
|
||||
swarm.behaviour_mut().rendezvous.register(
|
||||
rendezvous::Namespace::from_static("rendezvous"),
|
||||
rendezvous_point,
|
||||
@@ -116,7 +116,7 @@ async fn main() {
|
||||
#[derive(Debug)]
|
||||
enum MyEvent {
|
||||
Rendezvous(rendezvous::client::Event),
|
||||
Identify(IdentifyEvent),
|
||||
Identify(identify::Event),
|
||||
Ping(ping::Event),
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ impl From<rendezvous::client::Event> for MyEvent {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<IdentifyEvent> for MyEvent {
|
||||
fn from(event: IdentifyEvent) -> Self {
|
||||
impl From<identify::Event> for MyEvent {
|
||||
fn from(event: identify::Event) -> Self {
|
||||
MyEvent::Identify(event)
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ impl From<ping::Event> for MyEvent {
|
||||
#[behaviour(event_process = false)]
|
||||
#[behaviour(out_event = "MyEvent")]
|
||||
struct MyBehaviour {
|
||||
identify: Identify,
|
||||
identify: identify::Behaviour,
|
||||
rendezvous: rendezvous::client::Behaviour,
|
||||
ping: ping::Behaviour,
|
||||
}
|
||||
|
@@ -21,9 +21,7 @@
|
||||
use futures::StreamExt;
|
||||
use libp2p::core::identity;
|
||||
use libp2p::core::PeerId;
|
||||
use libp2p::identify::Identify;
|
||||
use libp2p::identify::IdentifyConfig;
|
||||
use libp2p::identify::IdentifyEvent;
|
||||
use libp2p::identify;
|
||||
use libp2p::ping;
|
||||
use libp2p::swarm::{Swarm, SwarmEvent};
|
||||
use libp2p::NetworkBehaviour;
|
||||
@@ -48,7 +46,7 @@ async fn main() {
|
||||
let mut swarm = Swarm::new(
|
||||
development_transport(identity.clone()).await.unwrap(),
|
||||
MyBehaviour {
|
||||
identify: Identify::new(IdentifyConfig::new(
|
||||
identify: identify::Behaviour::new(identify::Config::new(
|
||||
"rendezvous-example/1.0.0".to_string(),
|
||||
identity.public(),
|
||||
)),
|
||||
@@ -104,7 +102,7 @@ async fn main() {
|
||||
enum MyEvent {
|
||||
Rendezvous(rendezvous::server::Event),
|
||||
Ping(ping::Event),
|
||||
Identify(IdentifyEvent),
|
||||
Identify(identify::Event),
|
||||
}
|
||||
|
||||
impl From<rendezvous::server::Event> for MyEvent {
|
||||
@@ -119,8 +117,8 @@ impl From<ping::Event> for MyEvent {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<IdentifyEvent> for MyEvent {
|
||||
fn from(event: IdentifyEvent) -> Self {
|
||||
impl From<identify::Event> for MyEvent {
|
||||
fn from(event: identify::Event) -> Self {
|
||||
MyEvent::Identify(event)
|
||||
}
|
||||
}
|
||||
@@ -129,7 +127,7 @@ impl From<IdentifyEvent> for MyEvent {
|
||||
#[behaviour(event_process = false)]
|
||||
#[behaviour(out_event = "MyEvent")]
|
||||
struct MyBehaviour {
|
||||
identify: Identify,
|
||||
identify: identify::Behaviour,
|
||||
rendezvous: rendezvous::server::Behaviour,
|
||||
ping: ping::Behaviour,
|
||||
}
|
||||
|
Reference in New Issue
Block a user