diff --git a/query-stream.js b/query-stream.js index b72093b..f43dee6 100644 --- a/query-stream.js +++ b/query-stream.js @@ -45,6 +45,7 @@ function QueryStream (dht, query, opts) { this._k = nodes ? Infinity : opts.k || 20 this._inflight = 0 this._moveCloser = !nodes + this._map = opts.map || echo this._bootstrapped = !this._moveCloser this._onresponse = onresponse this._onresponseholepunch = onresponseholepunch @@ -164,14 +165,14 @@ QueryStream.prototype._callback = function (err, res, peer) { return } - this.push({ + this.push(this._map({ node: { id: res.id, port: peer.port, host: peer.host }, value: res.value - }) + })) } QueryStream.prototype._sendAll = function (nodes, force, useToken) { @@ -287,3 +288,7 @@ function copyNode (node) { referrer: node.referrer || node.referer } } + +function echo (a) { + return a +}