Skip to content

Commit c4b6de1

Browse files
committed
notes
License: MIT Signed-off-by: David Dias <[email protected]>
1 parent 2c48724 commit c4b6de1

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

examples/level1-swarm/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Using libp2p-swarm
2+
==================
3+
4+

examples/using-swarm/node-1.js renamed to examples/level1-swarm/node-1.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ var mh = multiaddr('/ip4/127.0.0.1/tcp/8010')
1212
var p = new Peer(Id.create(), [])
1313
var sw = new Swarm(p)
1414

15-
sw.addTransport('tcp', tcp, {multiaddr: mh}, {}, {port: 8010}, function () {
16-
// Ready to receive incoming connections
15+
// create a libp2p node
1716

18-
sw.addStreamMuxer('spdy', Spdy, {})
17+
var node = new Libp2p(sw)
1918

20-
// create a libp2p node
19+
node.swarm.addTransport('tcp', tcp, {multiaddr: mh}, {}, {port: 8010}, function () {
20+
// Ready to receive incoming connections
2121

22-
var node = new Libp2p(sw)
22+
sw.addStreamMuxer('spdy', Spdy, {})
2323

2424
// dial to another node
2525

@@ -30,6 +30,8 @@ sw.addTransport('tcp', tcp, {multiaddr: mh}, {}, {port: 8010}, function () {
3030
if (err) {
3131
return console.error(err)
3232
}
33+
34+
console.log('-> connection is ready')
3335
process.stdin.pipe(conn).pipe(process.stdout)
3436
})
3537
})
File renamed without changes.

examples/using-swarm/README.md

Whitespace-only changes.

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
exports = module.exports = Libp2p
32

43
function Libp2p (swarm, peerRouting, recordStore) {

0 commit comments

Comments
 (0)