Skip to content

Commit

Permalink
P2P: fix external address announce
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Aug 15, 2024
1 parent 69a9653 commit f84b0e4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,27 @@ export class OceanP2P extends EventEmitter {
P2P_LOGGER.info('Enabling P2P Transports: websockets, tcp')
transports = [webSockets(), tcp()]
}
let options = {
addresses: {

let addresses = {}
if (
config.p2pConfig.announceAddresses &&
config.p2pConfig.announceAddresses.length > 0
) {
addresses = {
listen: bindInterfaces,
announceFilter: (multiaddrs: any[]) =>
multiaddrs.filter((m) => this.shouldAnnounce(m)),
announce: config.p2pConfig.announceAddresses
}
} else {
addresses = {
listen: bindInterfaces,
announceFilter: (multiaddrs: any[]) =>
multiaddrs.filter((m) => this.shouldAnnounce(m))
},
}
}
let options = {
addresses,
peerId: config.keys.peerId,
transports,
streamMuxers: [yamux()],
Expand Down

0 comments on commit f84b0e4

Please sign in to comment.