Created
July 14, 2019 01:11
-
-
Save joeykrug/99f30c738813d0d7c4c6c0737b1ec54f to your computer and use it in GitHub Desktop.
Node creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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