mirror of https://github.com/waku-org/js-waku.git
fix: filter for wss in libp2p websocket transport
This commit is contained in:
parent
3d92f194a7
commit
682cc66232
|
@ -5,7 +5,7 @@ import { identify } from "@libp2p/identify";
|
||||||
import { mplex } from "@libp2p/mplex";
|
import { mplex } from "@libp2p/mplex";
|
||||||
import { ping } from "@libp2p/ping";
|
import { ping } from "@libp2p/ping";
|
||||||
import { webSockets } from "@libp2p/websockets";
|
import { webSockets } from "@libp2p/websockets";
|
||||||
import { all as filterAll } from "@libp2p/websockets/filters";
|
import { all as filterAll, wss } from "@libp2p/websockets/filters";
|
||||||
import { wakuMetadata } from "@waku/core";
|
import { wakuMetadata } from "@waku/core";
|
||||||
import {
|
import {
|
||||||
type CreateLibp2pOptions,
|
type CreateLibp2pOptions,
|
||||||
|
@ -64,11 +64,13 @@ export async function defaultLibp2p(
|
||||||
? { metadata: wakuMetadata(shardInfo) }
|
? { metadata: wakuMetadata(shardInfo) }
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
|
const filter = process?.env?.NODE_ENV === "test" ? filterAll : wss;
|
||||||
|
|
||||||
return createLibp2p({
|
return createLibp2p({
|
||||||
connectionManager: {
|
connectionManager: {
|
||||||
minConnections: 1
|
minConnections: 1
|
||||||
},
|
},
|
||||||
transports: [webSockets({ filter: filterAll })],
|
transports: [webSockets({ filter })],
|
||||||
streamMuxers: [mplex()],
|
streamMuxers: [mplex()],
|
||||||
connectionEncryption: [noise()],
|
connectionEncryption: [noise()],
|
||||||
...options,
|
...options,
|
||||||
|
|
Loading…
Reference in New Issue