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

Commit

Permalink
feat: DHT part I
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed May 30, 2018
1 parent 06ceacc commit 5347ffd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
"detect-node": "^2.0.3",
"dir-compare": "^1.4.0",
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.2.1",
"eslint-plugin-react": "^7.3.0",
"execa": "^0.8.0",
"expose-loader": "^0.7.3",
"form-data": "^2.2.0",
"form-data": "^2.3.1",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.30.1",
"ipfsd-ctl": "~0.21.0",
Expand All @@ -93,14 +93,14 @@
"bl": "^1.2.1",
"boom": "^5.2.0",
"cids": "^0.5.1",
"debug": "^3.0.0",
"debug": "^3.0.1",
"fsm-event": "^2.1.0",
"glob": "^7.1.2",
"hapi": "^16.5.2",
"hapi-set-header": "^1.0.2",
"hoek": "^4.2.0",
"ipfs-api": "^14.1.2",
"ipfs-bitswap": "~0.15.0",
"ipfs-bitswap": "~0.16.0",
"ipfs-block": "~0.6.0",
"ipfs-block-service": "~0.12.0",
"ipfs-multipart": "~0.1.0",
Expand All @@ -118,7 +118,7 @@
"libp2p-multiplex": "^0.4.4",
"libp2p-railing": "^0.6.1",
"libp2p-secio": "^0.7.1",
"libp2p-swarm": "^0.31.0",
"libp2p-swarm": "^0.31.2",
"libp2p-tcp": "^0.10.2",
"libp2p-webrtc-star": "^0.12.0",
"libp2p-websockets": "^0.10.1",
Expand All @@ -129,7 +129,7 @@
"mafmt": "^2.1.8",
"mkdirp": "^0.5.1",
"multiaddr": "^2.3.0",
"multihashes": "~0.4.5",
"multihashes": "~0.4.8",
"once": "^1.4.0",
"path-exists": "^3.0.0",
"peer-book": "^0.5.0",
Expand Down
11 changes: 8 additions & 3 deletions src/core/runtime/libp2p-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ const WebRTCStar = require('libp2p-webrtc-star')
const Multiplex = require('libp2p-multiplex')
const SECIO = require('libp2p-secio')
const Railing = require('libp2p-railing')
const KadDHT = require('libp2p-kad-dht')
const libp2p = require('libp2p')

class Node extends libp2p {
constructor (peerInfo, peerBook, options) {
options = options || {}
const wstar = new WebRTCStar()
const wStar = new WebRTCStar()

const modules = {
transport: [new WS(), wstar],
transport: [new WS(), wStar],
connection: {
muxer: [Multiplex],
crypto: [SECIO]
},
discovery: [wstar.discovery]
discovery: [wStar.discovery]
}

if (options.dht) {
modules.DHT = KadDHT
}

if (options.bootstrap) {
Expand Down
2 changes: 0 additions & 2 deletions test/core/interface/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

'use strict'

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

Expand All @@ -19,4 +18,3 @@ const common = {
}

test.dht(common)
*/

0 comments on commit 5347ffd

Please sign in to comment.