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

Commit da2bdbb

Browse files
author
Alan Shaw
committed
refactor: enable DHT by default
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 84978c4 commit da2bdbb

File tree

11 files changed

+26
-24
lines changed

11 files changed

+26
-24
lines changed

src/core/components/libp2p.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
6666
},
6767
dht: {
6868
kBucketSize: get(options, 'dht.kBucketSize', 20),
69-
// enabled: !get(options, 'offline', false), // disable if offline, on by default
70-
enabled: false,
69+
enabled: !get(options, 'offline', false), // disable if offline, on by default
7170
randomWalk: {
72-
enabled: false // disabled waiting for https://github.com/libp2p/js-libp2p-kad-dht/issues/86
71+
enabled: true
7372
},
7473
validators: {
7574
ipns: ipnsUtils.validator

src/core/runtime/config-browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ module.exports = () => ({
2828
],
2929
Swarm: {
3030
ConnMgr: {
31-
LowWater: 200,
32-
HighWater: 500
31+
LowWater: 20,
32+
HighWater: 50
3333
}
3434
}
3535
})

src/core/runtime/libp2p-browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Node extends libp2p {
6262
}
6363
},
6464
dht: {
65-
enabled: false
65+
enabled: true
6666
},
6767
EXPERIMENTAL: {
6868
pubsub: false

src/core/runtime/libp2p-nodejs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class Node extends libp2p {
6262
},
6363
dht: {
6464
kBucketSize: 20,
65-
enabled: false,
65+
enabled: true,
6666
randomWalk: {
67-
enabled: false
67+
enabled: true
6868
}
6969
},
7070
EXPERIMENTAL: {

test/cli/dht.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ const daemonOpts = {
3131
initOptions: { bits: 512 }
3232
}
3333

34-
// TODO: unskip when DHT is enabled in 0.36
35-
describe.skip('dht', () => {
34+
describe('dht', () => {
3635
let nodes = []
3736
let ipfsA
3837
let ipfsB

test/core/dht.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const isNode = require('detect-node')
1212
const IPFSFactory = require('ipfsd-ctl')
1313
const IPFS = require('../../src/core')
1414

15-
// TODO: unskip when DHT is enabled in 0.36
16-
describe.skip('dht', () => {
15+
describe('dht', () => {
1716
describe('enabled', () => {
1817
let ipfsd, ipfs
1918

test/core/interface.spec.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ describe('interface-ipfs-core tests', function () {
5757
initOptions: { bits: 512 }
5858
}
5959
}), {
60-
skip: {
61-
reason: 'TODO: unskip when DHT is enabled in 0.36'
62-
}
60+
skip: isNode ? [
61+
// dht.get
62+
{
63+
name: 'should get a value after it was put on another node',
64+
reason: 'Needs https://github.com/ipfs/interface-ipfs-core/pull/383'
65+
}
66+
] : true
6367
})
6468

6569
tests.filesRegular(defaultCommonFactory, {

test/core/name.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ describe('name', function () {
196196
})
197197
})
198198

199-
// TODO: unskip when DHT is enabled in 0.36
200-
describe.skip('work with dht', () => {
199+
describe('work with dht', () => {
201200
let nodes
202201
let nodeA
203202
let nodeB

test/core/ping.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ describe('ping', function () {
194194
})
195195
})
196196

197-
// TODO: unskip when DHT enabled in 0.36
198-
describe.skip('DHT enabled', function () {
197+
describe('DHT enabled', function () {
199198
// Our bootstrap process will run 3 IPFS daemons where
200199
// A ----> B ----> C
201200
// Allowing us to test the ping command using the DHT peer routing

test/http-api/inject/dht.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const expect = chai.expect
88
chai.use(dirtyChai)
99

1010
module.exports = (http) => {
11-
// TODO: unskip when DHT is enabled in 0.36
12-
describe.skip('/dht', () => {
11+
describe('/dht', () => {
1312
let api
1413

1514
before(() => {

0 commit comments

Comments
 (0)