Skip to content

Commit 52f0f2f

Browse files
authored
fix: confirm external ip (#2895)
Confirm the public ip, not the private one
1 parent a08229b commit 52f0f2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/upnp-nat/src/upnp-port-mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class UPnPPortMapper {
202202
this.log('created mapping of %s:%s to %s:%s for protocol %s', mapping.internalHost, mapping.internalPort, mapping.externalHost, mapping.externalPort, transport)
203203

204204
if (options?.autoConfirmAddress === true) {
205-
const ma = multiaddr(`/ip${family}/${host}/${transport}/${port}`)
205+
const ma = multiaddr(`/ip${isIPv4(mapping.externalHost) ? 4 : 6}/${mapping.externalHost}/${transport}/${mapping.externalPort}`)
206206
this.log('auto-confirming IP address %a', ma)
207207
this.addressManager.confirmObservedAddr(ma, {
208208
ttl: MAX_DATE - Date.now()

0 commit comments

Comments
 (0)