Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add js-libp2p-switch to the libp2p codebase #388

Merged
merged 697 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
697 commits
Select commit Hold shift + click to select a range
619c8e9
fix: remove unused protocol-buffers dep (#230)
dignifiedquire Sep 7, 2017
d08c919
chore: update contributors
daviddias Sep 7, 2017
251bdd5
chore: release version v0.32.2
daviddias Sep 7, 2017
dce497a
chore: update deps
daviddias Sep 7, 2017
1487cfe
chore: update contributors
daviddias Sep 7, 2017
114fd54
chore: release version v0.32.3
daviddias Sep 7, 2017
292e922
chore: update deps
daviddias Sep 10, 2017
6bd287c
fix: increase dial timeout
daviddias Sep 10, 2017
a2d1329
chore: update contributors
daviddias Sep 10, 2017
4208f24
chore: release version v0.32.4
daviddias Sep 10, 2017
30fb36f
feat: Circuit Relay (#224)
dryajov Oct 23, 2017
8578c82
chore: update deps
daviddias Oct 23, 2017
21ed197
chore: update contributors
daviddias Oct 23, 2017
3183025
chore: release version v0.33.0
daviddias Oct 23, 2017
94b00dd
fix: don't dial on relay if not enabled (#234)
dryajov Oct 27, 2017
bb4015f
chore: update deps
daviddias Oct 27, 2017
de56586
chore: fix package.json
daviddias Oct 27, 2017
89095ad
chore: update contributors
daviddias Oct 27, 2017
d257c61
chore: release version v0.33.1
daviddias Oct 27, 2017
661e75a
chore: update deps
daviddias Nov 12, 2017
f22ee2a
fix: don't dial circuit if no transports available (#236)
dryajov Nov 18, 2017
f8219e4
chore: update contributors
daviddias Nov 18, 2017
232f61f
chore: release version v0.33.2
daviddias Nov 18, 2017
77a4f61
fix: circuit dialing
dryajov Dec 14, 2017
3845085
chore: updating CI files (#238)
victorb Dec 14, 2017
8ea4ac0
chore: update contributors
daviddias Dec 14, 2017
541c4ba
chore: release version v0.34.0
daviddias Dec 14, 2017
75ba1c1
chore: use latest SECIO API
daviddias Jan 7, 2018
60b43b8
chore: update contributors
daviddias Jan 7, 2018
33c6db7
chore: release version v0.35.0
daviddias Jan 7, 2018
94d8be2
chore: update deps
daviddias Jan 28, 2018
3fb3c0e
chore: update contributors
daviddias Jan 28, 2018
5c0a1d4
chore: release version v0.35.1
daviddias Jan 28, 2018
e483e33
docs: update name references and API touches
daviddias Feb 6, 2018
0ecafd7
chore: update name references
daviddias Feb 6, 2018
43de7aa
refactor: update name to switch, make it a class and rename start and…
daviddias Feb 6, 2018
d559fa5
test: refactor tcp transport tests to avoid code duplication
daviddias Feb 6, 2018
a11b277
test: reuse same test code for Websockets, remove code duplication
daviddias Feb 6, 2018
a283588
test: update aegir pre and post hooks
daviddias Feb 6, 2018
19c3bce
chore: use pre-push instead
daviddias Feb 6, 2018
2c1184b
test: update and deduplicate code on stream muxing tests
daviddias Feb 6, 2018
e825f04
test: restructure test suits
daviddias Feb 6, 2018
9cde7c9
test: refactor swarm-no-muxing tests
daviddias Feb 6, 2018
d522f3a
test: refactor circuit-relay tests
daviddias Feb 6, 2018
5af5660
test: refactor browser tests too
daviddias Feb 6, 2018
e672e1a
style: fix linting
daviddias Feb 6, 2018
69ea434
fix: enableCircuitRelay is async and therefore needs a callback
daviddias Feb 6, 2018
ca610a5
fix: transports.add does not need to be async at all
daviddias Feb 6, 2018
ea84d97
docs: fix badges
daviddias Feb 6, 2018
9121dca
test: Linux does not like that we use multiple sockets with port 0
daviddias Feb 6, 2018
5573289
test: fix test
daviddias Feb 6, 2018
d416b3f
chore: update contributors
daviddias Feb 7, 2018
0b75bcd
chore: release version v0.36.0
daviddias Feb 7, 2018
fd232b8
chore: update deps
daviddias Feb 12, 2018
9d4bfd6
chore: update contributors
daviddias Feb 12, 2018
52967cd
chore: release version v0.36.1
daviddias Feb 12, 2018
0f0f314
feat: use mplex, update CI
daviddias Feb 19, 2018
613e30d
docs: typo
daviddias Feb 19, 2018
a4521dd
feat: observe traffic and expose statistics (#243)
pgte Feb 27, 2018
cf56511
chore: update deps
daviddias Feb 27, 2018
846c3c2
chore: update contributors
daviddias Feb 27, 2018
8b326a7
chore: release version v0.37.0
daviddias Feb 27, 2018
ae6b52e
fix: for when handler func is not defined
pgte Mar 9, 2018
6f98b0c
fix: for when peerinfo resolves to undefined
pgte Mar 12, 2018
439e6a2
chore: update contributors
daviddias Mar 12, 2018
e40d351
chore: release version v0.37.1
daviddias Mar 12, 2018
f45b4a7
chore: update deps
daviddias Mar 14, 2018
e57624d
chore: update contributors
daviddias Mar 14, 2018
93c558f
chore: release version v0.37.2
daviddias Mar 14, 2018
6265ec6
fix: one more observer edge case
pgte Mar 15, 2018
fc5a0c8
chore: update deps
daviddias Mar 15, 2018
a0c877e
chore: fix linting
daviddias Mar 15, 2018
085661f
test: fix transport tests before all step by increasing the timeout
daviddias Mar 15, 2018
9f5efce
chore: update contributors
daviddias Mar 15, 2018
b40ce97
chore: release version v0.37.3
daviddias Mar 15, 2018
7c60361
chore: update deps
harrshasri Apr 3, 2018
132d5df
fix: revert version back to the current release
daviddias Apr 3, 2018
c0eae1e
chore: update deps
daviddias Apr 4, 2018
b126249
chore: update deps
daviddias Apr 5, 2018
895e433
chore: update contributors
daviddias Apr 5, 2018
26c94f0
chore: update deps
daviddias Apr 5, 2018
55560c7
test: timeout
daviddias Apr 5, 2018
17285c4
chore: update contributors
daviddias Apr 5, 2018
97bb973
chore: release version v0.39.0
daviddias Apr 5, 2018
f505ee8
chore: update deps
daviddias Apr 30, 2018
1b7725e
chore: update contributors
daviddias Apr 30, 2018
4b739a2
chore: update deps
daviddias Apr 30, 2018
83a08b8
chore: update contributors
daviddias Apr 30, 2018
1f6b8f7
chore: release version v0.39.2
daviddias Apr 30, 2018
63ad87a
feat: improve circuit err messages (#250)
dryajov May 1, 2018
1166fb9
refactor: update files and add jsdocs to improve readability
jacobheun Apr 23, 2018
b5a2d38
test: add tests for get-peer-info
jacobheun Apr 27, 2018
30ed081
docs: remove answered todo comment
jacobheun Apr 30, 2018
71b6316
fix: dont create base conn when muxed exists
jacobheun Apr 30, 2018
350695c
fix: tests and conflicts
jacobheun May 1, 2018
aba7d1b
chore: update deps
daviddias May 1, 2018
3826d00
chore: update contributors
daviddias May 1, 2018
4c82bb5
chore: release version v0.40.0
daviddias May 1, 2018
36bc50b
test: fix require of multiplex
dryajov May 12, 2018
5cdec34
fix: libp2p/js-libp2p#189 Prevent self-dial
mkg20001 May 22, 2018
1f3a4eb
test: add selfdial test
mkg20001 May 22, 2018
ce8c43d
chore: add lead maintainer
jacobheun May 7, 2018
8749f2a
Merge tag 'v0.40.0' of https://github.com/libp2p/js-libp2p-switch
jacobheun May 23, 2018
d9f5738
chore: update contributors
jacobheun May 23, 2018
f126ad0
chore: update contributors
jacobheun May 23, 2018
4b60484
chore: release version v0.40.1
jacobheun May 23, 2018
fef2d11
fix: return on call to nextMuxer
alanshaw May 30, 2018
cb5245a
fix: drop connection when stream ends unexpectedly
olizilla May 30, 2018
1eb28ca
fix: add utility methods to prevent already piped error
jacobheun May 31, 2018
704e316
chore: update contributors
jacobheun May 31, 2018
bd24b23
chore: release version v0.40.2
jacobheun May 31, 2018
81d4394
fix: prevent undefined error during a mutual hangup
jacobheun May 29, 2018
4fce859
chore: update contributors
jacobheun Jun 1, 2018
6562463
chore: release version v0.40.3
jacobheun Jun 1, 2018
888e973
feat: swap quick-lru by hashlru
hugomrdias May 29, 2018
4963a67
chore: update contributors
jacobheun Jun 6, 2018
79344d2
chore: release version v0.40.4
jacobheun Jun 6, 2018
41210cf
fix: stats - observer expects protocolTag
kumavis Jul 9, 2018
c4ed449
fix: re-enable stats tests in node
dryajov Jul 9, 2018
43fe7d8
chore: Upgrade big.js to 5.1.2
antimatter15 Jul 9, 2018
fb90b68
chore: Change require('big.js') to require('big.js').Big
antimatter15 Jul 8, 2018
bdb598c
chore: update contributors
jacobheun Jul 10, 2018
e9b158d
chore: release version v0.40.5
jacobheun Jul 10, 2018
bff0a8b
fix: no stats on multistream proto dial
dryajov Jul 12, 2018
19d99d3
fix: adjust test values
dryajov Jul 12, 2018
c18e0bd
fix: handle error in protocol handshake
dryajov Jul 13, 2018
0fb1b8b
chore: update contributors
jacobheun Jul 17, 2018
cd794d7
chore: release version v0.40.6
jacobheun Jul 17, 2018
5ee5ac2
chore: remove travis and circleci
jacobheun Jul 17, 2018
b6600da
Add private network support (#266)
Jul 19, 2018
a62a72b
fix: improve erroring around invalid peers
jacobheun Jul 18, 2018
c469745
chore: update contributors
jacobheun Jul 23, 2018
aa7f2e8
chore: release version v0.40.7
jacobheun Jul 23, 2018
30310f8
test: add sample network circuit relay tests (#275)
jacobheun Aug 15, 2018
caf1958
chore: update deps
jacobheun Sep 7, 2018
b92fb35
chore: update contributors
jacobheun Sep 10, 2018
02145a6
chore: release version v0.40.8
jacobheun Sep 10, 2018
e3b4b42
chore: update mplex and stats test numbers
jacobheun Oct 2, 2018
7dcabdd
feat: make switch a state machine (#278)
jacobheun Oct 19, 2018
da942cb
chore: update contributors
jacobheun Oct 19, 2018
06fd7fc
chore: release version v0.41.0
jacobheun Oct 19, 2018
280d54f
fix: ignore dial request when one is in progress (#283)
jacobheun Oct 23, 2018
128d8e9
chore: update contributors
jacobheun Oct 24, 2018
fe84058
chore: release version v0.41.1
jacobheun Oct 24, 2018
e757cf6
fix: improve connection closing and error handling (#285)
jacobheun Nov 15, 2018
f406dd5
fix: dont dial an address that we have
jacobheun Nov 12, 2018
7697281
fix: ensure circuit listens last on start
jacobheun Nov 15, 2018
7a9e924
chore: update npm publish files
jacobheun Nov 15, 2018
62c2414
chore: update contributors
jacobheun Nov 15, 2018
823c776
chore: release version v0.41.2
jacobheun Nov 15, 2018
f43084b
fix: use retimer to avoid creating so many timers (#289)
mcollina Dec 13, 2018
aa86307
fix: improve connection tracking and closing (#291)
jacobheun Dec 14, 2018
78ab5ae
chore: update contributors
jacobheun Dec 14, 2018
1b445cf
chore: release version v0.41.3
jacobheun Dec 14, 2018
b29679d
refactor: stat use for over forEach (#295)
mcollina Dec 19, 2018
089835e
fix: avoid sync callback in async functions (#297)
jacobheun Dec 20, 2018
f65df95
chore: update contributors
jacobheun Dec 20, 2018
5b498a0
chore: release version v0.41.4
jacobheun Dec 20, 2018
b3a6a74
fix: peerBook undefined #299
jacobheun Jan 2, 2019
76e5d1d
fix: reduce bundle size (#292)
hugomrdias Jan 11, 2019
8525bee
chore: update contributors
jacobheun Jan 11, 2019
6fade87
chore: release version v0.41.5
jacobheun Jan 11, 2019
86e0a7a
fix: import async/setImmediate to avoid webpack errors (#303)
PiusNyakoojo Jan 28, 2019
d504040
test: add pull-mplex to test suite (#305)
jacobheun Feb 15, 2019
ddf622b
fix: dial in series until we have proper abort support (#306)
jacobheun Mar 5, 2019
ca78e3b
chore: update contributors
jacobheun Mar 6, 2019
33d49e9
chore: release version v0.41.6
jacobheun Mar 6, 2019
f731cdc
fix: peer disconnect event and improve logging performance (#309)
jacobheun Mar 12, 2019
c0c1009
chore: update contributors
jacobheun Mar 13, 2019
4216144
chore: release version v0.41.7
jacobheun Mar 13, 2019
6a94d9a
feat: add basic dial queue to avoid many connections to peer (#310)
jacobheun Mar 20, 2019
46e2509
feat: update identify to include supported protocols (#311)
jacobheun Mar 21, 2019
485ff7f
chore: update contributors
jacobheun Mar 21, 2019
45a86af
chore: release version v0.42.0
jacobheun Mar 21, 2019
16f2bc3
fix: ensure dials always use the latest PeerInfo from the PeerBook (#…
jacobheun Mar 21, 2019
ce0c76b
chore: update contributors
jacobheun Mar 21, 2019
b318e3f
chore: release version v0.42.1
jacobheun Mar 21, 2019
6437139
fix: identify on dial (#313)
jacobheun Mar 25, 2019
ad9a061
chore: update contributors
jacobheun Mar 25, 2019
1e23eb2
chore: release version v0.42.2
jacobheun Mar 25, 2019
20175dd
feat: global dial queue (#314)
jacobheun Mar 28, 2019
d4351db
chore: update contributors
jacobheun Mar 28, 2019
57146a0
chore: release version v0.42.3
jacobheun Mar 28, 2019
fcbcccc
fix: improve dial queue and parallel dials (#315)
jacobheun Mar 28, 2019
f7a8243
chore: update contributors
jacobheun Mar 28, 2019
d550b48
chore: release version v0.42.4
jacobheun Mar 28, 2019
4a543cb
feat: limit the number of cold calls we can do (#316)
jacobheun Apr 2, 2019
828e685
fix: improve connection tracking (#318)
jacobheun Apr 3, 2019
3e8114e
chore: update contributors
jacobheun Apr 3, 2019
0f05b9f
chore: release version v0.42.5
jacobheun Apr 3, 2019
f31663f
fix: dont blacklist good peers (#319)
jacobheun Apr 3, 2019
805d1ad
fix: revert to try each (#320)
Apr 3, 2019
014f4d0
chore: update contributors
jacobheun Apr 3, 2019
9592c22
chore: release version v0.42.6
jacobheun Apr 3, 2019
aeadc1b
fix: missing queue (#323)
Apr 3, 2019
5f9a4f6
fix: improve stopping logic (#324)
jacobheun Apr 4, 2019
eb910f6
chore: update contributors
jacobheun Apr 4, 2019
c7b1d05
chore: release version v0.42.7
jacobheun Apr 4, 2019
9584a4b
chore: add discourse badge (#327)
vasco-santos Apr 10, 2019
4862c48
fix: dial self (#329)
Apr 10, 2019
0357bf2
feat: support a priority queue for dials (#325)
jacobheun Apr 10, 2019
909d0d2
chore: update contributors
jacobheun Apr 10, 2019
866e5a6
chore: release version v0.42.8
jacobheun Apr 10, 2019
bb1a235
fix: dont compare empty strings (#330)
jacobheun Apr 11, 2019
b0a5054
chore: update contributors
jacobheun Apr 11, 2019
bf4d926
chore: release version v0.42.9
jacobheun Apr 11, 2019
951e0c9
fix: resolve transport sort order in browsers (#333)
jacobheun Apr 16, 2019
9af0e3a
fix: dont use peerinfo distinct (#334)
jacobheun Apr 16, 2019
15f1b26
chore: update contributors
jacobheun Apr 16, 2019
c73efba
chore: release version v0.42.10
jacobheun Apr 16, 2019
7aebb9c
fix(stats): prevent 0ms timeDiff breaking movingAverage (#336)
kumavis Apr 25, 2019
d02b808
chore: update contributors
jacobheun Apr 25, 2019
3ca691f
chore: release version v0.42.11
jacobheun Apr 25, 2019
f879cfc
fix: dont blindly add observed addresses to our list (#337)
jacobheun Apr 26, 2019
f306cba
fix: clear blacklist for peer when connection is established (#340)
jacobheun Jun 5, 2019
44a8690
chore: update contributors
jacobheun Jun 5, 2019
a386bb7
chore: release version v0.42.12
jacobheun Jun 5, 2019
2e71946
refactor: move switch into src/switch
jacobheun Jul 29, 2019
5670c42
chore: merge in switch to libp2p
jacobheun Jul 29, 2019
f5e6f74
refactor: cleanup switch and move tests into test dir
jacobheun Jul 29, 2019
9554b05
fix: make subscribe comply with ipfs interface (#389)
jacobheun Jul 30, 2019
48b1b44
docs: libp2p in browser example (#390)
jacobheun Jul 30, 2019
65d5285
test(fix): correct findProviders test for missing provider (#391)
jacobheun Jul 30, 2019
791f39a
feat: integrate gossipsub by default (#365)
vasco-santos Jul 31, 2019
2a2e7a1
chore: update contributors
jacobheun Jul 31, 2019
99a5359
chore: release version v0.26.0-rc.0
jacobheun Jul 31, 2019
dd48d26
chore: promisify pubsub start and stop (#392)
vasco-santos Jul 31, 2019
e8d8aab
chore: update contributors
jacobheun Jul 31, 2019
7c2c852
chore: release version v0.26.0-rc.1
jacobheun Jul 31, 2019
f4f3f0f
fix: pubsub default config (#393)
jacobheun Jul 31, 2019
f64c73b
refactor: blacklist to denylist (#341)
Aug 1, 2019
5ce0b36
chore: update deps and fix lint (#342)
jacobheun Aug 1, 2019
b479e3f
chore: update contributors
jacobheun Aug 1, 2019
9e5fadb
chore: release version v0.43.0
jacobheun Aug 1, 2019
3e95e6f
fix: dont override methods of created instance (#394)
jacobheun Aug 1, 2019
684f283
chore: update switch (#395)
jacobheun Aug 1, 2019
9fef58c
chore: update contributors
jacobheun Aug 1, 2019
9a8d609
chore: release version v0.26.0-rc.2
jacobheun Aug 1, 2019
ff7a6c8
fix: promisified methods (#398)
jacobheun Aug 6, 2019
a2b3446
docs: async migration (#397)
vasco-santos Aug 6, 2019
3f31b1f
chore: update contributors
jacobheun Aug 6, 2019
0489972
chore: release version v0.26.0-rc.3
jacobheun Aug 6, 2019
d5a977b
chore: update contributors
jacobheun Aug 7, 2019
d788433
chore: release version v0.26.0
jacobheun Aug 7, 2019
e79b606
chore: add swithc 0.43 updates
jacobheun Aug 8, 2019
c000781
refactor: add libp2p switch
jacobheun Aug 8, 2019
9968c51
refactor: correct dependencies and include switch tests
jacobheun Aug 8, 2019
0838dd7
test: add aegir steps for switch browser
jacobheun Aug 8, 2019
f3ee974
test: make transport manager test more performant
jacobheun Aug 8, 2019
7f0c050
chore: fix lint
jacobheun Aug 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 104 additions & 56 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
'use strict'

const pull = require('pull-stream')
const parallel = require('async/parallel')
const WebSocketStarRendezvous = require('libp2p-websocket-star-rendezvous')
const sigServer = require('libp2p-webrtc-star/src/sig-server')
const promisify = require('promisify-es6')
const mplex = require('pull-mplex')
const spdy = require('libp2p-spdy')
const PeerBook = require('peer-book')
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const path = require('path')
const Switch = require('libp2p-switch')
const WebSockets = require('libp2p-websockets')

const Node = require('./test/utils/bundle-nodejs.js')
const {
Expand All @@ -15,68 +23,108 @@ const {
let wrtcRendezvous
let wsRendezvous
let node
let peerInfo
let switchA
let switchB

const before = (done) => {
parallel([
(cb) => {
sigServer.start({
port: WRTC_RENDEZVOUS_MULTIADDR.nodeAddress().port
// cryptoChallenge: true TODO: needs https://github.com/libp2p/js-libp2p-webrtc-star/issues/128
})
.then(server => {
wrtcRendezvous = server
cb()
})
.catch(cb)
},
(cb) => {
WebSocketStarRendezvous.start({
port: WS_RENDEZVOUS_MULTIADDR.nodeAddress().port,
refreshPeerListIntervalMS: 1000,
strictMultiaddr: false,
cryptoChallenge: true
}, (err, _server) => {
if (err) {
return cb(err)
}
wsRendezvous = _server
cb()
function echo (protocol, conn) { pull(conn, conn) }
function idJSON (id) {
const p = path.join(__dirname, `./test/switch/test-data/id-${id}.json`)
return require(p)
}

function createSwitchA () {
return new Promise((resolve, reject) => {
PeerId.createFromJSON(idJSON(1), (err, id) => {
if (err) { return reject(err) }

const peerA = new PeerInfo(id)
const maA = '/ip4/127.0.0.1/tcp/15337/ws'

peerA.multiaddrs.add(maA)
const sw = new Switch(peerA, new PeerBook())

sw.transport.add('ws', new WebSockets())
sw.start((err) => {
if (err) { return reject(err) }
resolve(sw)
})
},
(cb) => {
getPeerRelay((err, peerInfo) => {
if (err) {
return done(err)
}
})
})
}

function createSwitchB () {
return new Promise((resolve, reject) => {
PeerId.createFromJSON(idJSON(2), (err, id) => {
if (err) { return reject(err) }

const peerB = new PeerInfo(id)
const maB = '/ip4/127.0.0.1/tcp/15347/ws'

node = new Node({
peerInfo,
config: {
relay: {
enabled: true,
hop: {
enabled: true,
active: true
}
}
}
})

node.handle('/echo/1.0.0', (protocol, conn) => pull(conn, conn))
node.start(cb)
peerB.multiaddrs.add(maB)
const sw = new Switch(peerB, new PeerBook())

sw.transport.add('ws', new WebSockets())
sw.connection.addStreamMuxer(mplex)
sw.connection.addStreamMuxer(spdy)
sw.connection.reuse()
sw.handle('/echo/1.0.0', echo)
sw.start((err) => {
if (err) { return reject(err) }
resolve(sw)
})
})
})
}

const before = async () => {
[
wrtcRendezvous,
wsRendezvous,
peerInfo,
switchA,
switchB
] = await Promise.all([
sigServer.start({
port: WRTC_RENDEZVOUS_MULTIADDR.nodeAddress().port
// cryptoChallenge: true TODO: needs https://github.com/libp2p/js-libp2p-webrtc-star/issues/128
}),
WebSocketStarRendezvous.start({
port: WS_RENDEZVOUS_MULTIADDR.nodeAddress().port,
refreshPeerListIntervalMS: 1000,
strictMultiaddr: false,
cryptoChallenge: true
}),
getPeerRelay(),
createSwitchA(),
createSwitchB()
])

node = new Node({
peerInfo,
config: {
relay: {
enabled: true,
hop: {
enabled: true,
active: true
}
}
}
], done)
})

node.handle('/echo/1.0.0', (protocol, conn) => pull(conn, conn))
await node.start()
}

const after = (done) => {
setTimeout(() =>
parallel([
(cb) => wrtcRendezvous.stop().then(cb).catch(cb),
...[node, wsRendezvous].map((s) => (cb) => s.stop(cb)),
], done),
2000
)
const after = () => {
return Promise.all([
wrtcRendezvous.stop(),
wsRendezvous.stop(),
node.stop(),
promisify(switchA.stop, { context: switchA })(),
promisify(switchB.stop, { context: switchB })()
])
}

module.exports = {
Expand Down
70 changes: 70 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
<a name="0.26.0"></a>
# [0.26.0](https://github.com/libp2p/js-libp2p/compare/v0.26.0-rc.3...v0.26.0) (2019-08-07)



<a name="0.26.0-rc.3"></a>
# [0.26.0-rc.3](https://github.com/libp2p/js-libp2p/compare/v0.26.0-rc.2...v0.26.0-rc.3) (2019-08-06)


### Bug Fixes

* promisified methods ([#398](https://github.com/libp2p/js-libp2p/issues/398)) ([ff7a6c8](https://github.com/libp2p/js-libp2p/commit/ff7a6c8))



<a name="0.26.0-rc.2"></a>
# [0.26.0-rc.2](https://github.com/libp2p/js-libp2p/compare/v0.26.0-rc.1...v0.26.0-rc.2) (2019-08-01)


### Bug Fixes

* dont override methods of created instance ([#394](https://github.com/libp2p/js-libp2p/issues/394)) ([3e95e6f](https://github.com/libp2p/js-libp2p/commit/3e95e6f))
* pubsub default config ([#393](https://github.com/libp2p/js-libp2p/issues/393)) ([f4f3f0f](https://github.com/libp2p/js-libp2p/commit/f4f3f0f))


### Chores

* update switch ([#395](https://github.com/libp2p/js-libp2p/issues/395)) ([684f283](https://github.com/libp2p/js-libp2p/commit/684f283))


### BREAKING CHANGES

* switch configuration has changed.
'blacklistTTL' is now 'denyTTL' and 'blackListAttempts' is now 'denyAttempts'



<a name="0.26.0-rc.1"></a>
# [0.26.0-rc.1](https://github.com/libp2p/js-libp2p/compare/v0.26.0-rc.0...v0.26.0-rc.1) (2019-07-31)



<a name="0.26.0-rc.0"></a>
# [0.26.0-rc.0](https://github.com/libp2p/js-libp2p/compare/v0.25.5...v0.26.0-rc.0) (2019-07-31)


### Bug Fixes

* make subscribe comply with ipfs interface ([#389](https://github.com/libp2p/js-libp2p/issues/389)) ([9554b05](https://github.com/libp2p/js-libp2p/commit/9554b05))


### Features

* integrate gossipsub by default ([#365](https://github.com/libp2p/js-libp2p/issues/365)) ([791f39a](https://github.com/libp2p/js-libp2p/commit/791f39a))
* promisify all api methods that accept callbacks ([#381](https://github.com/libp2p/js-libp2p/issues/381)) ([df6ef45](https://github.com/libp2p/js-libp2p/commit/df6ef45))


### BREAKING CHANGES

* new configuration for deciding the implementation of pubsub to be used.
In this context, the experimental flags were also removed. See the README for the latest usage.
* The ipfs interface specified that options
should be provided after the handler, not before.
https://github.com/ipfs/interface-js-ipfs-core/blob/v0.109.0/SPEC/PUBSUB.md#pubsubsubscribe

This corrects the order of parameters. See the jsdocs examples
for subscribe to see how it should be used.



<a name="0.25.5"></a>
## [0.25.5](https://github.com/libp2p/js-libp2p/compare/v0.25.4...v0.25.5) (2019-07-12)

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ npm install --save libp2p

## Usage

**IMPORTANT NOTE**: We are currently on the way of migrating all our `libp2p` modules to use `async await` and `async iterators`, instead of callbacks and `pull-streams`. As a consequence, when you start a new libp2p project, we must check which versions of the modules you should use. For now, it is required to use the modules using callbacks with `libp2p`, while we are working on getting the remaining modules ready for a full migration. For more details, you can have a look at [libp2p/js-libp2p#266](https://github.com/libp2p/js-libp2p/issues/266).

### [Tutorials and Examples](/examples)

You can find multiple examples on the [examples folder](/examples) that will guide you through using libp2p for several scenarios.
Expand All @@ -119,6 +121,7 @@ const MPLEX = require('libp2p-mplex')
const SECIO = require('libp2p-secio')
const MulticastDNS = require('libp2p-mdns')
const DHT = require('libp2p-kad-dht')
const GossipSub = require('libp2p-gossipsub')
const defaultsDeep = require('@nodeutils/defaults-deep')
const Protector = require('libp2p-pnet')
const DelegatedPeerRouter = require('libp2p-delegated-peer-routing')
Expand Down Expand Up @@ -154,7 +157,8 @@ class Node extends Libp2p {
peerDiscovery: [
MulticastDNS
],
dht: DHT // DHT enables PeerRouting, ContentRouting and DHT itself components
dht: DHT, // DHT enables PeerRouting, ContentRouting and DHT itself components
pubsub: GossipSub
},

// libp2p config options (typically found on a config.json)
Expand Down Expand Up @@ -187,9 +191,8 @@ class Node extends Libp2p {
timeout: 10e3
}
},
// Enable/Disable Experimental features
EXPERIMENTAL: { // Experimental features ("behind a flag")
pubsub: false
pubsub: {
enabled: true
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions examples/libp2p-in-the-browser/1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
},
"dependencies": {
"detect-dom-ready": "^1.0.2",
"libp2p": "../../../",
"libp2p-bootstrap": "~0.9.7",
"libp2p-gossipsub": "~0.0.4",
"libp2p-kad-dht": "^0.15.3",
"libp2p-mplex": "~0.8.5",
"libp2p-secio": "~0.11.1",
"libp2p-spdy": "~0.13.3",
Expand Down
19 changes: 10 additions & 9 deletions examples/libp2p-in-the-browser/1/src/browser-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const SPDY = require('libp2p-spdy')
const SECIO = require('libp2p-secio')
const Bootstrap = require('libp2p-bootstrap')
const DHT = require('libp2p-kad-dht')
const defaultsDeep = require('@nodeutils/defaults-deep')
const libp2p = require('../../../../')
const Gossipsub = require('libp2p-gossipsub')
const libp2p = require('libp2p')

// Find this list at: https://github.com/ipfs/js-ipfs/blob/master/src/core/runtime/config-browser.json
const bootstrapList = [
Expand All @@ -26,9 +26,9 @@ const bootstrapList = [
]

class Node extends libp2p {
constructor (_options) {
const wrtcStar = new WebRTCStar({ id: _options.peerInfo.id })
const wsstar = new WebSocketStar({ id: _options.peerInfo.id })
constructor ({ peerInfo }) {
const wrtcStar = new WebRTCStar({ id: peerInfo.id })
const wsstar = new WebSocketStar({ id: peerInfo.id })

const defaults = {
modules: {
Expand All @@ -49,7 +49,8 @@ class Node extends libp2p {
wsstar.discovery,
Bootstrap
],
dht: DHT
dht: DHT,
pubsub: Gossipsub
},
config: {
peerDiscovery: {
Expand All @@ -76,8 +77,8 @@ class Node extends libp2p {
dht: {
enabled: false
},
EXPERIMENTAL: {
pubsub: false
pubsub: {
enabled: false
}
},
connectionManager: {
Expand All @@ -86,7 +87,7 @@ class Node extends libp2p {
}
}

super(defaultsDeep(_options, defaults))
super({ ...defaults, peerInfo })
}
}

Expand Down
6 changes: 4 additions & 2 deletions examples/libp2p-in-the-browser/1/src/create-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ function createNode (callback) {
}

const peerIdStr = peerInfo.id.toB58String()
const ma = `/dns4/star-signal.cloud.ipfs.team/tcp/443/wss/p2p-webrtc-star/p2p/${peerIdStr}`
const webrtcAddr = `/dns4/star-signal.cloud.ipfs.team/tcp/443/wss/p2p-webrtc-star/p2p/${peerIdStr}`
const wsAddr = `/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star`

peerInfo.multiaddrs.add(ma)
peerInfo.multiaddrs.add(webrtcAddr)
peerInfo.multiaddrs.add(wsAddr)

const node = new Node({
peerInfo
Expand Down
3 changes: 3 additions & 0 deletions examples/libp2p-in-the-browser/1/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ domReady(() => {
myPeerDiv.append(idDiv)

console.log('Node is listening o/')
node.peerInfo.multiaddrs.toArray().forEach(ma => {
console.log(ma.toString())
})

// NOTE: to stop the node
// node.stop((err) => {})
Expand Down
2 changes: 0 additions & 2 deletions examples/libp2p-in-the-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ Then simply go into the folder [1](./1) and execute the following
> npm start
# open your browser in port :9090
```

[Version Published on IPFS](http://ipfs.io/ipfs/Qmbc1J7ehw1dNYachbkCWPto4RsnVvqCKNVzmYEod2gXcy)
Loading