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

Commit 9aef6b7

Browse files
dryajovdaviddias
authored andcommitted
feat: enable circuit relay
1 parent b92bdfe commit 9aef6b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+649
-226
lines changed

.aegir.js

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,71 @@
11
'use strict'
22

3+
const parallel = require('async/parallel')
4+
5+
const spawnJsNode = require('./test/utils/spawn-tools').spawnJsNode
6+
const spawnGoNode = require('./test/utils/spawn-tools').spawnGoNode
7+
const stopNodes = require('./test/utils/spawn-tools').stopNodes
8+
9+
/*
10+
* spawns a daemon with ports numbers starting in 10 and ending in `num`
11+
*/
12+
const before = (done) => {
13+
parallel([
14+
(cb) => spawnJsNode([
15+
`/ip4/127.0.0.1/tcp/10007`,
16+
`/ip4/127.0.0.1/tcp/20007/ws`
17+
], true, 31007, 32007, cb),
18+
(cb) => spawnJsNode([
19+
`/ip4/127.0.0.1/tcp/10008`,
20+
`/ip4/127.0.0.1/tcp/20008/ws`
21+
], true, 31008, 32008, cb),
22+
(cb) => spawnJsNode([
23+
`/ip4/127.0.0.1/tcp/10012`,
24+
`/ip4/127.0.0.1/tcp/20012/ws`
25+
], true, 31012, 32012, cb),
26+
(cb) => spawnJsNode([
27+
`/ip4/127.0.0.1/tcp/10013`,
28+
`/ip4/127.0.0.1/tcp/20013/ws`
29+
], true, 31013, 32013, cb),
30+
(cb) => spawnJsNode([
31+
`/ip4/127.0.0.1/tcp/10014`,
32+
`/ip4/127.0.0.1/tcp/20014/ws`
33+
], true, 31014, 32014, cb),
34+
(cb) => spawnJsNode([
35+
`/ip4/127.0.0.1/tcp/10015`,
36+
`/ip4/127.0.0.1/tcp/20015/ws`
37+
], true, 31015, 32015, cb),
38+
(cb) => spawnGoNode([
39+
`/ip4/127.0.0.1/tcp/10027`,
40+
`/ip4/127.0.0.1/tcp/20027/ws`
41+
], true, 33027, 44027, cb),
42+
(cb) => spawnGoNode([
43+
`/ip4/127.0.0.1/tcp/10028`,
44+
`/ip4/127.0.0.1/tcp/20028/ws`
45+
], true, 33028, 44028, cb),
46+
(cb) => spawnGoNode([
47+
`/ip4/127.0.0.1/tcp/10031`,
48+
`/ip4/127.0.0.1/tcp/20031/ws`
49+
], true, 33031, 44031, cb),
50+
(cb) => spawnGoNode([
51+
`/ip4/127.0.0.1/tcp/10032`,
52+
`/ip4/127.0.0.1/tcp/20032/ws`
53+
], true, 33032, 44032, cb)
54+
], done)
55+
}
56+
357
module.exports = {
458
karma: {
559
files: [{
660
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
761
watched: false,
862
served: true,
9-
included: false
63+
included: false,
64+
singleRun: false
1065
}]
66+
},
67+
hooks: {
68+
pre: before,
69+
post: stopNodes
1170
}
1271
}

examples/exchange-files-in-browser/public/js/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function start () {
3333
if (!node) {
3434
updateView('starting', node)
3535

36-
node = new self.Ipfs({repo: 'ipfs-' + Math.random()})
36+
node = new self.Ipfs({ repo: 'ipfs-' + Math.random() })
3737

3838
node.on('start', () => {
3939
node.id().then((id) => {
@@ -55,7 +55,7 @@ function stop () {
5555
*/
5656

5757
function createFileBlob (data, multihash) {
58-
const file = new window.Blob(data, {type: 'application/octet-binary'})
58+
const file = new window.Blob(data, { type: 'application/octet-binary' })
5959
const fileUrl = window.URL.createObjectURL(file)
6060

6161
const listItem = document.createElement('div')
@@ -151,7 +151,7 @@ function onDrop (event) {
151151

152152
let myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({
153153
// frequency: 10, // in milliseconds.
154-
chunkSize: 32048 // in bytes.
154+
chunkSize: 32048 // in bytes.
155155
})
156156

157157
node.files.createAddStream((err, stream) => {
@@ -200,8 +200,8 @@ function onDrop (event) {
200200
if (files && files.length) {
201201
$multihashInput.value = files[0].hash
202202
$filesStatus.innerHTML = files
203-
.map((e) => `Added ${e.path} as ${e.hash}`)
204-
.join('<br>')
203+
.map((e) => `Added ${e.path} as ${e.hash}`)
204+
.join('<br>')
205205
}
206206
})
207207
.catch(onError)

examples/traverse-ipld-graphs/get-path-accross-formats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ createNode((err, ipfs) => {
1616

1717
series([
1818
(cb) => {
19-
const someData = new Buffer('capoeira')
19+
const someData = Buffer.from('capoeira')
2020

2121
dagPB.DAGNode.create(someData, (err, node) => {
2222
if (err) {

examples/traverse-ipld-graphs/tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ createNode((err, ipfs) => {
1616

1717
series([
1818
(cb) => {
19-
const someData = new Buffer('capoeira')
19+
const someData = Buffer.from('capoeira')
2020

2121
dagPB.DAGNode.create(someData, (err, node) => {
2222
if (err) {

gulpfile.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

package.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@
1919
"npm": ">=3.0.0"
2020
},
2121
"scripts": {
22-
"lint": "aegir-lint",
23-
"coverage": "gulp coverage",
24-
"test": "gulp test --dom",
25-
"test:node": "npm run test:unit:node",
26-
"test:browser": "npm run test:unit:browser",
27-
"test:unit:node": "gulp test:node",
28-
"test:unit:node:core": "TEST=core npm run test:unit:node",
29-
"test:unit:node:http": "TEST=http npm run test:unit:node",
30-
"test:unit:node:gateway": "TEST=gateway npm run test:unit:node",
31-
"test:unit:node:cli": "TEST=cli npm run test:unit:node",
32-
"test:unit:browser": "gulp test:browser",
22+
"lint": "aegir lint",
23+
"build": "aegir build",
24+
"test": "aegir test --target node --target browser --no-cors",
25+
"test:node": "aegir test --target node",
26+
"test:browser": "aegir test --target browser --target webworker --no-cors",
27+
"release": "aegir release --target node --target browser",
28+
"release-minor": "aegir release --type minor --target node --target browser",
29+
"release-major": "aegir release --type major --target node --target browser",
30+
"coverage": "aegir coverage",
31+
"test:unit:node": "aegir test --target node",
32+
"test:unit:node:core": "aegir test --target node -f test/core/*.js",
33+
"test:unit:node:http": "aegir test --target node -f test/http-api/index.js",
34+
"test:unit:node:gateway": "aegir test --target node -f test/gateway/index.js",
35+
"test:unit:node:cli": "aegir test --target node -f test/cli/index.js",
36+
"test:unit:browser": "aegir test --target browser --no-cors",
3337
"test:interop": "npm run test:interop:node",
3438
"test:interop:node": "mocha -t 60000 test/interop/node.js",
3539
"test:interop:browser": "mocha -t 60000 test/interop/browser.js",
@@ -38,10 +42,6 @@
3842
"test:benchmark:node:core": "echo \"Error: no benchmarks yet\" && exit 1",
3943
"test:benchmark:node:http": "echo \"Error: no benchmarks yet\" && exit 1",
4044
"test:benchmark:browser": "echo \"Error: no benchmarks yet\" && exit 1",
41-
"build": "gulp build",
42-
"release": "gulp release",
43-
"release-minor": "gulp release --type minor",
44-
"release-major": "gulp release --type major",
4545
"coverage-publish": "aegir-coverage publish"
4646
},
4747
"pre-commit": [
@@ -62,7 +62,7 @@
6262
},
6363
"homepage": "https://github.com/ipfs/js-ipfs#readme",
6464
"devDependencies": {
65-
"aegir": "^11.0.2",
65+
"aegir": "^12.1.3",
6666
"buffer-loader": "0.0.1",
6767
"chai": "^4.1.2",
6868
"delay": "^2.0.0",
@@ -74,7 +74,7 @@
7474
"expose-loader": "^0.7.3",
7575
"form-data": "^2.3.1",
7676
"gulp": "^3.9.1",
77-
"interface-ipfs-core": "~0.32.1",
77+
"interface-ipfs-core": "~0.33.1",
7878
"ipfsd-ctl": "~0.24.0",
7979
"left-pad": "^1.1.3",
8080
"lodash": "^4.17.4",
@@ -109,14 +109,15 @@
109109
"ipfs-block": "~0.6.0",
110110
"ipfs-block-service": "~0.12.0",
111111
"ipfs-multipart": "~0.1.0",
112-
"ipfs-repo": "~0.17.0",
112+
"ipfs-repo": "~0.18.1",
113113
"ipfs-unixfs": "~0.1.13",
114114
"ipfs-unixfs-engine": "~0.22.5",
115115
"ipld-resolver": "~0.13.4",
116116
"is-ipfs": "^0.3.2",
117117
"is-stream": "^1.1.0",
118118
"joi": "^13.0.1",
119-
"libp2p": "~0.12.4",
119+
"libp2p": "~0.13.0",
120+
"libp2p-circuit": "~0.1.4",
120121
"libp2p-floodsub": "~0.11.1",
121122
"libp2p-kad-dht": "~0.5.1",
122123
"libp2p-mdns": "~0.9.1",
@@ -125,12 +126,12 @@
125126
"libp2p-secio": "~0.8.1",
126127
"libp2p-tcp": "~0.11.1",
127128
"libp2p-webrtc-star": "~0.13.2",
128-
"libp2p-websockets": "~0.10.2",
129+
"libp2p-websockets": "~0.10.4",
129130
"lodash.flatmap": "^4.5.0",
130131
"lodash.get": "^4.4.2",
131132
"lodash.sortby": "^4.7.0",
132133
"lodash.values": "^4.3.0",
133-
"mafmt": "^3.0.1",
134+
"mafmt": "^3.0.2",
134135
"mime-types": "^2.1.17",
135136
"mkdirp": "~0.5.1",
136137
"multiaddr": "^3.0.1",

src/cli/commands/bitswap/stat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818

1919
stats.Wantlist = stats.Wantlist || []
2020
stats.Wantlist = stats.Wantlist.map((entry) => {
21-
const buf = new Buffer(entry.cid.hash.data)
21+
const buf = Buffer.from(entry.cid.hash.data)
2222
const cid = new CID(entry.cid.version, entry.cid.codec, buf)
2323
return cid.toBaseEncodedString()
2424
})

src/cli/commands/config/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = {
8181

8282
function saveConfig (config, next) {
8383
config = utils.isDaemonOn()
84-
? new Buffer(JSON.stringify(config)) : config
84+
? Buffer.from(JSON.stringify(config)) : config
8585

8686
argv.ipfs.config.replace(config, (err) => {
8787
if (err) {

src/cli/commands/pubsub/pub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
builder: {},
99

1010
handler (argv) {
11-
const data = new Buffer(String(argv.data))
11+
const data = Buffer.from(String(argv.data))
1212

1313
argv.ipfs.pubsub.publish(argv.topic, data, (err) => {
1414
if (err) {

src/core/boot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ module.exports = (self) => {
4141
// fail the whole process.
4242
// TODO: improve datastore and ipfs-repo implemenations so this error is a bit more unified
4343
if (err.message.match(/not found/) || // indexeddb
44-
err.message.match(/ENOENT/) || // fs
45-
err.message.match(/No value/) // memory
46-
) {
44+
err.message.match(/ENOENT/) || // fs
45+
err.message.match(/No value/) // memory
46+
) {
4747
return cb(null, false)
4848
}
4949
return cb(err)

0 commit comments

Comments
 (0)