From e6ad51def3ad789821c406365249cac965fc8bcd Mon Sep 17 00:00:00 2001 From: ndrpp Date: Fri, 6 Feb 2026 11:01:06 +0200 Subject: [PATCH 1/2] feat: announce dns p2p addresses --- src/components/P2P/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/P2P/index.ts b/src/components/P2P/index.ts index 6e0bb4fee..0047618a7 100644 --- a/src/components/P2P/index.ts +++ b/src/components/P2P/index.ts @@ -242,6 +242,21 @@ export class OceanP2P extends EventEmitter { shouldAnnounce(addr: any) { try { const maddr = multiaddr(addr) + + const protos = maddr.protoNames() + if ( + protos.includes('dns') || + protos.includes('dns4') || + protos.includes('dns6') || + protos.includes('dnsaddr') + ) { + const addressString = maddr.nodeAddress().address + if (addressString === 'localhost' || addressString === '127.0.0.1') { + return false + } + + return true + } // always filter loopback const addressString = maddr.nodeAddress().address From 2014659824cd44f9396c7e2b4f75f12afa75878d Mon Sep 17 00:00:00 2001 From: ndrpp Date: Fri, 6 Feb 2026 11:22:24 +0200 Subject: [PATCH 2/2] fix: code review --- src/components/P2P/index.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/P2P/index.ts b/src/components/P2P/index.ts index 0047618a7..1336a74ca 100644 --- a/src/components/P2P/index.ts +++ b/src/components/P2P/index.ts @@ -243,22 +243,23 @@ export class OceanP2P extends EventEmitter { try { const maddr = multiaddr(addr) - const protos = maddr.protoNames() + const protos = maddr.getComponents() + const addressString = maddr.nodeAddress().address if ( - protos.includes('dns') || - protos.includes('dns4') || - protos.includes('dns6') || - protos.includes('dnsaddr') + protos.some( + (entry) => + entry.name === 'dns' || + entry.name === 'dns4' || + entry.name === 'dns6' || + entry.name === 'dnsaddr' + ) ) { - const addressString = maddr.nodeAddress().address if (addressString === 'localhost' || addressString === '127.0.0.1') { return false } return true } - // always filter loopback - const addressString = maddr.nodeAddress().address if (!ipaddr.isValid(addressString)) { return false