Comparing version 3.2.2 to 3.3.0
@@ -24,3 +24,3 @@ var socket = require('k-rpc-socket') | ||
this.id = opts.id || opts.nodeId || crypto.randomBytes(20) | ||
this.id = toBuffer(opts.id || opts.nodeId || crypto.randomBytes(20)) | ||
this.socket = opts.socket || socket(opts) | ||
@@ -333,1 +333,7 @@ this.bootstrap = opts.bootstrap === false ? [] : [].concat(opts.nodes || opts.bootstrap || BOOTSTRAP_NODES).map(parsePeer) | ||
function noop () {} | ||
function toBuffer (str) { | ||
if (typeof str === 'string') return new Buffer(str, 'hex') | ||
if (Buffer.isBuffer(str)) return str | ||
throw new Error('Pass a buffer or a string') | ||
} |
{ | ||
"name": "k-rpc", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "Low-level implementation of the k-rpc protocol used the BitTorrent DHT.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
17159
373