js-libp2p/test/utils/base-options.browser.ts
Alex Potsides 2836acc90f
fix: use keep-alive tag to reconnect to peers on startup (#1278)
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.
2022-06-28 08:05:16 +01:00

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)
}