Skip to content

Instantly share code, notes, and snippets.

@joeykrug
Created July 14, 2019 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeykrug/99f30c738813d0d7c4c6c0737b1ec54f to your computer and use it in GitHub Desktop.
Save joeykrug/99f30c738813d0d7c4c6c0737b1ec54f to your computer and use it in GitHub Desktop.
Node creation
'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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment