diff --git a/README.md b/README.md index 01d1baa..bd6ab4a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![Sauce Test Status](https://saucelabs.com/browser-matrix/libp2p-ipfs-browser.svg)](https://saucelabs.com/u/libp2p-ipfs-browser) -> libp2p build (module) used in js-ipfs when running it on the browser. +> libp2p build (module) used in js-ipfs when running it on the browser. If you are looking for the version to be used in Node.js, see [libp2p-ipfs-nodejs](https://github.com/ipfs/js-libp2p-ipfs-nodejs). This libp2p build has support for: diff --git a/gulpfile.js b/gulpfile.js index 5475230..a4994df 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ const gulp = require('gulp') const multiaddr = require('multiaddr') -const Node = require('libp2p-ipfs').Node +const Node = require('libp2p-ipfs-nodejs') const PeerInfo = require('peer-info') const PeerId = require('peer-id') const pull = require('pull-stream') diff --git a/package.json b/package.json index 1a0a9f9..99c0090 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,10 @@ "homepage": "https://github.com/ipfs/js-libp2p-ipfs-browser#readme", "devDependencies": { "aegir": "^9.1.2", - "async": "^2.1.2", + "async": "^2.1.4", "chai": "^3.5.0", "gulp": "^3.9.1", - "libp2p-ipfs": "^0.15.0", + "libp2p-ipfs-nodejs": "^0.16.0", "peer-id": "^0.8.0", "pre-commit": "^1.1.3", "pull-goodbye": "0.0.1", @@ -45,14 +45,14 @@ "dependencies": { "libp2p-secio": "^0.6.3", "libp2p-spdy": "^0.10.0", - "libp2p-swarm": "^0.26.1", + "libp2p-swarm": "^0.26.3", "libp2p-webrtc-star": "^0.6.0", "libp2p-websockets": "^0.9.1", "mafmt": "^2.1.2", - "multiaddr": "^2.0.3", + "multiaddr": "^2.1.1", "peer-book": "^0.3.0", "peer-id": "^0.8.0", - "peer-info": "^0.8.0" + "peer-info": "^0.8.1" }, "contributors": [ "David Dias ", @@ -60,4 +60,4 @@ "Richard Littauer ", "greenkeeperio-bot " ] -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index e53ebaf..6ae9de3 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ const spdy = require('libp2p-spdy') const secio = require('libp2p-secio') const libp2p = require('libp2p') -class Node extends libp2p.Node { +class Node extends libp2p { constructor (peerInfo, peerBook) { const webRTCStar = new WebRTCStar() @@ -31,6 +31,4 @@ class Node extends libp2p.Node { } } -module.exports = { - Node: Node -} +module.exports = Node diff --git a/test/webrtc-star-only.js b/test/webrtc-star-only.js index e886821..c5c2012 100644 --- a/test/webrtc-star-only.js +++ b/test/webrtc-star-only.js @@ -8,7 +8,7 @@ const PeerId = require('peer-id') const parallel = require('async/parallel') const pull = require('pull-stream') -const libp2p = require('../src') +const Node = require('../src') describe('libp2p-ipfs-browser (webrtc only)', function () { this.timeout(15 * 1000) @@ -38,15 +38,19 @@ describe('libp2p-ipfs-browser (webrtc only)', function () { }) it('create two libp2p nodes with those peers', (done) => { - node1 = new libp2p.Node(peer1) - node2 = new libp2p.Node(peer2) + node1 = new Node(peer1) + node2 = new Node(peer2) done() }) it('listen on the two libp2p nodes', (done) => { parallel([ - node1.start, - node2.start + (cb) => { + node1.start(cb) + }, + (cb) => { + node2.start(cb) + } ], done) }) @@ -114,7 +118,7 @@ describe('libp2p-ipfs-browser (webrtc only)', function () { node2.dialByPeerInfo(peerInfo, () => {}) }) - const node3 = new libp2p.Node(peer3) + const node3 = new Node(peer3) node3.start(() => { setTimeout(() => { expect(Object.keys(node1.swarm.muxedConns).length).to.equal(1) diff --git a/test/websockets-only.js b/test/websockets-only.js index 77a53c1..41ec1d8 100644 --- a/test/websockets-only.js +++ b/test/websockets-only.js @@ -10,7 +10,7 @@ const pull = require('pull-stream') const goodbye = require('pull-goodbye') const serializer = require('pull-serializer') -const libp2p = require('../src') +const Node = require('../src') const rawPeer = require('./peer.json') describe('libp2p-ipfs-browser (websockets only)', () => { @@ -39,7 +39,7 @@ describe('libp2p-ipfs-browser (websockets only)', () => { PeerInfo.create((err, info) => { expect(err).to.not.exist info.multiaddr.add(multiaddr('/ip4/0.0.0.0/tcp/0')) - nodeA = new libp2p.Node(info) + nodeA = new Node(info) done() }) })