From bf16ab6f2d68fe99ab2b5c048d018a97e4bb4970 Mon Sep 17 00:00:00 2001 From: David Dias Date: Thu, 5 Apr 2018 18:55:42 +0100 Subject: [PATCH 1/2] chore: update deps --- package.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 6287d122b9..b0740b6aaf 100644 --- a/package.json +++ b/package.json @@ -38,14 +38,14 @@ "homepage": "https://github.com/libp2p/js-libp2p", "dependencies": { "async": "^2.6.0", - "libp2p-floodsub": "^0.14.1", - "libp2p-ping": "~0.6.1", - "libp2p-switch": "~0.37.3", - "mafmt": "^4.0.0", - "multiaddr": "^3.1.0", - "peer-book": "~0.5.4", - "peer-id": "~0.10.6", - "peer-info": "~0.11.6" + "libp2p-floodsub": "^0.15.0", + "libp2p-ping": "~0.7.0", + "libp2p-switch": "~0.39.0", + "mafmt": "^6.0.0", + "multiaddr": "^4.0.0", + "peer-book": "~0.7.0", + "peer-id": "~0.10.7", + "peer-info": "~0.14.0" }, "devDependencies": { "aegir": "^13.0.6", @@ -53,17 +53,17 @@ "cids": "~0.5.3", "dirty-chai": "^2.0.1", "electron-webrtc": "~0.3.0", - "libp2p-circuit": "~0.1.5", - "libp2p-kad-dht": "~0.9.0", - "libp2p-mdns": "~0.9.2", - "libp2p-mplex": "~0.6.0", - "libp2p-railing": "~0.7.1", - "libp2p-secio": "~0.9.4", - "libp2p-spdy": "~0.11.0", - "libp2p-tcp": "~0.11.6", + "libp2p-circuit": "~0.2.0", + "libp2p-kad-dht": "~0.10.0", + "libp2p-mdns": "~0.11.0", + "libp2p-mplex": "~0.7.0", + "libp2p-railing": "~0.8.0", + "libp2p-secio": "~0.10.0", + "libp2p-spdy": "~0.12.1", + "libp2p-tcp": "~0.12.0", "libp2p-webrtc-star": "~0.13.4", - "libp2p-websockets": "~0.10.5", - "libp2p-websocket-star": "~0.7.7", + "libp2p-websockets": "~0.11.0", + "libp2p-websocket-star": "~0.8.0", "libp2p-websocket-star-rendezvous": "~0.2.3", "lodash.times": "^4.3.2", "pre-commit": "^1.2.2", @@ -71,8 +71,8 @@ "pull-serializer": "~0.3.2", "pull-stream": "^3.6.7", "safe-buffer": "^5.1.1", - "sinon": "^4.4.10", - "wrtc": "0.0.67" + "sinon": "^4.5.0", + "wrtc": "0.1.1" }, "contributors": [ "Chris Bratlien ", From 2e858a2212e764c031985000de454234fe1d64b0 Mon Sep 17 00:00:00 2001 From: Diogo Silva Date: Tue, 3 Apr 2018 15:51:05 +0100 Subject: [PATCH 2/2] feat: use class-is for type checks --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3498bab787..bdddea1d77 100644 --- a/src/index.js +++ b/src/index.js @@ -10,6 +10,7 @@ const series = require('async/series') const PeerBook = require('peer-book') const Switch = require('libp2p-switch') const Ping = require('libp2p-ping') +const WebSockets = require('libp2p-websockets') const peerRouting = require('./peer-routing') const contentRouting = require('./content-routing') @@ -129,8 +130,7 @@ class Node extends EventEmitter { if (transport.filter(multiaddrs).length > 0) { this.switch.transport.add( transport.tag || transport.constructor.name, transport) - } else if (transport.constructor && - transport.constructor.name === 'WebSockets') { + } else if (WebSockets.isWebSockets(transport)) { // TODO find a cleaner way to signal that a transport is always // used for dialing, even if no listener ws = transport