mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-03-28 05:11:04 +00:00
Instead of trying to connect to every peer in the peer store when we start a node, only connect to the peers that have been marked with a `keep-alive` tag.
35 lines
760 B
TypeScript
35 lines
760 B
TypeScript
|
|
import { WebSockets } from '@libp2p/websockets'
|
|
import * as filters from '@libp2p/websockets/filters'
|
|
import { Mplex } from '@libp2p/mplex'
|
|
import { Plaintext } from '../../src/insecure/index.js'
|
|
import type { Libp2pOptions } from '../../src'
|
|
import mergeOptions from 'merge-options'
|
|
|
|
export function createBaseOptions (overrides?: Libp2pOptions): Libp2pOptions {
|
|
const options: Libp2pOptions = {
|
|
transports: [
|
|
new WebSockets({
|
|
filter: filters.all
|
|
})
|
|
],
|
|
streamMuxers: [
|
|
new Mplex()
|
|
],
|
|
connectionEncryption: [
|
|
new Plaintext()
|
|
],
|
|
relay: {
|
|
enabled: false,
|
|
hop: {
|
|
enabled: false
|
|
}
|
|
},
|
|
nat: {
|
|
enabled: false
|
|
}
|
|
}
|
|
|
|
return mergeOptions(options, overrides)
|
|
}
|