2017-07-04 11:43:45 +01:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const PeerInfo = require('peer-info')
|
2017-07-09 16:52:37 +01:00
|
|
|
const Node = require('./browser-bundle')
|
2017-07-04 11:43:45 +01:00
|
|
|
|
|
|
|
function createNode (callback) {
|
|
|
|
PeerInfo.create((err, peerInfo) => {
|
|
|
|
if (err) {
|
|
|
|
return callback(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
const peerIdStr = peerInfo.id.toB58String()
|
|
|
|
const ma = `/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss/ipfs/${peerIdStr}`
|
|
|
|
|
|
|
|
peerInfo.multiaddrs.add(ma)
|
|
|
|
|
2017-07-09 16:52:37 +01:00
|
|
|
const node = new Node(peerInfo)
|
2017-07-04 11:43:45 +01:00
|
|
|
|
|
|
|
node.idStr = peerIdStr
|
|
|
|
callback(null, node)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = createNode
|