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

Commit 78cbec1

Browse files
fix: multiaddr validation to add peer id for listening (#2833)
* fix: multiaddr validation to add peer id for listening * chore: update packages/ipfs/src/core/components/start.js Co-authored-by: Alex Potsides <[email protected]>
1 parent 10e8682 commit 78cbec1

File tree

1 file changed

+5
-1
lines changed
  • packages/ipfs/src/core/components

1 file changed

+5
-1
lines changed

packages/ipfs/src/core/components/start.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ module.exports = ({
3939
config.Addresses.Swarm.forEach(addr => {
4040
let ma = multiaddr(addr)
4141

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

0 commit comments

Comments
 (0)