2023-09-29 13:30:07 +00:00
|
|
|
{.used.}
|
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
import chronos, confutils/toml/std/net, libp2p/multiaddress, testutils/unittests
|
2023-09-29 13:30:07 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
import ./testlib/wakunode, ../../waku/waku_enr/capabilities
|
2023-09-29 13:30:07 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
include ../../waku/node/config
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
proc defaultTestWakuFlags(): CapabilitiesBitfield =
|
|
|
|
CapabilitiesBitfield.init(
|
2024-03-15 23:08:47 +00:00
|
|
|
lightpush = false, filter = false, store = false, relay = true
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
suite "Waku NetConfig":
|
|
|
|
asyncTest "Create NetConfig with default values":
|
|
|
|
let conf = defaultTestWakuNodeConf()
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let wakuFlags = defaultTestWakuFlags()
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = none(IpAddress),
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = none(Port),
|
|
|
|
extMultiAddrs = @[],
|
|
|
|
wsBindPort = conf.websocketPort,
|
|
|
|
wsEnabled = conf.websocketSupport,
|
|
|
|
wssEnabled = conf.websocketSecureSupport,
|
|
|
|
dns4DomainName = none(string),
|
|
|
|
discv5UdpPort = none(Port),
|
2024-03-15 23:08:47 +00:00
|
|
|
wakuFlags = some(wakuFlags),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
check:
|
|
|
|
netConfigRes.isOk()
|
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses contains only bind address when no external addresses are provided":
|
|
|
|
let conf = defaultTestWakuNodeConf()
|
2024-03-15 23:08:47 +00:00
|
|
|
|
|
|
|
let netConfigRes =
|
|
|
|
NetConfig.init(bindIp = conf.listenAddress, bindPort = conf.tcpPort)
|
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 1 # Only bind address should be present
|
|
|
|
netConfig.announcedAddresses[0] ==
|
|
|
|
formatListenAddress(ip4TcpEndPoint(conf.listenAddress, conf.tcpPort))
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses contains external address if extIp/Port are provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
extIp = some(extIp),
|
2024-03-15 23:08:47 +00:00
|
|
|
extPort = some(extPort),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 1 # Only external address should be present
|
2023-09-29 13:30:07 +00:00
|
|
|
netConfig.announcedAddresses[0] == ip4TcpEndPoint(extIp, extPort)
|
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses contains dns4DomainName if provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
dns4DomainName = "example.com"
|
|
|
|
extPort = Port(1234)
|
|
|
|
|
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
dns4DomainName = some(dns4DomainName),
|
2024-03-15 23:08:47 +00:00
|
|
|
extPort = some(extPort),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 1 # Only DNS address should be present
|
2023-09-29 13:30:07 +00:00
|
|
|
netConfig.announcedAddresses[0] == dns4TcpEndPoint(dns4DomainName, extPort)
|
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses includes extMultiAddrs when provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
|
|
|
extMultiAddrs = @[ip4TcpEndPoint(extIp, extPort)]
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
2024-03-15 23:08:47 +00:00
|
|
|
extMultiAddrs = extMultiAddrs,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + extAddress
|
2023-09-29 13:30:07 +00:00
|
|
|
netConfig.announcedAddresses[1] == extMultiAddrs[0]
|
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses uses dns4DomainName over extIp when both are provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
dns4DomainName = "example.com"
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
dns4DomainName = some(dns4DomainName),
|
|
|
|
extIp = some(extIp),
|
2024-03-15 23:08:47 +00:00
|
|
|
extPort = some(extPort),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 1 # DNS address
|
|
|
|
netConfig.announcedAddresses[0] == dns4TcpEndPoint(dns4DomainName, extPort)
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
asyncTest "AnnouncedAddresses includes WebSocket addresses when enabled":
|
2024-03-15 23:08:47 +00:00
|
|
|
var
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
wssEnabled = false
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
var netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
wsEnabled = true,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
var netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + wsHostAddress
|
|
|
|
netConfig.announcedAddresses[1] ==
|
|
|
|
(ip4TcpEndPoint(conf.listenAddress, conf.websocketPort) & wsFlag(wssEnabled))
|
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
## Now try the same for the case of wssEnabled = true
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
wssEnabled = true
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
wsEnabled = true,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + wsHostAddress
|
|
|
|
netConfig.announcedAddresses[1] ==
|
|
|
|
(ip4TcpEndPoint(conf.listenAddress, conf.websocketPort) & wsFlag(wssEnabled))
|
2023-09-29 13:30:07 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
asyncTest "Announced WebSocket address contains external IP if provided":
|
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
|
|
|
wssEnabled = false
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
extIp = some(extIp),
|
|
|
|
extPort = some(extPort),
|
|
|
|
wsEnabled = true,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # External address + wsHostAddress
|
|
|
|
netConfig.announcedAddresses[1] ==
|
|
|
|
(ip4TcpEndPoint(extIp, conf.websocketPort) & wsFlag(wssEnabled))
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
asyncTest "Announced WebSocket address contains dns4DomainName if provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
dns4DomainName = "example.com"
|
|
|
|
extPort = Port(1234)
|
|
|
|
wssEnabled = false
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
dns4DomainName = some(dns4DomainName),
|
|
|
|
extPort = some(extPort),
|
|
|
|
wsEnabled = true,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + wsHostAddress
|
|
|
|
netConfig.announcedAddresses[1] ==
|
|
|
|
(dns4TcpEndPoint(dns4DomainName, conf.websocketPort) & wsFlag(wssEnabled))
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
asyncTest "Announced WebSocket address contains dns4DomainName if provided alongside extIp":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
dns4DomainName = "example.com"
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
|
|
|
wssEnabled = false
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
dns4DomainName = some(dns4DomainName),
|
|
|
|
extIp = some(extIp),
|
|
|
|
extPort = some(extPort),
|
|
|
|
wsEnabled = true,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # DNS address + wsHostAddress
|
2023-09-29 13:30:07 +00:00
|
|
|
netConfig.announcedAddresses[0] == dns4TcpEndPoint(dns4DomainName, extPort)
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses[1] ==
|
|
|
|
(dns4TcpEndPoint(dns4DomainName, conf.websocketPort) & wsFlag(wssEnabled))
|
2023-09-29 13:30:07 +00:00
|
|
|
|
|
|
|
asyncTest "ENR is set with bindIp/Port if no extIp/Port are provided":
|
|
|
|
let conf = defaultTestWakuNodeConf()
|
2024-03-15 23:08:47 +00:00
|
|
|
|
|
|
|
let netConfigRes =
|
|
|
|
NetConfig.init(bindIp = conf.listenAddress, bindPort = conf.tcpPort)
|
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
|
|
|
netConfig.enrIp.get() == conf.listenAddress
|
|
|
|
netConfig.enrPort.get() == conf.tcpPort
|
|
|
|
|
|
|
|
asyncTest "ENR is set with extIp/Port if provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extIp = parseIpAddress("1.2.3.4")
|
2023-09-29 13:30:07 +00:00
|
|
|
extPort = Port(1234)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
extIp = some(extIp),
|
2024-03-15 23:08:47 +00:00
|
|
|
extPort = some(extPort),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-09-29 13:30:07 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
|
|
|
netConfig.extIp.get() == extIp
|
|
|
|
netConfig.enrPort.get() == extPort
|
|
|
|
|
|
|
|
asyncTest "ENR is set with dns4DomainName if provided":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-09-29 13:30:07 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
|
|
|
dns4DomainName = "example.com"
|
|
|
|
extPort = Port(1234)
|
|
|
|
|
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
dns4DomainName = some(dns4DomainName),
|
2024-03-15 23:08:47 +00:00
|
|
|
extPort = some(extPort),
|
2023-09-29 13:30:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
|
|
|
netConfig.enrMultiaddrs.contains(dns4TcpEndPoint(dns4DomainName, extPort))
|
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
asyncTest "wsHostAddress is not announced if a WS/WSS address is provided in extMultiAddrs":
|
2024-03-15 23:08:47 +00:00
|
|
|
var
|
2023-10-17 09:53:41 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extAddIp = parseIpAddress("1.2.3.4")
|
2023-10-17 09:53:41 +00:00
|
|
|
extAddPort = Port(1234)
|
2023-10-24 15:39:25 +00:00
|
|
|
wsEnabled = true
|
2023-10-17 09:53:41 +00:00
|
|
|
wssEnabled = false
|
|
|
|
extMultiAddrs = @[(ip4TcpEndPoint(extAddIp, extAddPort) & wsFlag(wssEnabled))]
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
var netConfigRes = NetConfig.init(
|
2023-10-17 09:53:41 +00:00
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
2023-10-24 15:39:25 +00:00
|
|
|
extMultiAddrs = extMultiAddrs,
|
2024-03-15 23:08:47 +00:00
|
|
|
wsEnabled = wsEnabled,
|
2023-10-17 09:53:41 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-10-17 09:53:41 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
var netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + extAddress
|
2023-10-24 15:39:25 +00:00
|
|
|
netConfig.announcedAddresses[1] == extMultiAddrs[0]
|
|
|
|
|
|
|
|
# Now same test for WSS external address
|
|
|
|
wssEnabled = true
|
|
|
|
extMultiAddrs = @[(ip4TcpEndPoint(extAddIp, extAddPort) & wsFlag(wssEnabled))]
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
extMultiAddrs = extMultiAddrs,
|
2024-03-15 23:08:47 +00:00
|
|
|
wssEnabled = wssEnabled,
|
2023-10-24 15:39:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
netConfig = netConfigRes.get()
|
2023-10-17 09:53:41 +00:00
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 2 # Bind address + extAddress
|
2023-10-17 09:53:41 +00:00
|
|
|
netConfig.announcedAddresses[1] == extMultiAddrs[0]
|
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
asyncTest "Only extMultiAddrs are published when enabling extMultiAddrsOnly flag":
|
2024-03-15 23:08:47 +00:00
|
|
|
let
|
2023-10-24 15:39:25 +00:00
|
|
|
conf = defaultTestWakuNodeConf()
|
2023-12-14 06:16:39 +00:00
|
|
|
extAddIp = parseIpAddress("1.2.3.4")
|
2023-10-24 15:39:25 +00:00
|
|
|
extAddPort = Port(1234)
|
|
|
|
extMultiAddrs = @[ip4TcpEndPoint(extAddIp, extAddPort)]
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
let netConfigRes = NetConfig.init(
|
|
|
|
bindIp = conf.listenAddress,
|
|
|
|
bindPort = conf.tcpPort,
|
|
|
|
extMultiAddrs = extMultiAddrs,
|
2024-03-15 23:08:47 +00:00
|
|
|
extMultiAddrsOnly = true,
|
2023-10-24 15:39:25 +00:00
|
|
|
)
|
2024-03-15 23:08:47 +00:00
|
|
|
|
2023-10-24 15:39:25 +00:00
|
|
|
assert netConfigRes.isOk(), $netConfigRes.error
|
|
|
|
|
|
|
|
let netConfig = netConfigRes.get()
|
|
|
|
|
|
|
|
check:
|
2024-03-15 23:08:47 +00:00
|
|
|
netConfig.announcedAddresses.len == 1 # ExtAddress
|
2023-10-24 15:39:25 +00:00
|
|
|
netConfig.announcedAddresses[0] == extMultiAddrs[0]
|