Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed May 27, 2016
1 parent 3f9c2fa commit 1fdc93a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 28 deletions.
20 changes: 20 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'

const path = require('path')

module.exports = {
webpack: {
resolve: {
alias: {
'node-forge': path.resolve(
path.dirname(require.resolve('libp2p-crypto')),
'../vendor/forge.bundle.js'
)
}
},
externals: {
fs: '{}',
mkdirp: '{}'
}
}
}
30 changes: 8 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,24 @@
"glob": "^7.0.3",
"hapi": "^13.4.1",
"ipfs-api": "^4.1.0",
"ipfs-bitswap": "^0.2.1",
"ipfs-bitswap": "^0.3.1",
"ipfs-block": "^0.3.0",
"ipfs-block-service": "^0.4.0",
"ipfs-merkle-dag": "^0.6.0",
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.8.0",
"ipfs-unixfs-engine": "^0.8.0",
"joi": "^8.0.5",
"libp2p-ipfs": "^0.8.1",
"libp2p-ipfs-browser": "^0.7.0",
"libp2p-swarm": "^0.18.2",
"libp2p-ipfs": "^0.9.0",
"libp2p-ipfs-browser": "^0.8.0",
"libp2p-swarm": "^0.19.0",
"lodash.get": "^4.3.0",
"lodash.set": "^4.2.0",
"multiaddr": "^2.0.2",
"path-exists": "^3.0.0",
"peer-book": "^0.1.1",
"peer-id": "^0.6.7",
"peer-info": "^0.6.2",
"peer-book": "^0.3.0",
"peer-id": "^0.7.0",
"peer-info": "^0.7.0",
"promisify-es6": "^1.0.1",
"readable-stream": "1.1.13",
"ronin": "^0.3.11",
Expand All @@ -92,20 +92,6 @@
"run-waterfall": "^1.1.3",
"temp": "^0.8.3"
},
"aegir": {
"webpack": {
"resolve": {
"alias": {
"node-forge": "../../../node_modules/peer-id/vendor/forge.bundle.js",
"libp2p-ipfs": "libp2p-ipfs-browser"
}
},
"externals": {
"fs": "{}",
"mkdirp": "{}"
}
}
},
"contributors": [
"Andrew de Andrade <andrew@deandrade.com.br>",
"David Dias <daviddias.p@gmail.com>",
Expand All @@ -123,4 +109,4 @@
"kumavis <kumavis@users.noreply.github.com>",
"nginnever <ginneversource@gmail.com>"
]
}
}
2 changes: 1 addition & 1 deletion src/core/ipfs/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function id (self) {
function ready () {
callback(null, {
ID: self._peerInfo.id.toB58String(),
PublicKey: self._peerInfo.id.pubKey.toString('base64'),
PublicKey: self._peerInfo.id.pubKey.bytes.toString('base64'),
Addresses: self._peerInfo.multiaddrs.map((ma) => { return ma.toString() }).sort(),
AgentVersion: 'js-ipfs',
ProtocolVersion: '9000'
Expand Down
2 changes: 1 addition & 1 deletion src/core/ipfs/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function init (self) {
})
config.Identity = {
PeerID: keys.toB58String(),
PrivKey: keys.privKey.toString('base64')
PrivKey: keys.privKey.bytes.toString('base64')
}

writeVersion()
Expand Down
33 changes: 29 additions & 4 deletions test/core/both/test-bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const bs58 = require('bs58')
const bl = require('bl')
const API = require('ipfs-api')
const multiaddr = require('multiaddr')

const isNode = require('detect-node')
const IPFS = require('../../../src/core')

function makeBlock () {
Expand All @@ -20,10 +20,27 @@ function makeBlock () {

describe('bitswap', () => {
let ipfs
let configBak

beforeEach((done) => {
ipfs = new IPFS(require('../../utils/repo-path'))
ipfs.load(done)
if (!isNode) {
ipfs.config.show((err, config) => {
configBak = JSON.parse(JSON.stringify(config))
expect(err).to.not.exist
config.Addresses.Swarm = []
ipfs.config.replace(config, (err) => {
expect(err).to.not.exist
ipfs.load(done)
})
})
} else {
ipfs.load(done)
}
})

afterEach((done) => {
ipfs.config.replace(configBak, done)
})

describe('connections', () => {
Expand All @@ -36,9 +53,17 @@ describe('bitswap', () => {
return _.includes(addr.protoNames(), 'ws')
})[0]

let target = addr.encapsulate(multiaddr(`/ipfs/${res.ID}`)).toString()
let target
if (addr) {
target = addr.encapsulate(multiaddr(`/ipfs/${res.ID}`)).toString()
target = target.replace('0.0.0.0', '127.0.0.1')
} else {
// cause browser nodes don't have a websockets addrs
// TODO, what we really need is a way to dial to a peerId only
// and another to dial to peerInfo
target = multiaddr(`/ip4/0.0.0.0/tcp/0/ipfs/${res.ID}`).toString()
}

target = target.replace('0.0.0.0', '127.0.0.1')
const swarm = node2.libp2p ? node2.libp2p.swarm : node2.swarm
swarm.connect(target, done)
})
Expand Down

0 comments on commit 1fdc93a

Please sign in to comment.