Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: multiaddr validation to add peer id for listening (#2833)
Browse files Browse the repository at this point in the history
* fix: multiaddr validation to add peer id for listening
* chore: update packages/ipfs/src/core/components/start.js

Co-authored-by: Alex Potsides <alex@achingbrain.net>
  • Loading branch information
vasco-santos and achingbrain authored Mar 27, 2020
1 parent 10e8682 commit 78cbec1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/ipfs/src/core/components/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ module.exports = ({
config.Addresses.Swarm.forEach(addr => {
let ma = multiaddr(addr)

if (ma.getPeerId()) {
// multiaddrs that go via a signalling server or other intermediary (e.g. stardust,
// webrtc-star) can have the intermediary's peer ID in the address, so append our
// peer ID to the end of it
const maId = ma.getPeerId()
if (maId && maId !== peerInfo.id.toB58String()) {
ma = ma.encapsulate(`/p2p/${peerInfo.id.toB58String()}`)
}

Expand Down

0 comments on commit 78cbec1

Please sign in to comment.