Skip to content

Commit

Permalink
protocols/identify: Revise symbol naming (libp2p#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs authored Oct 4, 2022
1 parent 508e1a2 commit cc9792b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions examples/autonat_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use clap::Parser;
use futures::prelude::*;
use libp2p::autonat;
use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent};
use libp2p::identify;
use libp2p::multiaddr::Protocol;
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::{identity, Multiaddr, NetworkBehaviour, PeerId};
Expand Down Expand Up @@ -91,14 +91,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
#[derive(NetworkBehaviour)]
#[behaviour(out_event = "Event")]
struct Behaviour {
identify: Identify,
identify: identify::Behaviour,
auto_nat: autonat::Behaviour,
}

impl Behaviour {
fn new(local_public_key: identity::PublicKey) -> Self {
Self {
identify: Identify::new(IdentifyConfig::new(
identify: identify::Behaviour::new(identify::Config::new(
"/ipfs/0.1.0".into(),
local_public_key.clone(),
)),
Expand All @@ -119,11 +119,11 @@ impl Behaviour {
#[derive(Debug)]
enum Event {
AutoNat(autonat::Event),
Identify(IdentifyEvent),
Identify(identify::Event),
}

impl From<IdentifyEvent> for Event {
fn from(v: IdentifyEvent) -> Self {
impl From<identify::Event> for Event {
fn from(v: identify::Event) -> Self {
Self::Identify(v)
}
}
Expand Down
12 changes: 6 additions & 6 deletions examples/autonat_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use clap::Parser;
use futures::prelude::*;
use libp2p::autonat;
use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent};
use libp2p::identify;
use libp2p::multiaddr::Protocol;
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::{identity, Multiaddr, NetworkBehaviour, PeerId};
Expand Down Expand Up @@ -76,14 +76,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
#[derive(NetworkBehaviour)]
#[behaviour(out_event = "Event")]
struct Behaviour {
identify: Identify,
identify: identify::Behaviour,
auto_nat: autonat::Behaviour,
}

impl Behaviour {
fn new(local_public_key: identity::PublicKey) -> Self {
Self {
identify: Identify::new(IdentifyConfig::new(
identify: identify::Behaviour::new(identify::Config::new(
"/ipfs/0.1.0".into(),
local_public_key.clone(),
)),
Expand All @@ -98,11 +98,11 @@ impl Behaviour {
#[derive(Debug)]
enum Event {
AutoNat(autonat::Event),
Identify(IdentifyEvent),
Identify(identify::Event),
}

impl From<IdentifyEvent> for Event {
fn from(v: IdentifyEvent) -> Self {
impl From<identify::Event> for Event {
fn from(v: identify::Event) -> Self {
Self::Identify(v)
}
}
Expand Down

0 comments on commit cc9792b

Please sign in to comment.