Skip to content

Commit

Permalink
[transports/webrtc] remove local peer ID from reported addr
Browse files Browse the repository at this point in the history
to align with all other transports, which don't include `/p2p/..` in their reported addresses.
Refs libp2p#2622 (comment)
  • Loading branch information
melekes committed Nov 22, 2022
1 parent 9b18277 commit 050c416
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions transports/webrtc/src/tokio/transport.rs
Expand Up @@ -260,8 +260,7 @@ impl ListenStream {
{
return Poll::Ready(TransportEvent::NewAddress {
listener_id: self.listener_id,
listen_addr: self
.listen_multiaddress(ip, self.config.id_keys.public().to_peer_id()),
listen_addr: self.listen_multiaddress(ip),
});
}
}
Expand All @@ -272,8 +271,7 @@ impl ListenStream {
{
return Poll::Ready(TransportEvent::AddressExpired {
listener_id: self.listener_id,
listen_addr: self
.listen_multiaddress(ip, self.config.id_keys.public().to_peer_id()),
listen_addr: self.listen_multiaddress(ip),
});
}
}
Expand All @@ -290,11 +288,10 @@ impl ListenStream {
}

/// Constructs a [`Multiaddr`] for the given IP address that represents our listen address.
fn listen_multiaddress(&self, ip: IpAddr, local_peer_id: PeerId) -> Multiaddr {
fn listen_multiaddress(&self, ip: IpAddr) -> Multiaddr {
let socket_addr = SocketAddr::new(ip, self.listen_addr.port());

socketaddr_to_multiaddr(&socket_addr, Some(self.config.fingerprint))
.with(Protocol::P2p(*local_peer_id.as_ref()))
}
}

Expand Down

0 comments on commit 050c416

Please sign in to comment.