bitcore/examples/PeerDiscovery.js

16 lines
456 B
JavaScript
Raw Normal View History

var PeerManager = require('../PeerManager');
var peerman = new PeerManager();
peerman.discoverPeers(function(err, peers) {
// we get an array of peer instances
console.log(peers);
// the peer manager caches the tried seeds and any results
console.log(peerman.seeds);
// we can use this array of peers to add to the manager
peers.forEach(function(p) {
peerman.addPeer(p);
});
// then we can start the manager
peerman.start();
});