mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-21 16:42:14 +00:00
* docs: add initial notes on stats * feat: initial refactor of stats to metrics * feat: add support for placeholder metrics This is helpful for tracking metrics prior to knowing the remote peers id * fix: add metrics tests and fix issues * fix: always clear the dial timeout timer * docs: add metrics to api doc * chore: apply suggestions from code review Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio> * docs: update metrics docs * fix: call metrics.onDisconnect * docs(config): add example headers so they appear in the TOC * docs(config): add metrics configuration * docs(relay): fix relay configuration docs
49 lines
948 B
JavaScript
49 lines
948 B
JavaScript
'use strict'
|
|
|
|
const mergeOptions = require('merge-options')
|
|
|
|
const DefaultConfig = {
|
|
connectionManager: {
|
|
minPeers: 25
|
|
},
|
|
metrics: {
|
|
enabled: false
|
|
},
|
|
config: {
|
|
dht: {
|
|
enabled: false,
|
|
kBucketSize: 20,
|
|
randomWalk: {
|
|
enabled: false, // disabled waiting for https://github.com/libp2p/js-libp2p-kad-dht/issues/86
|
|
queriesPerPeriod: 1,
|
|
interval: 300e3,
|
|
timeout: 10e3
|
|
}
|
|
},
|
|
peerDiscovery: {
|
|
autoDial: true
|
|
},
|
|
pubsub: {
|
|
enabled: true,
|
|
emitSelf: true,
|
|
signMessages: true,
|
|
strictSigning: true
|
|
},
|
|
relay: {
|
|
enabled: true,
|
|
hop: {
|
|
enabled: false,
|
|
active: false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports.validate = (opts) => {
|
|
opts = mergeOptions(DefaultConfig, opts)
|
|
|
|
if (opts.modules.transport.length < 1) throw new Error("'options.modules.transport' must contain at least 1 transport")
|
|
|
|
return opts
|
|
}
|