mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-03 08:11:04 +00:00
24 lines
527 B
JavaScript
24 lines
527 B
JavaScript
'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')
|
|
const libp2p = require('../../..')
|
|
|
|
async function createLibp2p(_options) {
|
|
const defaults = {
|
|
modules: {
|
|
transport: [TCP, WS],
|
|
streamMuxer: [mplex],
|
|
connEncryption: [NOISE],
|
|
},
|
|
}
|
|
|
|
return libp2p.create(defaultsDeep(_options, defaults))
|
|
}
|
|
|
|
module.exports = createLibp2p
|