Skip to content

Commit

Permalink
Merge pull request #625 from oceanprotocol/bug/fix_p2p_announce
Browse files Browse the repository at this point in the history
P2P: fix external address announce
  • Loading branch information
alexcos20 authored Aug 15, 2024
2 parents 69a9653 + f84b0e4 commit 2f8af03
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 2f8af03

Please sign in to comment.