mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-11 23:01:34 +00:00
https://github.com/multiformats/js-multiaddr/pull/76 changed the default protocol from ipfs to p2p. js-multiaddr is a transitive dependency of peer-info, so in order to get this change, we had to bump the version of peer-info. * fix: revert ipfs -> p2p change for some tests As per PR feedback. Needed for backwards-compatibility.
27 lines
532 B
JavaScript
27 lines
532 B
JavaScript
'use strict'
|
|
|
|
const PeerInfo = require('peer-info')
|
|
const Node = require('./browser-bundle')
|
|
|
|
function createNode (callback) {
|
|
PeerInfo.create((err, peerInfo) => {
|
|
if (err) {
|
|
return callback(err)
|
|
}
|
|
|
|
const peerIdStr = peerInfo.id.toB58String()
|
|
const ma = `/dns4/star-signal.cloud.ipfs.team/tcp/443/wss/p2p-webrtc-star/p2p/${peerIdStr}`
|
|
|
|
peerInfo.multiaddrs.add(ma)
|
|
|
|
const node = new Node({
|
|
peerInfo
|
|
})
|
|
|
|
node.idStr = peerIdStr
|
|
callback(null, node)
|
|
})
|
|
}
|
|
|
|
module.exports = createNode
|