Skip to content

Commit

Permalink
chore: enabile back filterAll if set by consumer (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
weboko authored Aug 22, 2024
1 parent 409642d commit 2beb359
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/interfaces/src/libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ export type CreateLibp2pOptions = Libp2pOptions & {
*/
hideWebSocketInfo?: boolean;
pingMaxInboundStreams?: number;
/**
* Applies secure web socket filters.
* @default true
*/
filterMultiaddrs?: boolean;
};
7 changes: 5 additions & 2 deletions packages/sdk/src/create/libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2beb359

Please sign in to comment.