24 lines
527 B
JavaScript
Raw Normal View History

2017-07-05 12:12:51 +01:00
'use strict'
const TCP = require('libp2p-tcp')
const WS = require('libp2p-websockets')
const mplex = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise')
const defaultsDeep = require('@nodeutils/defaults-deep')
2017-07-05 12:12:51 +01:00
const libp2p = require('../../..')
async function createLibp2p(_options) {
const defaults = {
modules: {
transport: [TCP, WS],
streamMuxer: [mplex],
connEncryption: [NOISE],
},
2017-07-05 12:12:51 +01:00
}
return libp2p.create(defaultsDeep(_options, defaults))
2017-07-05 12:12:51 +01:00
}
module.exports = createLibp2p