Skip to content

Commit 291e79f

Browse files
committed
fix: addition of ipfs id appendix must come before transport filtering
1 parent 59ea9c3 commit 291e79f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ class Node extends EventEmitter {
9393
let transports = this.modules.transport
9494

9595
transports = Array.isArray(transports) ? transports : [transports]
96+
97+
// so that we can have webrtc-star addrs without adding manually the id
98+
this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => {
99+
if (!mafmt.IPFS.matches(ma)) {
100+
ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String())
101+
}
102+
return ma
103+
})
104+
96105
const multiaddrs = this.peerInfo.multiaddrs
97106

98107
transports.forEach((transport) => {
@@ -107,13 +116,6 @@ class Node extends EventEmitter {
107116
}
108117
})
109118

110-
// so that we can have webrtc-star addrs without adding manually the id
111-
this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => {
112-
if (!mafmt.IPFS.matches(ma)) {
113-
ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String())
114-
}
115-
})
116-
117119
this.swarm.listen((err) => {
118120
if (err) {
119121
return callback(err)

0 commit comments

Comments
 (0)