Skip to content

Commit

Permalink
fix: allow switch to be configured (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored Apr 12, 2019
1 parent 4cb541d commit eb5aa03
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const configSchema = s({
})

const optionsSchema = s({
switch: 'object?',
connectionManager: s('object', {
minPeers: 25
}),
Expand Down
27 changes: 27 additions & 0 deletions test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eb5aa03

Please sign in to comment.