Skip to content

Commit ace1939

Browse files
committed
feat(brave): delegated DHT + preload
- enabled delegated DHT - disabled -star as it crash boot if server is down - enabled preload (best-effort) - enabled mdns - simplified configuration
1 parent 350f880 commit ace1939

File tree

7 files changed

+158
-164
lines changed

7 files changed

+158
-164
lines changed

add-on/_locales/en/messages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"description": "An option title on the Preferences screen (option_ipfsNodeConfig_title)"
237237
},
238238
"option_ipfsNodeConfig_description": {
239-
"message": "Additional configuration for the embedded IPFS node (arrays will be merged). Must be valid JSON.",
239+
"message": "Additional configuration for the embedded JS IPFS node. Must be valid JSON.",
240240
"description": "An option description on the Preferences screen (option_ipfsNodeConfig_description)"
241241
},
242242
"option_ipfsNodeType_external": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
'use strict'
2+
/* eslint-env browser, webextensions */
3+
4+
const browser = require('webextension-polyfill')
5+
6+
const { optionDefaults } = require('../../options')
7+
const chromeSocketsBundle = require('./libp2p-bundle')
8+
const mergeOptions = require('merge-options')
9+
const getPort = require('get-port')
10+
11+
const multiaddr = require('multiaddr')
12+
const maToUri = require('multiaddr-to-uri')
13+
const multiaddr2httpUrl = (ma) => maToUri(ma.includes('/http') ? ma : multiaddr(ma).encapsulate('/http'))
14+
15+
const chromeSocketsOpts = {
16+
config: {
17+
Addresses: {
18+
API: '/ip4/127.0.0.1/tcp/5003',
19+
Gateway: '/ip4/127.0.0.1/tcp/9091',
20+
/* Sidenote on API & Gateway:
21+
Gateway can run without API port,
22+
but Web UI needs API (can't use window.ipfs due to sandboxing)
23+
*/
24+
Swarm: [
25+
// TODO: listening on TCP (override IP and port at runtime in buildConfig()?)
26+
'/ip4/0.0.0.0/tcp/0'
27+
// TODO: disabled -star signaling: it makes a backup non-LAN peer discovery, but break the boot if server is down
28+
// '/dns4/ws-star1.par.dwebops.pub.com/tcp/443/wss/p2p-websocket-star'
29+
],
30+
// Delegated Content and Peer Routing: https://github.com/ipfs/js-ipfs/pull/2195
31+
Delegates: // [] // TODO: enable delegates
32+
[
33+
'/dns4/node1.delegate.ipfs.io/tcp/443/https',
34+
'/dns4/node0.delegate.ipfs.io/tcp/443/https'
35+
]
36+
},
37+
Discovery: {
38+
MDNS: {
39+
Enabled: true,
40+
Interval: 10
41+
}
42+
},
43+
Swarm: {
44+
ConnMgr: {
45+
LowWater: 100,
46+
HighWater: 250
47+
}
48+
},
49+
Bootstrap: [
50+
// Prioritize TCP Bootstrappers from https://github.com/ipfs/js-ipfs/blob/v0.37.1/src/core/runtime/config-nodejs.js#L22
51+
'/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
52+
'/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',
53+
'/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
54+
'/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
55+
'/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
56+
'/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
57+
'/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
58+
'/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
59+
'/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
60+
'/ip6/2604:a880:1:20::1f9:9001/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
61+
'/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
62+
'/ip6/2604:a880:0:1010::23:d001/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
63+
'/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
64+
'/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
65+
'/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
66+
'/ip6/2a03:b0c0:1:d0::e7:1/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
67+
'/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
68+
// Twist: connect to preload nodes, but over tcp :)
69+
'/dns4/node0.preload.ipfs.io/tcp/4001/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
70+
'/dns4/node1.preload.ipfs.io/tcp/4001/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6',
71+
// WebSockets versions from https://github.com/ipfs/js-ipfs/blob/v0.37.1/src/core/runtime/config-browser.js#L20
72+
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
73+
'/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
74+
'/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
75+
'/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
76+
'/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
77+
'/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
78+
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
79+
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
80+
]
81+
},
82+
// preload: { enabled: false, addresses: [] }
83+
/* TODO: when we have p2p transport, are preloads still needed? should Brave have own nodes? */
84+
preload: {
85+
enabled: true,
86+
addresses: [
87+
'/dns4/node1.preload.ipfs.io/tcp/443/https',
88+
'/dns4/node0.preload.ipfs.io/tcp/443/https'
89+
]
90+
}
91+
}
92+
93+
async function buildConfig (opts, log) {
94+
const defaultOpts = JSON.parse(optionDefaults.ipfsNodeConfig)
95+
const userOpts = JSON.parse(opts.ipfsNodeConfig)
96+
const ipfsNodeConfig = mergeOptions(defaultOpts, userOpts, chromeSocketsOpts, { start: false, libp2p: chromeSocketsBundle })
97+
98+
// Detect when API or Gateway port is not available (taken by something else)
99+
// We find the next free port and update configuration to use it instead
100+
const multiaddr2port = (ma) => parseInt(new URL(multiaddr2httpUrl(ma)).port, 10)
101+
const gatewayPort = multiaddr2port(ipfsNodeConfig.config.Addresses.Gateway)
102+
const apiPort = multiaddr2port(ipfsNodeConfig.config.Addresses.API)
103+
log(`checking if ports are available: api: ${apiPort}, gateway: ${gatewayPort}`)
104+
const freeGatewayPort = await getPort({ port: getPort.makeRange(gatewayPort, gatewayPort + 100) })
105+
const freeApiPort = await getPort({ port: getPort.makeRange(apiPort, apiPort + 100) })
106+
if (gatewayPort !== freeGatewayPort || apiPort !== freeApiPort) {
107+
log(`updating config to available ports: api: ${freeApiPort}, gateway: ${freeGatewayPort}`)
108+
const addrs = ipfsNodeConfig.config.Addresses
109+
addrs.Gateway = addrs.Gateway.replace(gatewayPort.toString(), freeGatewayPort.toString())
110+
addrs.API = addrs.API.replace(apiPort.toString(), freeApiPort.toString())
111+
}
112+
113+
return ipfsNodeConfig
114+
}
115+
116+
async function syncConfig (ipfs, opts, log) {
117+
const localConfig = await browser.storage.local.get('ipfsNodeConfig')
118+
if (localConfig && localConfig.ipfsNodeConfig) {
119+
const gwMa = await ipfs.config.get('Addresses.Gateway')
120+
const apiMa = await ipfs.config.get('Addresses.API')
121+
const httpGateway = multiaddr2httpUrl(gwMa)
122+
const httpApi = multiaddr2httpUrl(apiMa)
123+
// update config in browser.storage to ports from js-ipfs instance
124+
const ipfsNodeConfig = JSON.parse(localConfig.ipfsNodeConfig)
125+
ipfsNodeConfig.config.Addresses.Gateway = gwMa
126+
ipfsNodeConfig.config.Addresses.API = apiMa
127+
const configChanges = {
128+
customGatewayUrl: httpGateway,
129+
ipfsApiUrl: httpApi,
130+
ipfsNodeConfig: JSON.stringify(ipfsNodeConfig, null, 2)
131+
}
132+
// update runtime config in place
133+
Object.assign(opts, configChanges)
134+
// update config in browser.storage (triggers async client restart if ports changed)
135+
log(`synchronizing ipfsNodeConfig with customGatewayUrl (${configChanges.customGatewayUrl}) and ipfsApiUrl (${configChanges.ipfsApiUrl})`)
136+
await browser.storage.local.set(configChanges)
137+
}
138+
}
139+
140+
module.exports = { buildConfig, syncConfig }

add-on/src/lib/ipfs-client/embedded-chromesockets.js

+6-72
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22
/* eslint-env browser, webextensions */
3-
const browser = require('webextension-polyfill')
43

54
/* *********************************************************
65
This file is a wip sandbox.
@@ -16,56 +15,18 @@ const uptimeStart = Date.now()
1615
process.uptime = () => Math.floor((Date.now() - uptimeStart) / 1000)
1716
process.hrtime = require('browser-process-hrtime')
1817

19-
const mergeOptions = require('merge-options')
2018
const Ipfs = require('ipfs')
2119
const HttpApi = require('ipfs/src/http')
22-
const multiaddr = require('multiaddr')
23-
const maToUri = require('multiaddr-to-uri')
24-
const getPort = require('get-port')
20+
const { buildConfig, syncConfig } = require('./chrome-sockets/config')
2521

26-
// libp2p
27-
// const WS = require('libp2p-websockets')
28-
// const WSM = require('libp2p-websocket-star-multi')
29-
// const TCP = require('libp2p-tcp')
30-
// const MulticastDNS = require('libp2p-mdns')
31-
// const Bootstrap = require('libp2p-bootstrap')
32-
33-
const { optionDefaults } = require('../options')
34-
35-
const chromeSocketsBundle = require('./chrome-sockets/libp2p-bundle')
36-
37-
// js-ipfs with embedded hapi HTTP server
38-
let node = null
39-
let nodeHttpApi = null
40-
41-
async function buildConfig (opts) {
42-
const defaultOpts = JSON.parse(optionDefaults.ipfsNodeConfig)
43-
const userOpts = JSON.parse(opts.ipfsNodeConfig)
44-
45-
const ipfsNodeConfig = mergeOptions.call({ concatArrays: true }, defaultOpts, userOpts, { start: false, libp2p: chromeSocketsBundle })
46-
47-
// Detect when API or Gateway port is not available (taken by something else)
48-
// We find the next free port and update configuration to use it instead
49-
const multiaddr2port = (ma) => parseInt(new URL(multiaddr2httpUrl(ma)).port, 10)
50-
const gatewayPort = multiaddr2port(ipfsNodeConfig.config.Addresses.Gateway)
51-
const apiPort = multiaddr2port(ipfsNodeConfig.config.Addresses.API)
52-
log(`checking if ports are available: api: ${apiPort}, gateway: ${gatewayPort}`)
53-
const freeGatewayPort = await getPort({ port: getPort.makeRange(gatewayPort, gatewayPort + 100) })
54-
const freeApiPort = await getPort({ port: getPort.makeRange(apiPort, apiPort + 100) })
55-
if (gatewayPort !== freeGatewayPort || apiPort !== freeApiPort) {
56-
log(`updating config to available ports: api: ${freeApiPort}, gateway: ${freeGatewayPort}`)
57-
const addrs = ipfsNodeConfig.config.Addresses
58-
addrs.Gateway = addrs.Gateway.replace(gatewayPort.toString(), freeGatewayPort.toString())
59-
addrs.API = addrs.API.replace(apiPort.toString(), freeApiPort.toString())
60-
}
61-
62-
return ipfsNodeConfig
63-
}
22+
// js-ipfs + embedded hapi HTTP server
23+
let node
24+
let nodeHttpApi
6425

6526
exports.init = async function init (opts) {
6627
log('init embedded:chromesockets')
6728

68-
const ipfsOpts = await buildConfig(opts)
29+
const ipfsOpts = await buildConfig(opts, log)
6930
log('creating js-ipfs with opts: ', ipfsOpts)
7031
node = new Ipfs(ipfsOpts)
7132

@@ -80,7 +41,7 @@ exports.init = async function init (opts) {
8041
try {
8142
const httpServers = new HttpApi(node, ipfsOpts)
8243
nodeHttpApi = await httpServers.start()
83-
await updateConfigWithHttpEndpoints(node, opts)
44+
await syncConfig(node, opts, log)
8445
resolve(node)
8546
} catch (err) {
8647
reject(err)
@@ -98,33 +59,6 @@ exports.init = async function init (opts) {
9859
})
9960
}
10061

101-
const multiaddr2httpUrl = (ma) => maToUri(ma.includes('/http') ? ma : multiaddr(ma).encapsulate('/http'))
102-
103-
// Update internal configuration to HTTP Endpoints from js-ipfs instance
104-
async function updateConfigWithHttpEndpoints (ipfs, opts) {
105-
const localConfig = await browser.storage.local.get('ipfsNodeConfig')
106-
if (localConfig && localConfig.ipfsNodeConfig) {
107-
const gwMa = await ipfs.config.get('Addresses.Gateway')
108-
const apiMa = await ipfs.config.get('Addresses.API')
109-
const httpGateway = multiaddr2httpUrl(gwMa)
110-
const httpApi = multiaddr2httpUrl(apiMa)
111-
// update ports in JSON configuration for embedded js-ipfs
112-
const ipfsNodeConfig = JSON.parse(localConfig.ipfsNodeConfig)
113-
ipfsNodeConfig.config.Addresses.Gateway = gwMa
114-
ipfsNodeConfig.config.Addresses.API = apiMa
115-
const configChanges = {
116-
customGatewayUrl: httpGateway,
117-
ipfsApiUrl: httpApi,
118-
ipfsNodeConfig: JSON.stringify(ipfsNodeConfig, null, 2)
119-
}
120-
// update current runtime config (in place)
121-
Object.assign(opts, configChanges)
122-
// update user config in storage (triggers async client restart if ports changed)
123-
log(`synchronizing ipfsNodeConfig with customGatewayUrl (${configChanges.customGatewayUrl}) and ipfsApiUrl (${configChanges.ipfsApiUrl})`)
124-
await browser.storage.local.set(configChanges)
125-
}
126-
}
127-
12862
exports.destroy = async function () {
12963
log('destroy: embedded:chromesockets')
13064

add-on/src/lib/ipfs-client/embedded.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exports.init = function init (opts) {
1515

1616
const defaultOpts = JSON.parse(optionDefaults.ipfsNodeConfig)
1717
const userOpts = JSON.parse(opts.ipfsNodeConfig)
18-
const ipfsOpts = mergeOptions.call({ concatArrays: true }, defaultOpts, userOpts, { start: false })
18+
const ipfsOpts = mergeOptions(defaultOpts, userOpts, { start: false })
1919

2020
node = new Ipfs(ipfsOpts)
2121

add-on/src/lib/options.js

+2-83
Original file line numberDiff line numberDiff line change
@@ -45,94 +45,13 @@ function buildDefaultIpfsNodeType () {
4545
}
4646

4747
function buildDefaultIpfsNodeConfig () {
48-
const config = {
48+
return JSON.stringify({
4949
config: {
5050
Addresses: {
5151
Swarm: []
52-
},
53-
Bootstrap: [
54-
// TCP Bootstrappers from https://github.com/ipfs/js-ipfs/blob/v0.37.1/src/core/runtime/config-nodejs.js#L22
55-
'/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
56-
'/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',
57-
'/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
58-
'/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
59-
'/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
60-
'/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
61-
'/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
62-
'/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
63-
'/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
64-
'/ip6/2604:a880:1:20::1f9:9001/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
65-
'/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
66-
'/ip6/2604:a880:0:1010::23:d001/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
67-
'/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
68-
'/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
69-
'/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
70-
'/ip6/2a03:b0c0:1:d0::e7:1/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
71-
'/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
72-
// Twist: connect to preload nodes, but over tcp :)
73-
'/dns4/node0.preload.ipfs.io/tcp/4001/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
74-
'/dns4/node1.preload.ipfs.io/tcp/4001/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6',
75-
// WebSockets versions from https://github.com/ipfs/js-ipfs/blob/v0.37.1/src/core/runtime/config-browser.js#L20
76-
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
77-
'/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
78-
'/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
79-
'/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
80-
'/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
81-
'/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
82-
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
83-
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
84-
],
85-
Swarm: {
86-
ConnMgr: {
87-
LowWater: 100,
88-
HighWater: 250
89-
}
9052
}
9153
}
92-
}
93-
if (hasChromeSocketsForTcp()) {
94-
// TODO: make more robust (sync with buildCustomGatewayUrl and buildIpfsApiUrl)
95-
// embedded node should use different ports to make it easier
96-
// for people already running regular go-ipfs and js-ipfs on standard ports
97-
config.config.Addresses.API = '/ip4/127.0.0.1/tcp/5003'
98-
config.config.Addresses.Gateway = '/ip4/127.0.0.1/tcp/9091'
99-
100-
// Until we have MulticastDNS+DNS, peer discovery is done over ws-star
101-
config.config.Addresses.Swarm = [
102-
'/ip4/0.0.0.0/tcp/0',
103-
'/dns4/ws-star1.par.dwebops.pub/tcp/443/wss/p2p-websocket-star'
104-
// '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
105-
]
106-
/*
107-
// Until DHT and p2p transport are ready, delegate + preload
108-
// Note: we use .preload.ipfs.io and .delegate.ipfs.io as means of http sharding (12 instead of 6 concurrent requests)
109-
const delegates = [
110-
'/dns4/node1.delegate.ipfs.io/tcp/443/https',
111-
'/dns4/node0.delegate.ipfs.io/tcp/443/https'
112-
]
113-
// Delegated Content and Peer Routing: https://github.com/ipfs/js-ipfs/pull/2195
114-
config.config.Addresses.Delegates = delegates
115-
// TODO: when we have p2p transport, are preloads still needed? should Brave have own nodes?
116-
config.preload = {
117-
enabled: true,
118-
addresses: [
119-
'/dns4/node1.preload.ipfs.io/tcp/443/https',
120-
'/dns4/node0.preload.ipfs.io/tcp/443/https'
121-
]
122-
}
123-
*/
124-
config.preload = { enabled: false }
125-
/*
126-
(Sidenote on why we need API for Web UI)
127-
Gateway can run without API port,
128-
but Web UI does not use window.ipfs due to sandboxing atm.
129-
130-
If Web UI is able to use window.ipfs, then we can remove API port.
131-
Disabling API is as easy as:
132-
config.config.Addresses.API = ''
133-
*/
134-
}
135-
return JSON.stringify(config, null, 2)
54+
}, null, 2)
13655
}
13756

13857
// `storage` should be a browser.storage.local or similar

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"@material/switch": "3.1.0",
117117
"browser-process-hrtime": "1.0.0",
118118
"choo": "7.0.0",
119-
"chrome-dgram": "https://github.com/lidel/chrome-dgram/tarball/2bd217a29ea91b313fe5f46828621bb27d69cb06/chrome-dgram.tar.gz",
119+
"chrome-dgram": "3.0.3",
120120
"chrome-net": "3.3.2",
121121
"debug": "4.1.1",
122122
"doc-sniff": "1.0.1",
@@ -126,7 +126,7 @@
126126
"get-port": "5.0.0",
127127
"http-dns": "3.0.1",
128128
"http-node": "1.2.0",
129-
"ipfs": "https://github.com/ipfs/js-ipfs/tarball/ddd49ce41f6f9abd48b1e54bc4c7dd3e58fd0ee9/js-ipfs.tar.gz",
129+
"ipfs": "https://github.com/ipfs/js-ipfs/tarball/cf38aead2b0cb0b5f269daf265a2b868c50a81f8/js-ipfs.tar.gz",
130130
"ipfs-css": "0.13.1",
131131
"ipfs-http-client": "33.1.1",
132132
"ipfs-http-response": "0.3.1",

0 commit comments

Comments
 (0)