Skip to content

Commit 2cc0fec

Browse files
committed
max relays 2, only allow if enableCircuitRelayClient
1 parent 6d4e53c commit 2cc0fec

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/components/P2P/index.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,9 @@ export class OceanP2P extends EventEmitter {
331331
`/ip6/${config.p2pConfig.ipV6BindAddress}/tcp/${config.p2pConfig.ipV6BindWsPort}/ws`
332332
)
333333
}
334-
// Include /p2p-circuit in listen addresses so that circuitRelayTransport
335-
// discovers relay servers and makes reservations. Without this, the
336-
// transport never calls reserveRelay() and browser clients can't reach
337-
// this node via circuit relay.
338-
const listenAddrs = [...bindInterfaces, '/p2p-circuit']
334+
const listenAddrs = config.p2pConfig.enableCircuitRelayClient
335+
? [...bindInterfaces, '/p2p-circuit']
336+
: bindInterfaces
339337
let addresses = {}
340338
if (
341339
config.p2pConfig.announceAddresses &&
@@ -400,7 +398,14 @@ export class OceanP2P extends EventEmitter {
400398
// eslint-disable-next-line no-constant-condition, no-self-compare
401399
if (config.p2pConfig.enableCircuitRelayServer) {
402400
P2P_LOGGER.info('Enabling Circuit Relay Server')
403-
servicesConfig = { ...servicesConfig, ...{ circuitRelay: circuitRelayServer() } }
401+
servicesConfig = {
402+
...servicesConfig,
403+
...{
404+
circuitRelay: circuitRelayServer({
405+
reservations: { maxReservations: 2 }
406+
})
407+
}
408+
}
404409
}
405410
// eslint-disable-next-line no-constant-condition, no-self-compare
406411
if (config.p2pConfig.upnp) {

0 commit comments

Comments
 (0)