Interface ConnectionManagerInit

interface ConnectionManagerInit {
    addressSorter?: AddressSorter;
    allow?: string[];
    deny?: string[];
    dialTimeout?: number;
    inboundConnectionThreshold?: number;
    inboundUpgradeTimeout?: number;
    maxConnections?: number;
    maxDialQueueLength?: number;
    maxIncomingPendingConnections?: number;
    maxParallelDials?: number;
    maxParallelReconnects?: number;
    maxPeerAddrsToDial?: number;
    outboundUpgradeTimeout?: number;
    protocolNegotiationTimeout?: number;
    reconnectBackoffFactor?: number;
    reconnectRetries?: number;
    reconnectRetryInterval?: number;
    resolvers?: Record<string, Resolver<AbortOptions>>;
}

Properties

addressSorter?: AddressSorter

Sort the known addresses of a peer before trying to dial, By default public addresses will be dialled before private (e.g. loopback or LAN) addresses.

allow?: string[]

A list of multiaddrs that will always be allowed (except if they are in the deny list) to open connections to this node even if we've reached maxConnections

deny?: string[]

A list of multiaddrs that will never be allowed to open connections to this node under any circumstances

dialTimeout?: number

How long a dial attempt is allowed to take, including DNS resolution of the multiaddr, opening a socket and upgrading it to a Connection.

Default

5000
inboundConnectionThreshold?: number

If more than this many connections are opened per second by a single host, reject subsequent connections.

Default

5
inboundUpgradeTimeout?: number

When a new incoming connection is opened, the upgrade process (e.g. protect, encrypt, multiplex etc) must complete within this number of ms.

Default

3000
maxConnections?: number

The maximum number of connections libp2p is willing to have before it starts pruning connections to reduce resource usage.

Default

300/100
maxDialQueueLength?: number

The maximum size the dial queue is allowed to grow to. Promises returned when dialing peers after this limit is reached will not resolve until the queue size falls beneath this size.

Default

500
maxIncomingPendingConnections?: number

The maximum number of parallel incoming connections allowed that have yet to complete the connection upgrade - e.g. choosing connection encryption, muxer, etc.

Default

10
maxParallelDials?: number

The maximum number of dials across all peers to execute in parallel.

Default

100/50
maxParallelReconnects?: number

When a peers tagged with KEEP_ALIVE disconnect, reconnect to this many at once.

Default

5
maxPeerAddrsToDial?: number

Maximum number of addresses allowed for a given peer before giving up

Default

25
outboundUpgradeTimeout?: number

When a new outbound connection is opened, the upgrade process (e.g. protect, encrypt, multiplex etc) must complete within this number of ms.

Default

3000
protocolNegotiationTimeout?: number

Protocol negotiation must complete within this number of ms

Default

2000
reconnectBackoffFactor?: number

When a peer tagged with KEEP_ALIVE disconnects, apply this multiplication factor to the time interval between each retry.

Default

2
reconnectRetries?: number

When a peer tagged with KEEP_ALIVE disconnects, attempt to redial them this many times.

Default

5
reconnectRetryInterval?: number

When a peer tagged with KEEP_ALIVE disconnects, wait this long between each retry. Note this will be multiplied by reconnectFactor to create an increasing retry backoff.

Default

1000
resolvers?: Record<string, Resolver<AbortOptions>>

Multiaddr resolvers to use when dialling