mirror of
https://github.com/status-im/libp2p-test-plans.git
synced 2025-02-25 21:15:13 +00:00
Trying to debug these tests in CI is incredibly difficult and since they depend on older versions of previously published modules, if something breaks due to a bug in released code it's very hard to fix it. Instead follow the pattern in the perf tests and include the full test implementations here.
35 lines
919 B
TypeScript
35 lines
919 B
TypeScript
import { noise } from '@chainsafe/libp2p-noise'
|
|
import { yamux } from '@chainsafe/libp2p-yamux'
|
|
import { webSockets } from '@libp2p/websockets'
|
|
import * as filters from '@libp2p/websockets/filters'
|
|
import { createLibp2p } from 'libp2p'
|
|
import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
|
import { identify } from '@libp2p/identify'
|
|
import type { Libp2p } from '@libp2p/interface'
|
|
|
|
export async function createRelay (): Promise<Libp2p> {
|
|
const server = await createLibp2p({
|
|
addresses: {
|
|
listen: ['/ip4/0.0.0.0/tcp/0/ws']
|
|
},
|
|
transports: [
|
|
webSockets({
|
|
filter: filters.all
|
|
})
|
|
],
|
|
connectionEncryption: [noise()],
|
|
streamMuxers: [yamux()],
|
|
services: {
|
|
identify: identify(),
|
|
relay: circuitRelayServer({
|
|
reservations: {
|
|
maxReservations: Infinity,
|
|
applyDefaultLimit: false
|
|
}
|
|
})
|
|
}
|
|
})
|
|
|
|
return server
|
|
}
|