protocols/identify: Revise symbol naming (#2927)

This commit is contained in:
João Oliveira
2022-10-04 01:17:31 +01:00
committed by GitHub
parent 1da75b2b25
commit a7a96e5502
19 changed files with 253 additions and 240 deletions

View File

@ -39,8 +39,7 @@ use libp2p::{
either::EitherTransport, muxing::StreamMuxerBox, transport, transport::upgrade::Version,
},
gossipsub::{self, Gossipsub, GossipsubConfigBuilder, GossipsubEvent, MessageAuthenticity},
identify::{Identify, IdentifyConfig, IdentifyEvent},
identity,
identify, identity,
multiaddr::Protocol,
noise, ping,
pnet::{PnetConfig, PreSharedKey},
@ -157,13 +156,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
#[behaviour(out_event = "MyBehaviourEvent")]
struct MyBehaviour {
gossipsub: Gossipsub,
identify: Identify,
identify: identify::Behaviour,
ping: ping::Behaviour,
}
enum MyBehaviourEvent {
Gossipsub(GossipsubEvent),
Identify(IdentifyEvent),
Identify(identify::Event),
Ping(ping::Event),
}
@ -173,8 +172,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
}
}
impl From<IdentifyEvent> for MyBehaviourEvent {
fn from(event: IdentifyEvent) -> Self {
impl From<identify::Event> for MyBehaviourEvent {
fn from(event: identify::Event) -> Self {
MyBehaviourEvent::Identify(event)
}
}
@ -197,7 +196,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
gossipsub_config,
)
.expect("Valid configuration"),
identify: Identify::new(IdentifyConfig::new(
identify: identify::Behaviour::new(identify::Config::new(
"/ipfs/0.1.0".into(),
local_key.public(),
)),