diff --git a/tests/integration/nat/hole-punching/README.md b/tests/integration/nat/connection-reversal/README.md similarity index 73% rename from tests/integration/nat/hole-punching/README.md rename to tests/integration/nat/connection-reversal/README.md index 93fa7097..459987d6 100644 --- a/tests/integration/nat/hole-punching/README.md +++ b/tests/integration/nat/connection-reversal/README.md @@ -1,4 +1,4 @@ -# NAT hole-punching scenario +# NAT connection-reversal scenario ## Scenario @@ -6,6 +6,9 @@ A node behind a NAT is reachable only through A's relay. When the reachable node C dials it through the relay, the relayed node dials C back directly (C is public) and the relayed connection is upgraded to a direct one. +This is a unilateral reversal — only the NATed node dials, because C is public. +It is not a coordinated hole punch; see `../hole-punch` for the both-NATed case. + ## Topology ``` @@ -25,7 +28,7 @@ node B ──── lan ──── router (NAT) ──── wan ──── ```bash make testNatIntegration \ - STORAGE_INTEGRATION_TEST_INCLUDES=tests/integration/nat/hole-punching/testholepunching.nim + STORAGE_INTEGRATION_TEST_INCLUDES=tests/integration/nat/connection-reversal/testconnectionreversal.nim ``` Builds the shared image and brings the compose topology up and down. Rootless, but @@ -36,8 +39,8 @@ needs the host netfilter modules — if the router fails on iptables: B is `NotReachable` behind the relay, C is `Reachable`. C downloads from B through the relay, which opens a relayed connection; B then dials C back -directly. Hole punching has no REST surface, so the test asserts on B's log line -`Direct connection created.`. +directly. The direct upgrade has no REST surface, so the test asserts on B's log +line `Direct connection created.`. Per-run container logs (router, bootstrap, client, node) are written before teardown to -`tests/integration/logs/__NAT_hole_punching//.log`. +`tests/integration/logs/__NAT_connection_reversal//.log`. diff --git a/tests/integration/nat/hole-punching/compose.yml b/tests/integration/nat/connection-reversal/compose.yml similarity index 96% rename from tests/integration/nat/hole-punching/compose.yml rename to tests/integration/nat/connection-reversal/compose.yml index 0d09ef50..4a75ba32 100644 --- a/tests/integration/nat/hole-punching/compose.yml +++ b/tests/integration/nat/connection-reversal/compose.yml @@ -1,5 +1,5 @@ -# NAT hole-punching scenario — see README.md. Run via testholepunching.nim. -name: nat-hole-punching +# NAT connection-reversal scenario — see README.md. Run via testconnectionreversal.nim. +name: nat-connection-reversal # Topology addresses, named for their role (defined once, referenced below). x-addresses: diff --git a/tests/integration/nat/hole-punching/router-entrypoint.sh b/tests/integration/nat/connection-reversal/router-entrypoint.sh similarity index 100% rename from tests/integration/nat/hole-punching/router-entrypoint.sh rename to tests/integration/nat/connection-reversal/router-entrypoint.sh diff --git a/tests/integration/nat/hole-punching/testholepunching.nim b/tests/integration/nat/connection-reversal/testconnectionreversal.nim similarity index 93% rename from tests/integration/nat/hole-punching/testholepunching.nim rename to tests/integration/nat/connection-reversal/testconnectionreversal.nim index 3d5dc3a4..0c4c1306 100644 --- a/tests/integration/nat/hole-punching/testholepunching.nim +++ b/tests/integration/nat/connection-reversal/testconnectionreversal.nim @@ -1,4 +1,4 @@ -## NAT hole-punching scenario. See README.md. +## NAT connection-reversal scenario. See README.md. import std/[json, os, sequtils, strutils, times] import pkg/chronos @@ -15,12 +15,12 @@ proc announcesCircuitAddr(info: JsonNode): bool = ## A node behind the relay announces its circuit (p2p-circuit) address. info{"announceAddresses"}.getElems.anyIt("p2p-circuit" in it.getStr) -asyncchecksuite "NAT hole punching": +asyncchecksuite "NAT connection reversal": let composeFile = currentSourcePath.parentDir / "compose.yml" nodeApiUrl = "http://127.0.0.1:18088/api/storage/v1" clientApiUrl = "http://127.0.0.1:18089/api/storage/v1" - suiteName = "NAT hole punching" + suiteName = "NAT connection reversal" testName = "a relayed node is upgraded to a direct connection" services = ["router", "bootstrap", "client", "node"] startTime = now().format("yyyy-MM-dd'_'HH:mm:ss")