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()
|
2019-07-30 12:38:02 +02:00
|
|
|
const webrtcAddr = `/dns4/star-signal.cloud.ipfs.team/tcp/443/wss/p2p-webrtc-star/p2p/${peerIdStr}`
|
|
|
|
const wsAddr = `/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star`
|
2017-07-04 11:43:45 +01:00
|
|
|
|
2019-07-30 12:38:02 +02:00
|
|
|
peerInfo.multiaddrs.add(webrtcAddr)
|
|
|
|
peerInfo.multiaddrs.add(wsAddr)
|
2017-07-04 11:43:45 +01:00
|
|
|
|
2018-06-28 10:06:25 +02:00
|
|
|
const node = new Node({
|
|
|
|
peerInfo
|
|
|
|
})
|
2017-07-04 11:43:45 +01:00
|
|
|
|
|
|
|
node.idStr = peerIdStr
|
|
|
|
callback(null, node)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = createNode
|