From 2beb359cef33f23734b55a85bc1958bc6a95d3d4 Mon Sep 17 00:00:00 2001 From: Sasha <118575614+weboko@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:55:29 +0200 Subject: [PATCH] chore: enabile back filterAll if set by consumer (#2103) --- packages/interfaces/src/libp2p.ts | 5 +++++ packages/sdk/src/create/libp2p.ts | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/interfaces/src/libp2p.ts b/packages/interfaces/src/libp2p.ts index 51905fa7a4..3b7197a0e5 100644 --- a/packages/interfaces/src/libp2p.ts +++ b/packages/interfaces/src/libp2p.ts @@ -30,4 +30,9 @@ export type CreateLibp2pOptions = Libp2pOptions & { */ hideWebSocketInfo?: boolean; pingMaxInboundStreams?: number; + /** + * Applies secure web socket filters. + * @default true + */ + filterMultiaddrs?: boolean; }; diff --git a/packages/sdk/src/create/libp2p.ts b/packages/sdk/src/create/libp2p.ts index ba66dd0b29..84ce5efc5f 100644 --- a/packages/sdk/src/create/libp2p.ts +++ b/packages/sdk/src/create/libp2p.ts @@ -64,13 +64,16 @@ export async function defaultLibp2p( ? { metadata: wakuMetadata(pubsubTopics) } : {}; - const filter = process?.env?.NODE_ENV === "test" ? filterAll : wss; + const filter = + options?.filterMultiaddrs === false || process?.env?.NODE_ENV === "test" + ? filterAll + : wss; return createLibp2p({ connectionManager: { minConnections: 1 }, - transports: [webSockets({ filter })], + transports: [webSockets({ filter: filter })], streamMuxers: [mplex()], connectionEncryption: [noise()], ...options,