mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-18 10:01:59 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fdfc237780 | ||
|
83a09dbc0e | ||
|
b28eba067e | ||
|
b871bb0a1a | ||
|
14d3578eaf |
@@ -1,3 +1,8 @@
|
|||||||
|
<a name="0.18.0"></a>
|
||||||
|
# [0.18.0](https://github.com/libp2p/js-libp2p/compare/v0.17.0...v0.18.0) (2018-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.17.0"></a>
|
<a name="0.17.0"></a>
|
||||||
# [0.17.0](https://github.com/libp2p/js-libp2p/compare/v0.16.5...v0.17.0) (2018-02-16)
|
# [0.17.0](https://github.com/libp2p/js-libp2p/compare/v0.16.5...v0.17.0) (2018-02-16)
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ const WS = require('libp2p-websockets')
|
|||||||
const Railing = require('libp2p-railing')
|
const Railing = require('libp2p-railing')
|
||||||
const spdy = require('libp2p-spdy')
|
const spdy = require('libp2p-spdy')
|
||||||
const KadDHT = require('libp2p-kad-dht')
|
const KadDHT = require('libp2p-kad-dht')
|
||||||
const multiplex = require('libp2p-multiplex')
|
const mplex = require('libp2p-mplex')
|
||||||
const secio = require('libp2p-secio')
|
const secio = require('libp2p-secio')
|
||||||
const libp2p = require('../../..')
|
const libp2p = require('../../..')
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function mapMuxers (list) {
|
|||||||
}
|
}
|
||||||
switch (pref.trim().toLowerCase()) {
|
switch (pref.trim().toLowerCase()) {
|
||||||
case 'spdy': return spdy
|
case 'spdy': return spdy
|
||||||
case 'multiplex': return multiplex
|
case 'mplex': return mplex
|
||||||
default:
|
default:
|
||||||
throw new Error(pref + ' muxer not available')
|
throw new Error(pref + ' muxer not available')
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ function getMuxers (muxers) {
|
|||||||
} else if (muxers) {
|
} else if (muxers) {
|
||||||
return mapMuxers(muxers)
|
return mapMuxers(muxers)
|
||||||
} else {
|
} else {
|
||||||
return [multiplex, spdy]
|
return [mplex, spdy]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const libp2p = require('libp2p')
|
const libp2p = require('libp2p')
|
||||||
const TCP = require('libp2p-tcp')
|
const TCP = require('libp2p-tcp')
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
const PeerInfo = require('peer-info')
|
const PeerInfo = require('peer-info')
|
||||||
const Railing = require('libp2p-railing')
|
const Railing = require('libp2p-railing')
|
||||||
@@ -26,7 +26,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
discovery: [new Railing(bootstrapers)]
|
discovery: [new Railing(bootstrapers)]
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const libp2p = require('libp2p')
|
const libp2p = require('libp2p')
|
||||||
const TCP = require('libp2p-tcp')
|
const TCP = require('libp2p-tcp')
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
const PeerInfo = require('peer-info')
|
const PeerInfo = require('peer-info')
|
||||||
const MulticastDNS = require('libp2p-mdns')
|
const MulticastDNS = require('libp2p-mdns')
|
||||||
@@ -14,7 +14,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
discovery: [new MulticastDNS(peerInfo, { interval: 1000 })]
|
discovery: [new MulticastDNS(peerInfo, { interval: 1000 })]
|
||||||
|
@@ -8,7 +8,7 @@ These mechanisms save configuration and enable a node to operate without any exp
|
|||||||
|
|
||||||
## 1. Bootstrap list of Peers when booting a node
|
## 1. Bootstrap list of Peers when booting a node
|
||||||
|
|
||||||
For this demo, we will connect to IPFS default bootstrapper nodes and so, we will need to support the same set of features those nodes have, that are: TCP, multiplex and SECIO. You can see the complete example at [1.js](./1.js).
|
For this demo, we will connect to IPFS default bootstrapper nodes and so, we will need to support the same set of features those nodes have, that are: TCP, mplex and SECIO. You can see the complete example at [1.js](./1.js).
|
||||||
|
|
||||||
First, we create our libp2p bundle.
|
First, we create our libp2p bundle.
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
discovery: [new Railing(bootstrapers)]
|
discovery: [new Railing(bootstrapers)]
|
||||||
@@ -111,7 +111,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
// We set the interval here to 1 second so that is faster to observe. The
|
// We set the interval here to 1 second so that is faster to observe. The
|
||||||
|
@@ -6,7 +6,7 @@ const WS = require('libp2p-websockets')
|
|||||||
const Railing = require('libp2p-railing')
|
const Railing = require('libp2p-railing')
|
||||||
const spdy = require('libp2p-spdy')
|
const spdy = require('libp2p-spdy')
|
||||||
const KadDHT = require('libp2p-kad-dht')
|
const KadDHT = require('libp2p-kad-dht')
|
||||||
const multiplex = require('libp2p-multiplex')
|
const mplex = require('libp2p-mplex')
|
||||||
const secio = require('libp2p-secio')
|
const secio = require('libp2p-secio')
|
||||||
const libp2p = require('../../..')
|
const libp2p = require('../../..')
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function mapMuxers (list) {
|
|||||||
}
|
}
|
||||||
switch (pref.trim().toLowerCase()) {
|
switch (pref.trim().toLowerCase()) {
|
||||||
case 'spdy': return spdy
|
case 'spdy': return spdy
|
||||||
case 'multiplex': return multiplex
|
case 'mplex': return mplex
|
||||||
default:
|
default:
|
||||||
throw new Error(pref + ' muxer not available')
|
throw new Error(pref + ' muxer not available')
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ function getMuxers (muxers) {
|
|||||||
} else if (muxers) {
|
} else if (muxers) {
|
||||||
return mapMuxers(muxers)
|
return mapMuxers(muxers)
|
||||||
} else {
|
} else {
|
||||||
return [multiplex, spdy]
|
return [mplex, spdy]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"detect-dom-ready": "^1.0.2",
|
"detect-dom-ready": "^1.0.2",
|
||||||
"libp2p": "^0.13.0",
|
"libp2p": "^0.13.0",
|
||||||
"libp2p-multiplex": "^0.5.0",
|
"libp2p-mplex": "^0.6.0",
|
||||||
"libp2p-railing": "^0.7.1",
|
"libp2p-railing": "^0.7.1",
|
||||||
"libp2p-secio": "^0.8.1",
|
"libp2p-secio": "^0.8.1",
|
||||||
"libp2p-spdy": "^0.11.0",
|
"libp2p-spdy": "^0.11.0",
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
const WebRTCStar = require('libp2p-webrtc-star')
|
const WebRTCStar = require('libp2p-webrtc-star')
|
||||||
const WebSockets = require('libp2p-websockets')
|
const WebSockets = require('libp2p-websockets')
|
||||||
|
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SPDY = require('libp2p-spdy')
|
const SPDY = require('libp2p-spdy')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ class Node extends libp2p {
|
|||||||
],
|
],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [
|
muxer: [
|
||||||
Multiplex,
|
Mplex,
|
||||||
SPDY
|
SPDY
|
||||||
],
|
],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const libp2p = require('libp2p')
|
const libp2p = require('libp2p')
|
||||||
const TCP = require('libp2p-tcp')
|
const TCP = require('libp2p-tcp')
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
const PeerInfo = require('peer-info')
|
const PeerInfo = require('peer-info')
|
||||||
const KadDHT = require('libp2p-kad-dht')
|
const KadDHT = require('libp2p-kad-dht')
|
||||||
@@ -15,7 +15,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
// we add the DHT module that will enable Peer and Content Routing
|
// we add the DHT module that will enable Peer and Content Routing
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const libp2p = require('libp2p')
|
const libp2p = require('libp2p')
|
||||||
const TCP = require('libp2p-tcp')
|
const TCP = require('libp2p-tcp')
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
const PeerInfo = require('peer-info')
|
const PeerInfo = require('peer-info')
|
||||||
const CID = require('cids')
|
const CID = require('cids')
|
||||||
@@ -16,7 +16,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
// we add the DHT module that will enable Peer and Content Routing
|
// we add the DHT module that will enable Peer and Content Routing
|
||||||
|
@@ -18,7 +18,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
// we add the DHT module that will enable Peer and Content Routing
|
// we add the DHT module that will enable Peer and Content Routing
|
||||||
|
@@ -88,7 +88,7 @@ The example above would require a node to create a whole new connection for ever
|
|||||||
|
|
||||||
Stream multiplexing is a old concept, in fact it happens in many of the layers of the [OSI System](https://en.wikipedia.org/wiki/OSI_model), in libp2p we make this feature to our avail by letting the user pick which module for stream multiplexing to use.
|
Stream multiplexing is a old concept, in fact it happens in many of the layers of the [OSI System](https://en.wikipedia.org/wiki/OSI_model), in libp2p we make this feature to our avail by letting the user pick which module for stream multiplexing to use.
|
||||||
|
|
||||||
Currently, we have two available [libp2p-spdy](https://github.com/libp2p/js-libp2p-spdy) and [libp2p-multiplex](https://github.com/libp2p/js-libp2p-multiplex) and pluging them in is as easy as adding another transport. Let's revisit our libp2p bundle.
|
Currently, we have two available [libp2p-spdy](https://github.com/libp2p/js-libp2p-spdy) and [libp2p-mplex](https://github.com/libp2p/js-libp2p-mplex) and pluging them in is as easy as adding another transport. Let's revisit our libp2p bundle.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const SPDY = require('libp2p-spdy')
|
const SPDY = require('libp2p-spdy')
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const libp2p = require('libp2p')
|
const libp2p = require('libp2p')
|
||||||
const TCP = require('libp2p-tcp')
|
const TCP = require('libp2p-tcp')
|
||||||
const Multiplex = require('libp2p-multiplex')
|
const Mplex = require('libp2p-mplex')
|
||||||
const SECIO = require('libp2p-secio')
|
const SECIO = require('libp2p-secio')
|
||||||
const PeerInfo = require('peer-info')
|
const PeerInfo = require('peer-info')
|
||||||
const MulticastDNS = require('libp2p-mdns')
|
const MulticastDNS = require('libp2p-mdns')
|
||||||
@@ -15,7 +15,7 @@ class MyBundle extends libp2p {
|
|||||||
const modules = {
|
const modules = {
|
||||||
transport: [new TCP()],
|
transport: [new TCP()],
|
||||||
connection: {
|
connection: {
|
||||||
muxer: [Multiplex],
|
muxer: [Mplex],
|
||||||
crypto: [SECIO]
|
crypto: [SECIO]
|
||||||
},
|
},
|
||||||
discovery: [
|
discovery: [
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p",
|
"name": "libp2p",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"description": "JavaScript base class for libp2p bundles",
|
"description": "JavaScript base class for libp2p bundles",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"peer-info": "~0.11.6"
|
"peer-info": "~0.11.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^13.0.0",
|
"aegir": "^13.0.1",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"cids": "~0.5.2",
|
"cids": "~0.5.2",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"libp2p-circuit": "~0.1.4",
|
"libp2p-circuit": "~0.1.4",
|
||||||
"libp2p-kad-dht": "~0.8.0",
|
"libp2p-kad-dht": "~0.8.0",
|
||||||
"libp2p-mdns": "~0.9.2",
|
"libp2p-mdns": "~0.9.2",
|
||||||
"libp2p-multiplex": "~0.5.1",
|
"libp2p-mplex": "~0.6.0",
|
||||||
"libp2p-railing": "~0.7.1",
|
"libp2p-railing": "~0.7.1",
|
||||||
"libp2p-secio": "~0.9.2",
|
"libp2p-secio": "~0.9.2",
|
||||||
"libp2p-spdy": "~0.11.0",
|
"libp2p-spdy": "~0.11.0",
|
||||||
|
@@ -60,14 +60,14 @@ describe('stream muxing', () => {
|
|||||||
], done)
|
], done)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('multiplex only', (done) => {
|
it('mplex only', (done) => {
|
||||||
let nodeA
|
let nodeA
|
||||||
let nodeB
|
let nodeB
|
||||||
|
|
||||||
function setup (callback) {
|
function setup (callback) {
|
||||||
parallel([
|
parallel([
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['multiplex']
|
muxer: ['mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeA = node
|
nodeA = node
|
||||||
@@ -75,7 +75,7 @@ describe('stream muxing', () => {
|
|||||||
node.start(cb)
|
node.start(cb)
|
||||||
}),
|
}),
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['multiplex']
|
muxer: ['mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeB = node
|
nodeB = node
|
||||||
@@ -92,7 +92,7 @@ describe('stream muxing', () => {
|
|||||||
], done)
|
], done)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('spdy + multiplex', function (done) {
|
it('spdy + mplex', function (done) {
|
||||||
this.timeout(5000)
|
this.timeout(5000)
|
||||||
|
|
||||||
let nodeA
|
let nodeA
|
||||||
@@ -101,7 +101,7 @@ describe('stream muxing', () => {
|
|||||||
function setup (callback) {
|
function setup (callback) {
|
||||||
parallel([
|
parallel([
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['spdy', 'multiplex']
|
muxer: ['spdy', 'mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeA = node
|
nodeA = node
|
||||||
@@ -109,7 +109,7 @@ describe('stream muxing', () => {
|
|||||||
node.start(cb)
|
node.start(cb)
|
||||||
}),
|
}),
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['spdy', 'multiplex']
|
muxer: ['spdy', 'mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeB = node
|
nodeB = node
|
||||||
@@ -126,7 +126,7 @@ describe('stream muxing', () => {
|
|||||||
], done)
|
], done)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('spdy + multiplex switched order', function (done) {
|
it('spdy + mplex switched order', function (done) {
|
||||||
this.timeout(5 * 1000)
|
this.timeout(5 * 1000)
|
||||||
|
|
||||||
let nodeA
|
let nodeA
|
||||||
@@ -135,7 +135,7 @@ describe('stream muxing', () => {
|
|||||||
function setup (callback) {
|
function setup (callback) {
|
||||||
parallel([
|
parallel([
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['spdy', 'multiplex']
|
muxer: ['spdy', 'mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeA = node
|
nodeA = node
|
||||||
@@ -143,7 +143,7 @@ describe('stream muxing', () => {
|
|||||||
node.start(cb)
|
node.start(cb)
|
||||||
}),
|
}),
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['multiplex', 'spdy']
|
muxer: ['mplex', 'spdy']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeB = node
|
nodeB = node
|
||||||
@@ -177,7 +177,7 @@ describe('stream muxing', () => {
|
|||||||
node.start(cb)
|
node.start(cb)
|
||||||
}),
|
}),
|
||||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||||
muxer: ['multiplex']
|
muxer: ['mplex']
|
||||||
}, (err, node) => {
|
}, (err, node) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
nodeB = node
|
nodeB = node
|
||||||
|
@@ -48,12 +48,12 @@ describe('transports', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('create libp2pNode with multiplex only', (done) => {
|
it('create libp2pNode with mplex only', (done) => {
|
||||||
PeerInfo.create((err, peerInfo) => {
|
PeerInfo.create((err, peerInfo) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
|
|
||||||
const b = new Node(peerInfo, null, { muxer: ['multiplex'] })
|
const b = new Node(peerInfo, null, { muxer: ['mplex'] })
|
||||||
expect(b.modules.connection.muxer).to.eql([require('libp2p-multiplex')])
|
expect(b.modules.connection.muxer).to.eql([require('libp2p-mplex')])
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@@ -4,7 +4,7 @@ const WS = require('libp2p-websockets')
|
|||||||
const WebRTCStar = require('libp2p-webrtc-star')
|
const WebRTCStar = require('libp2p-webrtc-star')
|
||||||
const WebSocketStar = require('libp2p-websocket-star')
|
const WebSocketStar = require('libp2p-websocket-star')
|
||||||
const spdy = require('libp2p-spdy')
|
const spdy = require('libp2p-spdy')
|
||||||
const multiplex = require('libp2p-multiplex')
|
const mplex = require('libp2p-mplex')
|
||||||
const secio = require('libp2p-secio')
|
const secio = require('libp2p-secio')
|
||||||
const Railing = require('libp2p-railing')
|
const Railing = require('libp2p-railing')
|
||||||
const libp2p = require('../..')
|
const libp2p = require('../..')
|
||||||
@@ -17,8 +17,8 @@ function mapMuxers (list) {
|
|||||||
switch (pref.trim().toLowerCase()) {
|
switch (pref.trim().toLowerCase()) {
|
||||||
case 'spdy':
|
case 'spdy':
|
||||||
return spdy
|
return spdy
|
||||||
case 'multiplex':
|
case 'mplex':
|
||||||
return multiplex
|
return mplex
|
||||||
default:
|
default:
|
||||||
throw new Error(pref + ' muxer not available')
|
throw new Error(pref + ' muxer not available')
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ function getMuxers (options) {
|
|||||||
if (options) {
|
if (options) {
|
||||||
return mapMuxers(options)
|
return mapMuxers(options)
|
||||||
} else {
|
} else {
|
||||||
return [multiplex, spdy]
|
return [mplex, spdy]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ const WS = require('libp2p-websockets')
|
|||||||
const Railing = require('libp2p-railing')
|
const Railing = require('libp2p-railing')
|
||||||
const spdy = require('libp2p-spdy')
|
const spdy = require('libp2p-spdy')
|
||||||
const KadDHT = require('libp2p-kad-dht')
|
const KadDHT = require('libp2p-kad-dht')
|
||||||
const multiplex = require('libp2p-multiplex')
|
const mplex = require('libp2p-mplex')
|
||||||
const secio = require('libp2p-secio')
|
const secio = require('libp2p-secio')
|
||||||
const libp2p = require('../..')
|
const libp2p = require('../..')
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function mapMuxers (list) {
|
|||||||
}
|
}
|
||||||
switch (pref.trim().toLowerCase()) {
|
switch (pref.trim().toLowerCase()) {
|
||||||
case 'spdy': return spdy
|
case 'spdy': return spdy
|
||||||
case 'multiplex': return multiplex
|
case 'mplex': return mplex
|
||||||
default:
|
default:
|
||||||
throw new Error(pref + ' muxer not available')
|
throw new Error(pref + ' muxer not available')
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ function getMuxers (muxers) {
|
|||||||
} else if (muxers) {
|
} else if (muxers) {
|
||||||
return mapMuxers(muxers)
|
return mapMuxers(muxers)
|
||||||
} else {
|
} else {
|
||||||
return [multiplex, spdy]
|
return [mplex, spdy]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user