Comparing version 0.0.4 to 0.0.5
@@ -7,3 +7,3 @@ var crypto = require('crypto') | ||
var ethUtil = require('ethereumjs-util') | ||
var xor = require('bitwise-xor') | ||
var xor = require('buffer-xor') | ||
var rlp = require('rlp') | ||
@@ -17,3 +17,3 @@ var Mac = require('./mac.js') | ||
this.ephemeralSecKey = crypto.randomBytes(32) | ||
this.ephemeralPubKey = ecdsa.createPublicKey(this.ephemeralSecKey) | ||
this.ephemeralPubKey = ecdsa.publicKeyConvert(ecdsa.publicKeyCreate(this.ephemeralSecKey), false) | ||
this.nonce = crypto.randomBytes(32) | ||
@@ -51,2 +51,3 @@ this.ingressMac = new Mac() | ||
* https://github.com/ethereum/cpp-ethereum/blob/develop/libdevcrypto/CryptoPP.cpp#L36 | ||
* @private | ||
*/ | ||
@@ -80,3 +81,3 @@ | ||
var mkeyMaterial = key.slice(16, 32) | ||
var ourPubKey = ecdsa.createPublicKey(secKey) | ||
var ourPubKey = ecdsa.publicKeyConvert(ecdsa.publicKeyCreate(secKey), false) | ||
var IV = new Buffer(16) | ||
@@ -142,6 +143,3 @@ IV.fill(0) | ||
var r = ECIES.ecdh(this.secKey, pubKey) | ||
var ephemeral = this.remoteEphemeralPubKey = ecdsa.recover(xor(r, nonce), { | ||
signature: signature, | ||
recovery: recId[0] | ||
}, false).slice(1) | ||
var ephemeral = this.remoteEphemeralPubKey = ecdsa.publicKeyConvert(ecdsa.recoverSync(xor(r, nonce), signature, recId[0]), false).slice(1) | ||
var he = ethUtil.sha3(ephemeral).toString('hex') | ||
@@ -153,4 +151,4 @@ assert(he.toString('hex') === hepubk.toString('hex'), 'the hash of the ephemeral key should match') | ||
var r = ECIES.ecdh(this.secKey, this.remotePubKey) | ||
var sigr = ecdsa.sign(xor(r, this.nonce), this.ephemeralSecKey) | ||
var ephemeralPubKey = ecdsa.createPublicKey(this.ephemeralSecKey, false).slice(1) | ||
var sigr = ecdsa.signSync(xor(r, this.nonce), this.ephemeralSecKey) | ||
var ephemeralPubKey = ecdsa.publicKeyConvert(ecdsa.publicKeyCreate(this.ephemeralSecKey), false).slice(1) | ||
var he = ethUtil.sha3(ephemeralPubKey) | ||
@@ -186,3 +184,3 @@ var data = Buffer.concat([sigr.signature, new Buffer([sigr.recovery]), he, this.pubKey.slice(1), this.nonce, new Buffer([0])]) | ||
// check the header's mac | ||
assert(headerMac.toString('hex') === this.ingressMac.digest().toString('hex')) | ||
assert(headerMac.toString('hex') === this.ingressMac.digest().toString('hex'), 'Invalid Mac') | ||
header = this.ingressAes.update(header) | ||
@@ -189,0 +187,0 @@ var size = this._bodySize = ethUtil.bufferToInt(header.slice(0, 3)) |
@@ -13,11 +13,13 @@ const net = require('net') | ||
/** | ||
* Creates new Network object | ||
* @class Implements Ethereum's Wire Protocol and provides networking functions. | ||
* Creates a new Networking Object. This Implements Ethereum's Wire Protocol and provides networking functions. | ||
* @class | ||
* @param {Object} options | ||
* @param {Number} [options.protocolVersion=1] The network version | ||
* @param {String} [options.publicIp] The public ip address of this instance | ||
* @param {Object} [options.capabilties] A hash containing the capbilities of this node and their corrisponding version numbers | ||
* @param {Number} [options.timeout=20000] The length of time in milliseconds to wait for a peer to response after connecting to it | ||
* @param {Number} [options.maxPeers=10] The max number of peer the network will try to connect to | ||
* @param {String} [options.clientId] Specifies the client software identity, as a human-readable string | ||
* @param {Integer} [options.protocolVersion=1] The network version | ||
* @param {String} options.publicIp The public ip address of this instance | ||
* @param {Object} options.capabilties A hash containing the capbilities of this node and their corrisponding version numbers | ||
* @param {Integer} [options.timeout=20000] The length of time in milliseconds to wait for a peer to response after connecting to it | ||
* @param {Integer} [options.maxPeers=10] The max number of peer the network will try to connect to | ||
* @param {String} options.clientId Specifies the client software identity, as a human-readable string | ||
* @fires connect | ||
* @fires close | ||
*/ | ||
@@ -78,3 +80,3 @@ var Network = exports = module.exports = function (options) { | ||
/** | ||
* start the server | ||
* starts the tcp server | ||
* @method listen | ||
@@ -140,3 +142,7 @@ * @param {Number} [port=30303] The hostname or IP address the server is bound to. Defaults to 0.0.0.0 which means any available network | ||
port: peer.port | ||
}, cb) | ||
}, | ||
function (err, fPeer) { | ||
if (err) return cb(err) | ||
self.connect(fPeer, cb) | ||
}) | ||
} else { | ||
@@ -162,14 +168,22 @@ onId(null, peer) | ||
if (!id) { | ||
peer.on('connection', function () { | ||
self._peers[peer.id.toString('hex')] = peer | ||
}) | ||
} else { | ||
self._peers[id.toString('hex')] = peer | ||
} | ||
peer.on('connection', function () { | ||
self._peers[peer.id.toString('hex')] = peer | ||
/** | ||
* Emitted whenever a peer connects. Gives the peer to the handler. | ||
* @event Network#connection | ||
* @type {Peer} The peer that connected | ||
*/ | ||
self.emit('connection', peer) | ||
}) | ||
// disconnect delete peers | ||
socket.on('close', function () { | ||
self.emit('closing', peer) | ||
// delete refrances to the peer | ||
/** | ||
* Emitted when a peer disconnects. Gives the peer to the handler. | ||
* @event Network#closing | ||
* @type {Peer} The peer that disconnected | ||
*/ | ||
self.emit('close', peer) | ||
// delete refrances to the peer | ||
self._popPeerList() | ||
@@ -202,3 +216,3 @@ delete self._peers[peer.id.toString('hex')] | ||
peer.socket.once('close', cb2) | ||
// 0x08 Client quitting. | ||
// 0x08 Client quitting. | ||
peer.sendDisconnect(0x08, function () { | ||
@@ -211,3 +225,3 @@ peer.socket.end() | ||
self.server.destroy(cb) | ||
// self.server.close(cb) | ||
// self.server.close(cb) | ||
} else if (cb) { | ||
@@ -214,0 +228,0 @@ cb() |
const sha3 = require('sha3') | ||
const xor = require('bitwise-xor') | ||
const xor = require('buffer-xor') | ||
const crypto = require('crypto') | ||
@@ -10,5 +10,3 @@ | ||
/** | ||
* Updates the underlining SHA3 256 | ||
*/ | ||
// Updates the underlining SHA3 256 | ||
MAC.prototype.rawUpdate = function (data) { | ||
@@ -15,0 +13,0 @@ this.sha3.update(data) |
@@ -16,5 +16,11 @@ const util = require('util') | ||
/** | ||
* @contructor | ||
* The peer represents a peer on the ethereum network. Peer objects cannot be created directly. The `Network` creates them when a connection happens | ||
* @constructor | ||
* @param {Object} socket an Intialized Sockets. MUST alread be connected | ||
* @param {Object} network the network that initailized the connection | ||
* @param {Buffer} id | ||
* @fires connection | ||
* @fires close | ||
* @fires pong | ||
* @fires data | ||
*/ | ||
@@ -166,2 +172,7 @@ var Peer = exports = module.exports = function (socket, network, id) { | ||
} else { | ||
/** | ||
* Emitted when the peer gets data from the network | ||
* @event Peer#data | ||
* @type {Buffer} | ||
*/ | ||
this.emit('data', body) | ||
@@ -194,4 +205,8 @@ } | ||
} | ||
/** | ||
* Emitted whenever this peer connects. Gives the peer to the handler. | ||
* @event Peer#connection | ||
* @type {Peer} The peer that connected | ||
*/ | ||
this.emit('connection', this) | ||
this.network.emit('connection', this) | ||
break | ||
@@ -201,2 +216,7 @@ | ||
case 1: | ||
/** | ||
* Emitted when this peer disconnects. Gives the peer to the handler. | ||
* @event Peet#closing | ||
* @type {Peer} The peer that disconnected | ||
*/ | ||
this.emit('close') | ||
@@ -212,2 +232,7 @@ this.socket.end() | ||
case 3: | ||
/** | ||
* Emitted when this peer gets a `pong` | ||
* @event Peer#pong | ||
* @type {object} the pong object | ||
*/ | ||
this.emit('pong') | ||
@@ -218,2 +243,5 @@ break | ||
/** | ||
* @method toString | ||
*/ | ||
Peer.prototype.toString = function () { | ||
@@ -273,2 +301,18 @@ return this.socket.remoteAddress + ':' + this.socket.remotePort | ||
/** | ||
* Sends the disconnect message, where reason is one of the following integers | ||
* | ||
* * 0x00 - Disconnect requested | ||
* * 0x01 - TCP sub-system error | ||
* * 0x02 - Bad protocol | ||
* * 0x03 - Useless peer | ||
* * 0x04 - Too many peers | ||
* * 0x05 - Already connected | ||
* * 0x06 - Wrong genesis block | ||
* * 0x07 - Incompatible network protocols | ||
* * 0x08 - Client quitting | ||
* | ||
* @method sendDisonnect | ||
* @param {Inteter} reason | ||
*/ | ||
Peer.prototype.sendDisconnect = function (reason) { | ||
@@ -282,4 +326,8 @@ if (reason === undefined) { | ||
var body = this.eciesSession.createBody(msg) | ||
this.socket.write(header) | ||
this.socket.end(body) | ||
try { | ||
this.socket.write(header) | ||
this.socket.end(body) | ||
} catch (e) { | ||
} | ||
} | ||
@@ -298,5 +346,8 @@ | ||
} | ||
/** | ||
* Creates a Duplex stream. Uses node's steams | ||
* @method createStream | ||
*/ | ||
Peer.prototype.createStream = function (opts) { | ||
return new Stream(opts, this) | ||
} |
{ | ||
"name": "devp2p", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A javascript libary implementing RPLx the ethereum p2p protocol", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard ./index.js ./lib/*.js && mocha ./test" | ||
"test": " tape ./test/*.js", | ||
"coverage": "istanbul cover tape ./test/*.js", | ||
"coveralls": "npm run coverage && coveralls <coverage/lcov.info", | ||
"lint": "standard", | ||
"build:docs": "documentation --github -f md ./index.js > ./docs/index.md" | ||
}, | ||
@@ -27,8 +31,8 @@ "repository": { | ||
"bigi": "^1.4.0", | ||
"bitwise-xor": "0.0.0", | ||
"devp2p-dpt": "0.0.4", | ||
"buffer-xor": "^1.0.3", | ||
"devp2p-dpt": "1.0.1", | ||
"ecurve": "^1.0.1", | ||
"ethereumjs-util": "2.0.3", | ||
"ethereumjs-util": "2.4.0", | ||
"rlp": "2.0.0", | ||
"secp256k1": "1.1.4", | ||
"secp256k1": "^2.0.7", | ||
"server-destroy": "^1.0.0", | ||
@@ -39,8 +43,11 @@ "sha3": "^1.1.0", | ||
"devDependencies": { | ||
"coveralls": "^2.11.6", | ||
"documentation": "^3.0.4", | ||
"istanbul": "^0.4.1", | ||
"levelup": "^1.2.1", | ||
"memdown": "^1.0.0", | ||
"mocha": "^2.1.0", | ||
"standard": "^5.3.1", | ||
"tape": "^4.0.0" | ||
"standard": "^5.4.1", | ||
"tape": "^4.4.0" | ||
} | ||
} |
# node-devp2p | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) [![Build Status](https://travis-ci.org/ethereum/node-devp2p.svg?branch=master)](https://travis-ci.org/ethereum/node-devp2p) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/ethereumjs-lib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) or #ethereumjs on freenode | ||
[![NPM Package](https://img.shields.io/npm/v/devp2p.svg?style=flat-square)](https://www.npmjs.org/package/devp2p) | ||
[![Build Status](https://img.shields.io/travis/ethereumjs/node-devp2p.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/node-devp2p) | ||
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/node-devp2p.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/node-devp2p) | ||
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode | ||
Implements the [RPLx](https://github.com/ethereum/devp2p/blob/master/rlpx.md) transport. | ||
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
Implements the [RLPx](https://github.com/ethereum/devp2p/blob/master/rlpx.md) transport protocol. | ||
@@ -10,84 +14,6 @@ | ||
#API | ||
- [`Network`](#network) | ||
- [`new Network([host], [post], [options])`](#new-networkhost-port-options) | ||
- [`Network` options](#network-options) | ||
- [`Network` methods](#network-methods) | ||
- [`network.listen([port], [host])`](#networklistenport-host) | ||
- [`network.connect(port, host, [callback])`](#networkconnectport-host-callback) | ||
- [`network.stop([callback])`](#networkstopcallback) | ||
- [`Network` events](#network-events) | ||
- [`Peer`](#peer) | ||
- [`Peer` methods](#peer-methods) | ||
- [`peer.sendHello([callback])`](#peersendhellocallback) | ||
- [`peer.sendDisconnect(reason, [callback])`](#peersenddisconnectreason-callback) | ||
- [`peer.sendPing([callback])`](#peersendpingcallback) | ||
- [`peer.sendPong([callback])`](#peersendpongcallback) | ||
- [`Peer` events](#peer-events) | ||
# API | ||
[./docs/](./docs/index.md) | ||
## `Network` | ||
### `new Network([options])` | ||
Creates new Network object with the following arguments | ||
- `options` - An object with the Network configuration. See [`Network` options](#network-options) | ||
### `Network` options | ||
When creating a Network the following options can be used to configure its behavoir. | ||
- `timeout` - The lenght of time in milliseconds to wait for a peer to response after connecting to it | ||
- `maxPeers` - The max number of peer the network will try to connect to | ||
- `clientId` - specifies the client software identity, as a human-readable string | ||
- `publicIp` - The public ip of this node | ||
- `secretKey` - a 32 byte `Buffer` use to encrypte packets and identify the node. | ||
- `subprotocols` - a hash containing the subprotocol name and its corisponding version number | ||
### `Network` methods | ||
#### `network.listen([port], [host])` | ||
start the tcp server | ||
- `host` - The hostname or IP address the server is bound to. Defaults to `0.0.0.0` which means any available network | ||
- `port` - The TPC port the server is listening to. Defaults to port `30303` | ||
#### `network.connect(peer, [callback])` | ||
connect to a peer | ||
- `peer` - a POJO containing | ||
- `host` - the hostname or IP of the peer | ||
- `port` - the port of the peer | ||
- `id` - the id/public key of the peer | ||
- `callback` - a callback function | ||
#### `network.close([callback])` | ||
stops the tcp server and disconnects any peers | ||
### `Network` events | ||
The Network object inherits from `Events.EventEmitter` and emits the following events. | ||
- `connection` - fires whever we connect with a peetr | ||
- `peer` - The [peer](#peer) that emitted the event | ||
## `Peer` | ||
The peer represents a peer on the ethereum network. Peer objects cannot be created directly. | ||
- file - [lib/network/peer.js](../tree/master/lib/network/peer.js) | ||
### `Peer` methods | ||
#### `peer.sendHello([callback])` | ||
Sends the hello message | ||
#### `peer.sendDisconnect(reason, [callback])` | ||
Sends the disconnect message, where reason is one of the following integers | ||
- `0x00` - Disconnect requested | ||
- `0x01` - TCP sub-system error | ||
- `0x02` - Bad protocol | ||
- `0x03` - Useless peer | ||
- `0x04` - Too many peers | ||
- `0x05` - Already connected | ||
- `0x06` - Wrong genesis block | ||
- `0x07` - Incompatible network protocols | ||
- `0x08` - Client quitting | ||
#### `peer.sendPing([callback])` | ||
Send Ping | ||
#### `peer.sendPong([callback])` | ||
Send Pong | ||
##`Peer` events | ||
peer events are the same as [`Network` events](#network-events) | ||
# LICENSE | ||
GPL | ||
[MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) |
var ECIES = require('../lib/ecies.js') | ||
var ecdsa = require('secp256k1') | ||
var crypto = require('crypto') | ||
var assert = require('assert') | ||
var tape = require('tape') | ||
@@ -9,14 +9,14 @@ var a | ||
describe('[Network]: ECIES', function () { | ||
it('should create a new ECIES instance', function (done) { | ||
tape('[Network]: ECIES', function (it) { | ||
it.test('should create a new ECIES instance', function (t) { | ||
var privateKey = crypto.randomBytes(32) | ||
var privateKey2 = crypto.randomBytes(32) | ||
var pubKey = ecdsa.createPublicKey(privateKey) | ||
var pubKey2 = ecdsa.createPublicKey(privateKey2) | ||
var pubKey = ecdsa.publicKeyConvert(ecdsa.publicKeyCreate(privateKey), false) | ||
var pubKey2 = ecdsa.publicKeyConvert(ecdsa.publicKeyCreate(privateKey2), false) | ||
a = new ECIES(privateKey, pubKey, pubKey2) | ||
b = new ECIES(privateKey2, pubKey2, pubKey) | ||
done() | ||
t.end() | ||
}) | ||
it('should encrypt and decrypt', function (done) { | ||
it.test('should encrypt and decrypt', function (t) { | ||
var message = new Buffer('The Magic Words are Squeamish Ossifrage') | ||
@@ -26,33 +26,33 @@ var privateKey = crypto.randomBytes(32) | ||
var decrypted = b.decryptMessage(encypted) | ||
assert(message.toString() === decrypted.toString()) | ||
done() | ||
t.assert(message.toString() === decrypted.toString()) | ||
t.end() | ||
}) | ||
it('should create an auth message and parse it', function (done) { | ||
it.test('should create an auth message and parse it', function (t) { | ||
var data = a.createAuth() | ||
b.parseAuth(data) | ||
done() | ||
t.end() | ||
}) | ||
it('should create an ack message and parse it', function (done) { | ||
it.test('should create an ack message and parse it', function (t) { | ||
var data = b.createAck() | ||
a.parseAck(data) | ||
done() | ||
t.end() | ||
}) | ||
it('should create a frame header and parse it', function (done) { | ||
it.test('should create a frame header and parse it', function (t) { | ||
var size = 600 | ||
var data = a.createHeader(size) | ||
var out = b.parseHeader(data) | ||
assert(size === out) | ||
done() | ||
t.assert(size === out) | ||
t.end() | ||
}) | ||
it('should create a frame body and parse it', function (done) { | ||
it.test('should create a frame body and parse it', function (t) { | ||
var something = new Buffer(600) | ||
var data = a.createBody(something) | ||
var result = b.parseBody(data) | ||
assert(something.toString('hex') === result.toString('hex')) | ||
done() | ||
t.assert(something.toString('hex') === result.toString('hex')) | ||
t.end() | ||
}) | ||
}) |
@@ -1,74 +0,69 @@ | ||
var Network = require('../index.js'); | ||
var RLP = require('rlp'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
var async = require('async'); | ||
const Network = require('../index.js') | ||
const tape = require('tape') | ||
var internals = { | ||
//test port and host | ||
// test port and host | ||
port: 4447, | ||
host: '127.0.0.1' | ||
}; | ||
} | ||
describe('[Network]: Listening functions', function() { | ||
var network = new Network(); | ||
it('should listen', function(done) { | ||
network.listen(internals.port, internals.host, done); | ||
}); | ||
tape('[Network]: Listening functions', function (it) { | ||
var network = new Network() | ||
it.test('should listen', function (t) { | ||
network.listen(internals.port, internals.host, t.end) | ||
}) | ||
it('should stop listening', function(done) { | ||
network.close(done); | ||
}); | ||
}); | ||
it.test('should stop listening', function (t) { | ||
network.close(t.end) | ||
}) | ||
}) | ||
describe('[Network]: Peer Messages', function() { | ||
tape('[Network]: Peer Messages', function (it) { | ||
var network = new Network() | ||
var network2 = new Network() | ||
var peer = false | ||
var peer2 = false | ||
var network = new Network(); | ||
var network2 = new Network(); | ||
var peer = false; | ||
var peer2 = false; | ||
it.test('should start', function (t) { | ||
network.listen(internals.port, internals.host, function () { | ||
network2.listen(internals.port + 1, internals.host, t.end) | ||
}) | ||
}) | ||
before(function(done) { | ||
network.listen(internals.port, internals.host, function() { | ||
network2.listen(internals.port + 1, internals.host, done); | ||
}); | ||
}); | ||
it.test('should send a hello message on connect', function (t) { | ||
network2.once('connection', function (p) { | ||
peer = p | ||
if (peer && peer2) t.end() | ||
}) | ||
it('should send a hello message on connect', function(done) { | ||
network2.once('connection', function(p) { | ||
peer = p; | ||
if(peer && peer2) done(); | ||
}); | ||
network.once('connection', function (p) { | ||
peer2 = p | ||
if (peer && peer2) t.end() | ||
}) | ||
network.once('connection', function(p) { | ||
peer2 = p; | ||
if(peer && peer2) done(); | ||
}); | ||
network.connect({ | ||
port: internals.port + 1, | ||
address: internals.host | ||
}); | ||
}); | ||
}) | ||
}) | ||
it('should send a ping', function (done) { | ||
it.test('should send a ping', function (t) { | ||
peer2.once('pong', function () { | ||
done(); | ||
}); | ||
peer2.sendPing(); | ||
}); | ||
t.end() | ||
}) | ||
peer2.sendPing() | ||
}) | ||
it('should send disconnect', function (done) { | ||
it.test('should send disconnect', function (t) { | ||
peer.once('close', function () { | ||
done(); | ||
}); | ||
peer2.end(0x08); | ||
}); | ||
t.end() | ||
}) | ||
peer2.end(0x08) | ||
}) | ||
it('should stop listening', function(done) { | ||
network.close(function(){ | ||
network2.close(done); | ||
}); | ||
}); | ||
}); | ||
it.test('should stop listening', function (t) { | ||
network.close(function () { | ||
network2.close(t.end) | ||
}) | ||
}) | ||
}) |
@@ -1,47 +0,45 @@ | ||
var Network = require('../index.js'); | ||
var assert = require('assert'); | ||
var network = new Network(); | ||
var network2 = new Network(); | ||
var peer = false; | ||
var peer2 = false; | ||
var stream1; | ||
var stream2; | ||
var Network = require('../index.js') | ||
var tape = require('tape') | ||
var network = new Network() | ||
var network2 = new Network() | ||
var stream1 | ||
var stream2 | ||
var internals = { | ||
//test port and host | ||
// test port and host | ||
port: 4447, | ||
host: '127.0.0.1' | ||
}; | ||
} | ||
var data = 'hello world!' | ||
describe('stream test', function() { | ||
it('simple test', function(done) { | ||
network.listen(internals.port, internals.host, function() { | ||
network2.listen(internals.port + 1, internals.host, function() { | ||
tape('stream test', function (it) { | ||
it.test('simple test', function (t) { | ||
network.listen(internals.port, internals.host, function () { | ||
network2.listen(internals.port + 1, internals.host, function () { | ||
network.connect({ | ||
port: internals.port + 1, | ||
address: internals.host | ||
}); | ||
}); | ||
}); | ||
}) | ||
}) | ||
}) | ||
network2.once('connection', function(p) { | ||
stream1 = p.createStream(); | ||
stream1.on('data', function(d) { | ||
console.log(d.toString()); | ||
console.log(data.toString('hex')); | ||
assert(d.toString() === data); | ||
done(); | ||
}); | ||
network2.once('connection', function (p) { | ||
stream1 = p.createStream() | ||
stream1.on('data', function (d) { | ||
console.log(d.toString()) | ||
console.log(data.toString('hex')) | ||
t.assert(d.toString() === data) | ||
t.end() | ||
process.exit() | ||
}) | ||
if (stream1 && stream2) stream2.write(data); | ||
}); | ||
if (stream1 && stream2) stream2.write(data) | ||
}) | ||
network.once('connection', function(p) { | ||
stream2 = p.createStream(); | ||
if (stream1 && stream2) stream2.write(data); | ||
}); | ||
}); | ||
}); | ||
network.once('connection', function (p) { | ||
stream2 = p.createStream() | ||
if (stream1 && stream2) stream2.write(data) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40369
15
1056
1
8
19
+ Addedbuffer-xor@^1.0.3
+ Addedbluebird@3.7.2(transitive)
+ Addedbn.js@4.12.1(transitive)
+ Addedbrowserify-sha3@0.0.1(transitive)
+ Addedbuffer-xor@1.0.3(transitive)
+ Addeddevp2p-dpt@1.0.1(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedethereumjs-util@2.4.0(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedk-bucket@0.6.0(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedsecp256k1@2.0.10(transitive)
- Removedbitwise-xor@0.0.0
- Removedbitwise-xor@0.0.0(transitive)
- Removedbn.js@3.3.0(transitive)
- Removedbrowserify-sha3@0.0.0(transitive)
- Removeddevp2p-dpt@0.0.4(transitive)
- Removedelliptic@5.2.1(transitive)
- Removedethereumjs-util@2.0.3(transitive)
- Removedk-bucket@0.5.0(transitive)
- Removedsecp256k1@1.1.4(transitive)
Updateddevp2p-dpt@1.0.1
Updatedethereumjs-util@2.4.0
Updatedsecp256k1@^2.0.7