diff --git a/README.md b/README.md index cf4d930802..3c6141043a 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,8 @@ Creates and returns an instance of an IPFS node. Use the `options` argument to s - `enabled` (boolean): whether this module is enabled or disabled - `[custom config]` (any): other keys are specific to the module +- `connectionManager` (object): Configure the libp2p connection manager, see the [documentation for available options](https://github.com/libp2p/js-libp2p-connection-manager#create-a-connectionmanager). + #### Events IPFS instances are Node.js [EventEmitters](https://nodejs.org/dist/latest-v8.x/docs/api/events.html#events_class_eventemitter). You can listen for events by calling `node.on('event', handler)`: diff --git a/package.json b/package.json index 864dc977a7..3c32ca819a 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "expose-loader": "~0.7.5", "form-data": "^2.3.2", "hat": "0.0.3", - "interface-ipfs-core": "~0.70.3", + "interface-ipfs-core": "~0.71.0", "ipfsd-ctl": "~0.37.3", "mocha": "^5.1.1", "ncp": "^2.0.0", diff --git a/src/core/components/libp2p.js b/src/core/components/libp2p.js index 0ed6847d2f..1ad0d1ecac 100644 --- a/src/core/components/libp2p.js +++ b/src/core/components/libp2p.js @@ -48,7 +48,9 @@ module.exports = function libp2p (self) { dht: get(self._options, 'EXPERIMENTAL.dht', false), pubsub: get(self._options, 'EXPERIMENTAL.pubsub', false) } - } + }, + connectionManager: get(self._options, 'connectionManager', + get(config, 'connectionManager', {})) } const libp2pOptions = defaultsDeep( diff --git a/src/core/config.js b/src/core/config.js index 9051dd9816..fe79374ee1 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -25,6 +25,7 @@ const schema = Joi.object().keys({ sharding: Joi.boolean(), dht: Joi.boolean() }).allow(null), + connectionManager: Joi.object().allow(null), config: Joi.object().keys({ Addresses: Joi.object().keys({ Swarm: Joi.array().items(Joi.multiaddr().options({ convert: false })),