From 019cd4715d7987c68e69ec0f0dfec52c22b5b71e Mon Sep 17 00:00:00 2001 From: Chris Bratlien Date: Tue, 11 Jul 2017 01:39:57 -0500 Subject: [PATCH] docs(examples): fix dial function name and multiaddr variable name in echo and chat dialer/listener examples (#109) --- examples/chat/src/dialer.js | 6 +++--- examples/chat/src/libp2p-bundle.js | 2 +- examples/chat/src/listener.js | 2 +- examples/echo/src/dialer.js | 6 +++--- examples/echo/src/listener.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/chat/src/dialer.js b/examples/chat/src/dialer.js index fe592a0fe6..25116b8ab1 100644 --- a/examples/chat/src/dialer.js +++ b/examples/chat/src/dialer.js @@ -30,12 +30,12 @@ async.parallel([ ], (err, ids) => { if (err) throw err const peerDialer = new PeerInfo(ids[0]) - peerDialer.multiaddr.add('/ip4/0.0.0.0/tcp/0') + peerDialer.multiaddrs.add('/ip4/0.0.0.0/tcp/0') const nodeDialer = new Node(peerDialer) const peerListener = new PeerInfo(ids[1]) idListener = ids[1] - peerListener.multiaddr.add('/ip4/127.0.0.1/tcp/10333') + peerListener.multiaddrs.add('/ip4/127.0.0.1/tcp/10333') nodeDialer.start((err) => { if (err) { throw err @@ -47,7 +47,7 @@ async.parallel([ console.log(ma.toString() + '/ipfs/' + idListener.toB58String()) }) - nodeDialer.dialByPeerInfo(peerListener, '/chat/1.0.0', (err, conn) => { + nodeDialer.dial(peerListener, '/chat/1.0.0', (err, conn) => { if (err) { throw err } diff --git a/examples/chat/src/libp2p-bundle.js b/examples/chat/src/libp2p-bundle.js index 5d67075210..053a571964 100644 --- a/examples/chat/src/libp2p-bundle.js +++ b/examples/chat/src/libp2p-bundle.js @@ -8,7 +8,7 @@ const spdy = require('libp2p-spdy') const KadDHT = require('libp2p-kad-dht') const multiplex = require('libp2p-multiplex') const secio = require('libp2p-secio') -const libp2p = require('../..') +const libp2p = require('../../..') function mapMuxers (list) { return list.map((pref) => { diff --git a/examples/chat/src/listener.js b/examples/chat/src/listener.js index a983bee0ce..4a742f3d12 100644 --- a/examples/chat/src/listener.js +++ b/examples/chat/src/listener.js @@ -13,7 +13,7 @@ PeerId.createFromJSON(require('./peer-id-listener'), (err, idListener) => { throw err } const peerListener = new PeerInfo(idListener) - peerListener.multiaddr.add('/ip4/0.0.0.0/tcp/10333') + peerListener.multiaddrs.add('/ip4/0.0.0.0/tcp/10333') const nodeListener = new Node(peerListener) nodeListener.start((err) => { diff --git a/examples/echo/src/dialer.js b/examples/echo/src/dialer.js index 75476ab621..82d61e19b7 100644 --- a/examples/echo/src/dialer.js +++ b/examples/echo/src/dialer.js @@ -20,7 +20,7 @@ async.parallel([ // Dialer const dialerId = ids[0] const dialerPeerInfo = new PeerInfo(dialerId) - dialerPeerInfo.multiaddr.add('/ip4/0.0.0.0/tcp/0') + dialerPeerInfo.multiaddrs.add('/ip4/0.0.0.0/tcp/0') const dialerNode = new Node(dialerPeerInfo) // Peer to Dial @@ -28,7 +28,7 @@ async.parallel([ const listenerId = ids[1] const listenerMultiaddr = '/ip4/127.0.0.1/tcp/10333/ipfs/' + listenerId.toB58String() - listenerPeerInfo.multiaddr.add(listenerMultiaddr) + listenerPeerInfo.multiaddrs.add(listenerMultiaddr) dialerNode.start((err) => { if (err) { throw err } @@ -38,7 +38,7 @@ async.parallel([ '/ipfs/' + dialerId.toB58String())) console.log('Dialing to peer:', listenerMultiaddr.toString()) - dialerNode.dialByPeerInfo(listenerPeerInfo, '/echo/1.0.0', (err, conn) => { + dialerNode.dial(listenerPeerInfo, '/echo/1.0.0', (err, conn) => { if (err) { throw err } console.log('nodeA dialed to nodeB on protocol: /echo/1.0.0') diff --git a/examples/echo/src/listener.js b/examples/echo/src/listener.js index 611f25815c..a199a7f9d1 100644 --- a/examples/echo/src/listener.js +++ b/examples/echo/src/listener.js @@ -24,7 +24,7 @@ series([ }, (cb) => { const listenerPeerInfo = new PeerInfo(listenerId) - listenerPeerInfo.multiaddr.add('/ip4/0.0.0.0/tcp/10333') + listenerPeerInfo.multiaddrs.add('/ip4/0.0.0.0/tcp/10333') listenerNode = new Node(listenerPeerInfo) listenerNode.swarm.on('peer-mux-established', (peerInfo) => {