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

Commit 5347ffd

Browse files
committed
feat: DHT part I
1 parent 06ceacc commit 5347ffd

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
"detect-node": "^2.0.3",
6969
"dir-compare": "^1.4.0",
7070
"dirty-chai": "^2.0.1",
71-
"eslint-plugin-react": "^7.2.1",
71+
"eslint-plugin-react": "^7.3.0",
7272
"execa": "^0.8.0",
7373
"expose-loader": "^0.7.3",
74-
"form-data": "^2.2.0",
74+
"form-data": "^2.3.1",
7575
"gulp": "^3.9.1",
7676
"interface-ipfs-core": "~0.30.1",
7777
"ipfsd-ctl": "~0.21.0",
@@ -93,14 +93,14 @@
9393
"bl": "^1.2.1",
9494
"boom": "^5.2.0",
9595
"cids": "^0.5.1",
96-
"debug": "^3.0.0",
96+
"debug": "^3.0.1",
9797
"fsm-event": "^2.1.0",
9898
"glob": "^7.1.2",
9999
"hapi": "^16.5.2",
100100
"hapi-set-header": "^1.0.2",
101101
"hoek": "^4.2.0",
102102
"ipfs-api": "^14.1.2",
103-
"ipfs-bitswap": "~0.15.0",
103+
"ipfs-bitswap": "~0.16.0",
104104
"ipfs-block": "~0.6.0",
105105
"ipfs-block-service": "~0.12.0",
106106
"ipfs-multipart": "~0.1.0",
@@ -118,7 +118,7 @@
118118
"libp2p-multiplex": "^0.4.4",
119119
"libp2p-railing": "^0.6.1",
120120
"libp2p-secio": "^0.7.1",
121-
"libp2p-swarm": "^0.31.0",
121+
"libp2p-swarm": "^0.31.2",
122122
"libp2p-tcp": "^0.10.2",
123123
"libp2p-webrtc-star": "^0.12.0",
124124
"libp2p-websockets": "^0.10.1",
@@ -129,7 +129,7 @@
129129
"mafmt": "^2.1.8",
130130
"mkdirp": "^0.5.1",
131131
"multiaddr": "^2.3.0",
132-
"multihashes": "~0.4.5",
132+
"multihashes": "~0.4.8",
133133
"once": "^1.4.0",
134134
"path-exists": "^3.0.0",
135135
"peer-book": "^0.5.0",

src/core/runtime/libp2p-browser.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ const WebRTCStar = require('libp2p-webrtc-star')
55
const Multiplex = require('libp2p-multiplex')
66
const SECIO = require('libp2p-secio')
77
const Railing = require('libp2p-railing')
8+
const KadDHT = require('libp2p-kad-dht')
89
const libp2p = require('libp2p')
910

1011
class Node extends libp2p {
1112
constructor (peerInfo, peerBook, options) {
1213
options = options || {}
13-
const wstar = new WebRTCStar()
14+
const wStar = new WebRTCStar()
1415

1516
const modules = {
16-
transport: [new WS(), wstar],
17+
transport: [new WS(), wStar],
1718
connection: {
1819
muxer: [Multiplex],
1920
crypto: [SECIO]
2021
},
21-
discovery: [wstar.discovery]
22+
discovery: [wStar.discovery]
23+
}
24+
25+
if (options.dht) {
26+
modules.DHT = KadDHT
2227
}
2328

2429
if (options.bootstrap) {

test/core/interface/dht.js

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
'use strict'
44

5-
/*
65
const test = require('interface-ipfs-core')
76
const IPFSFactory = require('../../utils/ipfs-factory-instance')
87

@@ -19,4 +18,3 @@ const common = {
1918
}
2019

2120
test.dht(common)
22-
*/

0 commit comments

Comments
 (0)