Skip to content

Allow for alternative Connection Managers #1581

@maschad

Description

@maschad

Currently Libp2p enforces the DefaultConnectionManager for managing all connections. Whilst it's quite configurable, there are particular use cases in which it is a bit inflexible and a consumer may want to have complete control over the process of opening and closing connections as well as pruning and dialling peers. This could be enabled by passing a module which implements the connection-manager-interface to the Libp2p instance, otherwise it would default to the DefaultConnectionManager with the default config.

const libp2p = await createLibp2p({
  transports: [
    tcp()
  ],
 connectionManager: [
	myConnectionManager({
 		maxConnections: Infinity,
    	minConnections: 0,
    	pollInterval: 2000
          // other configurations
	})
 ]
})

Metadata

Metadata

Assignees

Labels

kind/enhancementA net-new feature or improvement to an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions