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

[WIP] feat: connections limit #1800

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: enable dht by default
  • Loading branch information
vasco-santos committed Dec 28, 2018
commit 8e4c402c9358d7f62f158a94d4863845080823fa
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ You can check the development status at the [Kanban Board](https://waffle.io/ipf

[![Throughput Graph](https://graphs.waffle.io/ipfs/js-ipfs/throughput.svg)](https://waffle.io/ipfs/js-ipfs/metrics/throughput)

**Please read this:** DHT (automatic content discovery) and Circuit Relay (pierce through NATs and dial between any node in the network) are two fundamental pieces that are not finalized yet. There are multiple applications that can be built without these two services but nevertheless they are fundamental to get that magic IPFS experience. If you want to track progress or contribute, please follow:
**Please read this:** Circuit Relay (pierce through NATs and dial between any node in the network) is a fundamental piece that is not finalized yet. There are multiple applications that can be built without this service but nevertheless it is fundamental to get that magic IPFS experience. If you want to track progress or contribute, please follow:

- DHT: https://github.com/ipfs/js-ipfs/pull/856
- ✅ Relay: https://github.com/ipfs/js-ipfs/pull/1063

[**`Weekly Core Dev Calls`**](https://github.com/ipfs/pm/issues/650)
Expand Down Expand Up @@ -319,7 +318,6 @@ Enable and configure experimental features.
- `pubsub` (boolean): Enable libp2p pub-sub. (Default: `false`)
- `ipnsPubsub` (boolean): Enable pub-sub on IPNS. (Default: `false`)
- `sharding` (boolean): Enable directory sharding. Directories that have many child objects will be represented by multiple DAG nodes instead of just one. It can improve lookup performance when a directory has several thousand files or more. (Default: `false`)
- `dht` (boolean): Enable KadDHT.

##### `options.config`

Expand Down
4 changes: 0 additions & 4 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ module.exports = {
type: 'boolean',
default: false
})
.option('enable-dht-experiment', {
type: 'boolean',
default: false
})
.option('local', {
desc: 'Run commands locally to the daemon',
default: false
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = function libp2p (self) {
}
},
EXPERIMENTAL: {
dht: get(opts.options, 'EXPERIMENTAL.dht', false),
dht: true,
pubsub: get(opts.options, 'EXPERIMENTAL.pubsub', false)
}
},
Expand Down
3 changes: 0 additions & 3 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ class IPFS extends EventEmitter {
if (this._options.EXPERIMENTAL.sharding) {
this.log('EXPERIMENTAL sharding is enabled')
}
if (this._options.EXPERIMENTAL.dht) {
this.log('EXPERIMENTAL Kademlia DHT is enabled')
}

this.state = require('./state')(this)

Expand Down
2 changes: 1 addition & 1 deletion src/core/runtime/libp2p-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Node extends libp2p {
enabledDiscovery: true
},
EXPERIMENTAL: {
dht: false,
dht: true,
pubsub: false
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/runtime/libp2p-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Node extends libp2p {
enabledDiscovery: true
},
EXPERIMENTAL: {
dht: false,
dht: true,
pubsub: false
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/http/api/resources/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ exports.findPeer = {
}).code(500)
}

return reply(res).code(200)
return reply({
Responses: [{
ID: res.responses[0].id,
Addrs: res.responses[0].addrs
}],
Type: res.type
}).code(200)
})
}
}
Expand All @@ -52,7 +58,13 @@ exports.findProvs = {
}).code(500)
}

return reply(res).code(200)
return reply({
Responses: res.responses.map((r) => ({
ID: r.id,
Addrs: r.addrs
})),
Type: res.type
}).code(200)
})
}
}
Expand Down
1 change: 0 additions & 1 deletion src/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function HttpApi (repo, config, cliArgs) {
EXPERIMENTAL: {
pubsub: cliArgs.enablePubsubExperiment,
ipnsPubsub: cliArgs.enableNamesysPubsub,
dht: cliArgs.enableDhtExperiment,
sharding: cliArgs.enableShardingExperiment
},
libp2p: libp2p
Expand Down
1 change: 0 additions & 1 deletion test/cli/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const daemonOpts = {
config: {
Bootstrap: []
},
args: ['--enable-dht-experiment'],
initOptions: { bits: 512 }
}

Expand Down
1 change: 0 additions & 1 deletion test/core/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('interface-ipfs-core tests', () => {
}
}
},
args: ['--enable-dht-experiment'],
initOptions: { bits: 512 }
}
}), {
Expand Down
3 changes: 1 addition & 2 deletions test/core/kad-dht.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ function createNode (callback) {
f.spawn({
exec: './src/cli/bin.js',
config,
initOptions: { bits: 512 },
args: ['--enable-dht-experiment']
initOptions: { bits: 512 }
}, callback)
}

Expand Down
4 changes: 2 additions & 2 deletions test/core/libp2p.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('libp2p customization', function () {
}
},
EXPERIMENTAL: {
dht: false,
dht: true,
pubsub: false
}
})
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('libp2p customization', function () {
}
},
EXPERIMENTAL: {
dht: false,
dht: true,
pubsub: true
}
})
Expand Down
3 changes: 1 addition & 2 deletions test/http-api/inject/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ describe('HTTP API', () => {
const startHttpAPI = (cb) => {
const options = {
pass: hat(),
enablePubsubExperiment: true,
enableDhtExperiment: true
enablePubsubExperiment: true
}
http.api = new API(repoTests, null, options)

Expand Down
1 change: 0 additions & 1 deletion test/http-api/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => {

tests.dht(CommonFactory.create({
spawnOptions: {
args: ['--enable-dht-experiment'],
initOptions: { bits: 512 }
}
}), {
Expand Down