Skip to content

Commit 05141b7

Browse files
committed
Portal: use new eth/nat setupAddress
This avoids doing an unneeded portmap for TCP
1 parent 84408c9 commit 05141b7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

portal/client/nimbus_portal_client.nim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ proc run(portalClient: PortalClient, config: PortalConf) {.raises: [CatchableErr
105105
let
106106
bindIp = config.listenAddress
107107
udpPort = Port(config.udpPort)
108-
# TODO: allow for no TCP port mapping!
109-
(extIp, _, extUdpPort) = setupAddress(
110-
config.nat, config.listenAddress, udpPort, udpPort, "nimbus_portal_client"
108+
(extIp, extPorts) = setupAddress(
109+
config.nat, config.listenAddress, @[(port: udpPort, protocol: PortProtocol.UDP)], "nimbus_portal_client"
111110
)
111+
extUdpPort =
112+
if isSome(extPorts[0]):
113+
Opt.some(extPorts[0].value().port)
114+
else:
115+
Opt.none(Port)
112116
(netkey, newNetKey) =
113117
if config.networkKey.isSome():
114118
(config.networkKey.get(), true)

0 commit comments

Comments
 (0)