Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 2615f76

Browse files
authored
feat: expose libp2p connection manager configuration options (#1410)
* feat: expose libp2p connection manager configuration options License: MIT Signed-off-by: Alan Shaw <[email protected]> * fix: move connection manager config out of experimental License: MIT Signed-off-by: Alan Shaw <[email protected]> * fix: default for connecitonManager if not specified License: MIT Signed-off-by: Alan Shaw <[email protected]> * chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 1a36375 commit 2615f76

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ Creates and returns an instance of an IPFS node. Use the `options` argument to s
247247
- `enabled` (boolean): whether this module is enabled or disabled
248248
- `[custom config]` (any): other keys are specific to the module
249249

250+
- `connectionManager` (object): Configure the libp2p connection manager, see the [documentation for available options](https://github.com/libp2p/js-libp2p-connection-manager#create-a-connectionmanager).
251+
250252
#### Events
251253

252254
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)`:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"expose-loader": "~0.7.5",
7474
"form-data": "^2.3.2",
7575
"hat": "0.0.3",
76-
"interface-ipfs-core": "~0.70.3",
76+
"interface-ipfs-core": "~0.71.0",
7777
"ipfsd-ctl": "~0.37.3",
7878
"mocha": "^5.1.1",
7979
"ncp": "^2.0.0",

src/core/components/libp2p.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ module.exports = function libp2p (self) {
4848
dht: get(self._options, 'EXPERIMENTAL.dht', false),
4949
pubsub: get(self._options, 'EXPERIMENTAL.pubsub', false)
5050
}
51-
}
51+
},
52+
connectionManager: get(self._options, 'connectionManager',
53+
get(config, 'connectionManager', {}))
5254
}
5355

5456
const libp2pOptions = defaultsDeep(

src/core/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const schema = Joi.object().keys({
2525
sharding: Joi.boolean(),
2626
dht: Joi.boolean()
2727
}).allow(null),
28+
connectionManager: Joi.object().allow(null),
2829
config: Joi.object().keys({
2930
Addresses: Joi.object().keys({
3031
Swarm: Joi.array().items(Joi.multiaddr().options({ convert: false })),

0 commit comments

Comments
 (0)