Skip to content

Commit

Permalink
Upgrade js-libp2p-daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
aknuds1 committed Jul 11, 2019
1 parent 4996f42 commit 42aa66b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
},
"homepage": "https://github.com/libp2p/interop#readme",
"devDependencies": {
"@arve.knudsen/libp2p-daemon": "^0.2.6",
"aegir": "^19.0.3",
"@arve.knudsen/libp2p-daemon": "^0.2.9",
"aegir": "^19.0.5",
"chai": "^4.2.0",
"chai-bytes": "~0.1.2",
"chai-checkmark": "^1.0.1",
"cross-env": "^5.2.0",
"dirty-chai": "^2.0.1",
"@arve.knudsen/go-libp2p-dep": "~0.2.2",
"go-libp2p-dep": "~0.1.0",
"libp2p-daemon-client": "~0.2.1",
"multiaddr": "^6.0.6",
"rimraf": "^2.6.3"
Expand Down
6 changes: 3 additions & 3 deletions src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('fs')
const path = require('path')
const rimraf = require('rimraf')

const Client = require('@arve.knudsen/libp2p-daemon-client')
const Client = require('libp2p-daemon-client')
const { getMultiaddr, isWindows } = require('./utils')

// process path
Expand All @@ -15,7 +15,7 @@ const processPath = process.cwd()
// go-libp2p defaults
const goDaemon = {
defaultAddr: getMultiaddr('/tmp/p2pd-go.sock'),
bin: path.join('@arve.knudsen/go-libp2p-dep', 'go-libp2p', isWindows ? 'p2pd.exe' : 'p2pd')
bin: path.join('go-libp2p-dep', 'go-libp2p', isWindows ? 'p2pd.exe' : 'p2pd')
}

// js-libp2p defaults
Expand Down Expand Up @@ -106,7 +106,7 @@ class Daemon {

// TODO refactor this once we daemon supports a json config
if (this._type === 'go') {
execOptions = ['-listen', addr, '-enableInlining=false']
execOptions = ['-listen', addr]

options.dht && execOptions.push('-dht')
options.pubsub && execOptions.push('-pubsub')
Expand Down
6 changes: 4 additions & 2 deletions test/connect/js2go.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const performTest = async (ctx, daemons) => {
ctx.timeout(10 * 1000)

const identifyJs = await daemons[0].client.identify()
const jsId = identifyJs.peerId.toB58String()
const identifyGo = await daemons[1].client.identify()
const goId = identifyGo.peerId.toB58String()

// verify connected peers
const knownPeersBeforeConnectJs = await daemons[0].client.listPeers()
Expand All @@ -49,11 +51,11 @@ const performTest = async (ctx, daemons) => {
// verify connected peers
const knownPeersAfterConnectJs = await daemons[0].client.listPeers()
expect(knownPeersAfterConnectJs).to.have.lengthOf(1)
expect(knownPeersAfterConnectJs[0].toB58String()).to.equal(identifyGo.peerId.toB58String())
expect(knownPeersAfterConnectJs[0].toB58String()).to.equal(goId)

const knownPeersAfterConnectGo = await daemons[1].client.listPeers()
expect(knownPeersAfterConnectGo).to.have.lengthOf(1)
expect(knownPeersAfterConnectGo[0].toB58String()).to.equal(identifyJs.peerId.toB58String())
expect(knownPeersAfterConnectGo[0].toB58String()).to.equal(jsId)
}

describe('connecting js peer to go peer', () => {
Expand Down

0 comments on commit 42aa66b

Please sign in to comment.