From eb5aa0323215c366382c929b69016414875e9454 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Fri, 12 Apr 2019 11:10:09 +0200 Subject: [PATCH] fix: allow switch to be configured (#354) --- src/config.js | 1 + test/config.spec.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/config.js b/src/config.js index 7252785326..07afa9a58d 100644 --- a/src/config.js +++ b/src/config.js @@ -85,6 +85,7 @@ const configSchema = s({ }) const optionsSchema = s({ + switch: 'object?', connectionManager: s('object', { minPeers: 25 }), diff --git a/test/config.spec.js b/test/config.spec.js index 547dddd754..d9b63173b0 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -170,6 +170,33 @@ describe('configuration', () => { expect(validateConfig(options)).to.deep.equal(expected) }) + it('should allow for configuring the switch', () => { + const options = { + peerInfo, + switch: { + blacklistTTL: 60e3, + blackListAttempts: 5, + maxParallelDials: 100, + maxColdCalls: 50, + dialTimeout: 30e3 + }, + modules: { + transport: [ WS ], + peerDiscovery: [ ] + } + } + + expect(validateConfig(options)).to.deep.include({ + switch: { + blacklistTTL: 60e3, + blackListAttempts: 5, + maxParallelDials: 100, + maxColdCalls: 50, + dialTimeout: 30e3 + } + }) + }) + it('should allow for delegated content and peer routing', () => { const peerRouter = new DelegatedPeerRouter() const contentRouter = new DelegatedContentRouter(peerInfo)