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

Commit

Permalink
feat: expose libp2p connection manager configuration options (#1410)
Browse files Browse the repository at this point in the history
* feat: expose libp2p connection manager configuration options

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* fix: move connection manager config out of experimental

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* fix: default for connecitonManager if not specified

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* chore: update interface-ipfs-core dependency

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw authored Jul 5, 2018
1 parent 1a36375 commit 2615f76
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })),
Expand Down

0 comments on commit 2615f76

Please sign in to comment.