2017-07-09 16:52:37 +01:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const WebRTCStar = require('libp2p-webrtc-star')
|
|
|
|
const WebSockets = require('libp2p-websockets')
|
|
|
|
|
|
|
|
const Multiplex = require('libp2p-multiplex')
|
|
|
|
const SPDY = require('libp2p-spdy')
|
|
|
|
const SECIO = require('libp2p-secio')
|
|
|
|
|
|
|
|
const Railing = require('libp2p-railing')
|
|
|
|
const libp2p = require('libp2p')
|
|
|
|
|
|
|
|
// Find this list at: https://github.com/ipfs/js-ipfs/blob/master/src/core/runtime/config-browser.json
|
|
|
|
const bootstrapers = [
|
|
|
|
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
|
|
|
|
'/dns4/sfo-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
|
|
|
|
'/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
|
|
|
|
'/dns4/sfo-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
|
|
|
|
'/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
|
|
|
|
'/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
|
|
|
|
'/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
|
2017-10-26 12:52:01 +01:00
|
|
|
'/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
|
|
|
|
'/dns4/wss0.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
|
|
|
|
'/dns4/wss1.bootstrap.libp2p.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
|
2017-07-09 16:52:37 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
class Node extends libp2p {
|
|
|
|
constructor (peerInfo, peerBook, options) {
|
|
|
|
options = options || {}
|
|
|
|
|
|
|
|
const wstar = new WebRTCStar()
|
|
|
|
|
|
|
|
const modules = {
|
|
|
|
transport: [
|
|
|
|
wstar,
|
|
|
|
new WebSockets()
|
|
|
|
],
|
|
|
|
connection: {
|
|
|
|
muxer: [
|
|
|
|
Multiplex,
|
|
|
|
SPDY
|
|
|
|
],
|
|
|
|
crypto: [SECIO]
|
|
|
|
},
|
|
|
|
discovery: [
|
|
|
|
wstar.discovery,
|
|
|
|
new Railing(bootstrapers)
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
super(modules, peerInfo, peerBook, options)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Node
|