This commit is contained in:
Arnaud 2026-06-15 18:01:14 +04:00
parent d33878e214
commit ec24e0ffdc
No known key found for this signature in database
GPG Key ID: A6C7C781817146FA
2 changed files with 6 additions and 7 deletions

View File

@ -134,8 +134,8 @@ method hasMappingIds*(m: NatPortMapper): bool {.base, gcsafe.} =
m.tcpMappingId.isSome and m.udpMappingId.isSome
proc setupMappedAddrMapper*(switch: Switch, natMapper: NatPortMapper) =
## We define a custom mapper that adds the external port to peerInfo.addrs when
## a port mapping is active, so AutoNAT tests that port.
## We define a custom mapper that adds the externally-mapped address to
## peerInfo.addrs when a port mapping is active, so AutoNAT tests that port.
## PCP/NAT-PMP may grant an external port different from the listen port.
let mapper: AddressMapper = proc(
addrs: seq[MultiAddress]
@ -192,7 +192,7 @@ method handleNatStatus*(
discovery.protocol.clientMode = true
if not autoRelayService.isRunning:
if not autoRelayService.isRunning and discovery.announceAddrs.len > 0:
# Remove any announced addresses, they will be replaced.
# If the relay is running, the addresses will be updated on reservation.
discovery.announceDirectAddrs(@[], udpPort = discoveryPort)
@ -218,8 +218,8 @@ method handleNatStatus*(
info "Port mapping created successfully", tcpPort, udpPort, protocol
# The address mapper will use the mapped ports map the addresses for
# libp2p.
# The address mapper uses the mapped port to build the candidate address
# for AutoNAT; the announce happens once AutoNAT confirms Reachable.
hasPortMapping = true
else:

View File

@ -6,8 +6,7 @@ import std/[os, osproc]
import ../utils
proc composeCmd(composeFile: string): string =
## Match the engine the Makefile builds the image with (podman first), so the
## compose tool sees that image.
## Prefer podman (where the Makefile builds the image), fall back to docker.
let base =
if findExe("podman-compose") != "":
"podman-compose"