mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-27 21:09:28 +00:00
Add more checks for nat integration tests
This commit is contained in:
parent
caff5f3136
commit
c6bfc88926
@ -5,6 +5,10 @@
|
||||
import std/[os, osproc]
|
||||
import ../utils
|
||||
|
||||
const
|
||||
routerWanIp* = "7.7.7.2" ## public IP AutoNAT observes for a NATed node (masquerade)
|
||||
bootstrapIp* = "7.7.7.10" ## relay + bootstrap public IP
|
||||
|
||||
proc composeCmd(composeFile: string): string =
|
||||
## Prefer podman (where the Makefile builds the image), fall back to docker.
|
||||
let base =
|
||||
|
||||
@ -45,3 +45,10 @@ asyncchecksuite "NAT not reachable":
|
||||
check nat{"relayRunning"}.getBool
|
||||
check nat{"portMapping"}.getStr == "none"
|
||||
check info.announcesCircuitAddr()
|
||||
let announced = info{"announceAddresses"}.getElems.mapIt(it.getStr)
|
||||
# the announced circuit address points at the bootstrap's relay
|
||||
check announced.anyIt(
|
||||
("/ip4/" & bootstrapIp & "/tcp/8070" in it) and ("p2p-circuit" in it)
|
||||
)
|
||||
# relay addresses go only into the provider record, never the DHT routing record
|
||||
check info{"dhtAddresses"}.getElems.len == 0
|
||||
|
||||
@ -52,3 +52,9 @@ asyncchecksuite "NAT pcp":
|
||||
check nat{"relayRunning"}.getBool == false
|
||||
check nat{"portMapping"}.getStr == "pcp"
|
||||
check info.announcesDirectAddr()
|
||||
let announced = info{"announceAddresses"}.getElems.mapIt(it.getStr)
|
||||
# PCP may map a port different from the listen port, so check the IP only
|
||||
check announced.anyIt(("/ip4/" & routerWanIp & "/tcp/") in it)
|
||||
# the public mapped address
|
||||
# a reachable node announces its UDP address to the DHT routing record
|
||||
check info{"dhtAddresses"}.getElems.len > 0
|
||||
|
||||
@ -52,3 +52,8 @@ asyncchecksuite "NAT reachable":
|
||||
check nat{"reachability"}.getStr == "Reachable"
|
||||
check nat{"relayRunning"}.getBool == false
|
||||
check info.announcesDirectAddr()
|
||||
let announced = info{"announceAddresses"}.getElems.mapIt(it.getStr)
|
||||
check announced.anyIt(("/ip4/" & routerWanIp & "/tcp/8070") in it)
|
||||
# public forwarded address
|
||||
# a reachable node announces its UDP address to the DHT routing record
|
||||
check info{"dhtAddresses"}.getElems.len > 0
|
||||
|
||||
@ -52,3 +52,8 @@ asyncchecksuite "NAT upnp":
|
||||
check nat{"relayRunning"}.getBool == false
|
||||
check nat{"portMapping"}.getStr == "upnp"
|
||||
check info.announcesDirectAddr()
|
||||
let announced = info{"announceAddresses"}.getElems.mapIt(it.getStr)
|
||||
check announced.anyIt(("/ip4/" & routerWanIp & "/tcp/8070") in it)
|
||||
# public mapped address
|
||||
# a reachable node announces its UDP address to the DHT routing record
|
||||
check info{"dhtAddresses"}.getElems.len > 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user