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,