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

Commit a2529fb

Browse files
committed
update deps
1 parent 3f9c2fa commit a2529fb

File tree

5 files changed

+61
-28
lines changed

5 files changed

+61
-28
lines changed

.aegir.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict'
2+
3+
const path = require('path')
4+
5+
module.exports = {
6+
webpack: {
7+
resolve: {
8+
alias: {
9+
'node-forge': path.resolve(
10+
path.dirname(require.resolve('libp2p-crypto')),
11+
'../vendor/forge.bundle.js'
12+
)
13+
}
14+
},
15+
externals: {
16+
fs: '{}',
17+
mkdirp: '{}'
18+
}
19+
}
20+
}

package.json

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@
6565
"glob": "^7.0.3",
6666
"hapi": "^13.4.1",
6767
"ipfs-api": "^4.1.0",
68-
"ipfs-bitswap": "^0.2.1",
68+
"ipfs-bitswap": "^0.3.1",
6969
"ipfs-block": "^0.3.0",
7070
"ipfs-block-service": "^0.4.0",
7171
"ipfs-merkle-dag": "^0.6.0",
7272
"ipfs-multipart": "^0.1.0",
7373
"ipfs-repo": "^0.8.0",
7474
"ipfs-unixfs-engine": "^0.8.0",
7575
"joi": "^8.0.5",
76-
"libp2p-ipfs": "^0.8.1",
77-
"libp2p-ipfs-browser": "^0.7.0",
78-
"libp2p-swarm": "^0.18.2",
76+
"libp2p-ipfs": "^0.9.0",
77+
"libp2p-ipfs-browser": "^0.8.0",
78+
"libp2p-swarm": "^0.19.0",
7979
"lodash.get": "^4.3.0",
8080
"lodash.set": "^4.2.0",
8181
"multiaddr": "^2.0.2",
8282
"path-exists": "^3.0.0",
83-
"peer-book": "^0.1.1",
84-
"peer-id": "^0.6.7",
85-
"peer-info": "^0.6.2",
83+
"peer-book": "^0.3.0",
84+
"peer-id": "^0.7.0",
85+
"peer-info": "^0.7.0",
8686
"promisify-es6": "^1.0.1",
8787
"readable-stream": "1.1.13",
8888
"ronin": "^0.3.11",
@@ -92,20 +92,6 @@
9292
"run-waterfall": "^1.1.3",
9393
"temp": "^0.8.3"
9494
},
95-
"aegir": {
96-
"webpack": {
97-
"resolve": {
98-
"alias": {
99-
"node-forge": "../../../node_modules/peer-id/vendor/forge.bundle.js",
100-
"libp2p-ipfs": "libp2p-ipfs-browser"
101-
}
102-
},
103-
"externals": {
104-
"fs": "{}",
105-
"mkdirp": "{}"
106-
}
107-
}
108-
},
10995
"contributors": [
11096
"Andrew de Andrade <[email protected]>",
11197
"David Dias <[email protected]>",
@@ -123,4 +109,4 @@
123109
"kumavis <[email protected]>",
124110
"nginnever <[email protected]>"
125111
]
126-
}
112+
}

src/core/ipfs/id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = function id (self) {
1515
function ready () {
1616
callback(null, {
1717
ID: self._peerInfo.id.toB58String(),
18-
PublicKey: self._peerInfo.id.pubKey.toString('base64'),
18+
PublicKey: self._peerInfo.id.pubKey.bytes.toString('base64'),
1919
Addresses: self._peerInfo.multiaddrs.map((ma) => { return ma.toString() }).sort(),
2020
AgentVersion: 'js-ipfs',
2121
ProtocolVersion: '9000'

src/core/ipfs/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function init (self) {
3939
})
4040
config.Identity = {
4141
PeerID: keys.toB58String(),
42-
PrivKey: keys.privKey.toString('base64')
42+
PrivKey: keys.privKey.bytes.toString('base64')
4343
}
4444

4545
writeVersion()

test/core/both/test-bitswap.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const bs58 = require('bs58')
1111
const bl = require('bl')
1212
const API = require('ipfs-api')
1313
const multiaddr = require('multiaddr')
14-
14+
const isNode = require('detect-node')
1515
const IPFS = require('../../../src/core')
1616

1717
function makeBlock () {
@@ -20,10 +20,29 @@ function makeBlock () {
2020

2121
describe('bitswap', () => {
2222
let ipfs
23+
let configBak
2324

2425
beforeEach((done) => {
2526
ipfs = new IPFS(require('../../utils/repo-path'))
26-
ipfs.load(done)
27+
if (!isNode) {
28+
ipfs.config.show((err, config) => {
29+
configBak = JSON.parse(JSON.stringify(config))
30+
expect(err).to.not.exist
31+
config.Addresses.Swarm = []
32+
ipfs.config.replace(config, (err) => {
33+
expect(err).to.not.exist
34+
ipfs.load(done)
35+
})
36+
})
37+
} else {
38+
ipfs.load(done)
39+
}
40+
})
41+
42+
afterEach((done) => {
43+
if (!isNode) {
44+
ipfs.config.replace(configBak, done)
45+
}
2746
})
2847

2948
describe('connections', () => {
@@ -36,9 +55,17 @@ describe('bitswap', () => {
3655
return _.includes(addr.protoNames(), 'ws')
3756
})[0]
3857

39-
let target = addr.encapsulate(multiaddr(`/ipfs/${res.ID}`)).toString()
58+
let target
59+
if (addr) {
60+
target = addr.encapsulate(multiaddr(`/ipfs/${res.ID}`)).toString()
61+
target = target.replace('0.0.0.0', '127.0.0.1')
62+
} else {
63+
// cause browser nodes don't have a websockets addrs
64+
// TODO, what we really need is a way to dial to a peerId only
65+
// and another to dial to peerInfo
66+
target = multiaddr(`/ip4/0.0.0.0/tcp/0/ipfs/${res.ID}`).toString()
67+
}
4068

41-
target = target.replace('0.0.0.0', '127.0.0.1')
4269
const swarm = node2.libp2p ? node2.libp2p.swarm : node2.swarm
4370
swarm.connect(target, done)
4471
})

0 commit comments

Comments
 (0)