From 52f0f2f1324bb7316157c3bcdbbdb5f1b151e3ad Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 13 Dec 2024 07:36:59 +0000 Subject: [PATCH] fix: confirm external ip (#2895) Confirm the public ip, not the private one --- packages/upnp-nat/src/upnp-port-mapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/upnp-nat/src/upnp-port-mapper.ts b/packages/upnp-nat/src/upnp-port-mapper.ts index 9e242eb81a..52c36e5e76 100644 --- a/packages/upnp-nat/src/upnp-port-mapper.ts +++ b/packages/upnp-nat/src/upnp-port-mapper.ts @@ -202,7 +202,7 @@ export class UPnPPortMapper { this.log('created mapping of %s:%s to %s:%s for protocol %s', mapping.internalHost, mapping.internalPort, mapping.externalHost, mapping.externalPort, transport) if (options?.autoConfirmAddress === true) { - const ma = multiaddr(`/ip${family}/${host}/${transport}/${port}`) + const ma = multiaddr(`/ip${isIPv4(mapping.externalHost) ? 4 : 6}/${mapping.externalHost}/${transport}/${mapping.externalPort}`) this.log('auto-confirming IP address %a', ma) this.addressManager.confirmObservedAddr(ma, { ttl: MAX_DATE - Date.now()