Skip to content

Commit

Permalink
fix: addition of ipfs id appendix must come before transport filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Mar 29, 2017
1 parent 59ea9c3 commit 291e79f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class Node extends EventEmitter {
let transports = this.modules.transport

transports = Array.isArray(transports) ? transports : [transports]

// so that we can have webrtc-star addrs without adding manually the id
this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => {
if (!mafmt.IPFS.matches(ma)) {
ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String())
}
return ma
})

const multiaddrs = this.peerInfo.multiaddrs

transports.forEach((transport) => {
Expand All @@ -107,13 +116,6 @@ class Node extends EventEmitter {
}
})

// so that we can have webrtc-star addrs without adding manually the id
this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => {
if (!mafmt.IPFS.matches(ma)) {
ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String())
}
})

this.swarm.listen((err) => {
if (err) {
return callback(err)
Expand Down

0 comments on commit 291e79f

Please sign in to comment.