mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-03-30 22:31:03 +00:00
fix: allow switch to be configured (#354)
This commit is contained in:
parent
4cb541ddae
commit
eb5aa03232
@ -85,6 +85,7 @@ const configSchema = s({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const optionsSchema = s({
|
const optionsSchema = s({
|
||||||
|
switch: 'object?',
|
||||||
connectionManager: s('object', {
|
connectionManager: s('object', {
|
||||||
minPeers: 25
|
minPeers: 25
|
||||||
}),
|
}),
|
||||||
|
@ -170,6 +170,33 @@ describe('configuration', () => {
|
|||||||
expect(validateConfig(options)).to.deep.equal(expected)
|
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', () => {
|
it('should allow for delegated content and peer routing', () => {
|
||||||
const peerRouter = new DelegatedPeerRouter()
|
const peerRouter = new DelegatedPeerRouter()
|
||||||
const contentRouter = new DelegatedContentRouter(peerInfo)
|
const contentRouter = new DelegatedContentRouter(peerInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user