mirror of https://github.com/waku-org/js-waku.git
feat: add libp2p option for max ping connections
This commit is contained in:
parent
73d4f19746
commit
fa523b78af
|
@ -29,4 +29,5 @@ export type CreateLibp2pOptions = Libp2pOptions & {
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
hideWebSocketInfo?: boolean;
|
hideWebSocketInfo?: boolean;
|
||||||
|
pingMaxInboundStreams?: number;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,11 @@ import { wakuGossipSub } from "@waku/relay";
|
||||||
import { ensureShardingConfigured } from "@waku/utils";
|
import { ensureShardingConfigured } from "@waku/utils";
|
||||||
import { createLibp2p } from "libp2p";
|
import { createLibp2p } from "libp2p";
|
||||||
|
|
||||||
import { CreateWakuNodeOptions, DefaultUserAgent } from "../waku.js";
|
import {
|
||||||
|
CreateWakuNodeOptions,
|
||||||
|
DefaultPingMaxInboundStreams,
|
||||||
|
DefaultUserAgent
|
||||||
|
} from "../waku.js";
|
||||||
|
|
||||||
import { defaultPeerDiscoveries } from "./discovery.js";
|
import { defaultPeerDiscoveries } from "./discovery.js";
|
||||||
|
|
||||||
|
@ -70,7 +74,10 @@ export async function defaultLibp2p(
|
||||||
identify: identify({
|
identify: identify({
|
||||||
agentVersion: userAgent ?? DefaultUserAgent
|
agentVersion: userAgent ?? DefaultUserAgent
|
||||||
}),
|
}),
|
||||||
ping: ping(),
|
ping: ping({
|
||||||
|
maxInboundStreams:
|
||||||
|
options?.pingMaxInboundStreams ?? DefaultPingMaxInboundStreams
|
||||||
|
}),
|
||||||
...metadataService,
|
...metadataService,
|
||||||
...pubsubService,
|
...pubsubService,
|
||||||
...options?.services
|
...options?.services
|
||||||
|
|
|
@ -23,6 +23,7 @@ import { subscribeToContentTopic } from "./utils/content_topic.js";
|
||||||
export const DefaultPingKeepAliveValueSecs = 5 * 60;
|
export const DefaultPingKeepAliveValueSecs = 5 * 60;
|
||||||
export const DefaultRelayKeepAliveValueSecs = 5 * 60;
|
export const DefaultRelayKeepAliveValueSecs = 5 * 60;
|
||||||
export const DefaultUserAgent = "js-waku";
|
export const DefaultUserAgent = "js-waku";
|
||||||
|
export const DefaultPingMaxInboundStreams = 10;
|
||||||
|
|
||||||
const log = new Logger("waku");
|
const log = new Logger("waku");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue