|
|
|
|
@ -34,7 +34,8 @@ def check_profiles(scenario):
|
|
|
|
|
agents[owner.name].rpc("nat_check", socket=protocol, observer=agents[observer.name].identity) |
|
|
|
|
data = scenario.wait(f"nat-profile-{owner.name}-{protocol}", lambda statistics: |
|
|
|
|
profile(statistics[owner.name], protocol)["rounds"] > before["rounds"] and |
|
|
|
|
profile(statistics[owner.name], protocol)["phase"] == 0, 40) |
|
|
|
|
profile(statistics[owner.name], protocol)["phase"] == 0 and |
|
|
|
|
not profile(statistics[owner.name], protocol)["cycling"], 40) |
|
|
|
|
return profile(data[owner.name], protocol) |
|
|
|
|
|
|
|
|
|
# Отсутствие второго наблюдателя не превращается в STRICT/DIRECT. |
|
|
|
|
@ -45,6 +46,19 @@ def check_profiles(scenario):
|
|
|
|
|
if (incomplete["mapping"], incomplete["inbound"], incomplete["reason"]) != ("UNKNOWN", "UNKNOWN", "no_helper"): |
|
|
|
|
raise RuntimeError(f"NAT no-helper test: {incomplete}") |
|
|
|
|
|
|
|
|
|
# Третий узел за NAT появляется через B: A не имеет ни линка, ни прежнего UDP-контакта с C. |
|
|
|
|
private_helper = next(node for node in NODES if node.nat) |
|
|
|
|
agents[first.name].rpc("nat_auto", enabled=1) |
|
|
|
|
connect(private_helper, second) |
|
|
|
|
data = scenario.wait("nat-routed-private-helper", lambda statistics: |
|
|
|
|
(profile(statistics[first.name], "udp")["mapping"], |
|
|
|
|
profile(statistics[first.name], "udp")["inbound"]) == ("UNCHANGED", "OPEN"), 40) |
|
|
|
|
actual = profile(data[first.name], "udp") |
|
|
|
|
if actual["helper"] != agents[private_helper.name].identity or agents[private_helper.name].identity in data[first.name]["direct_up"]: |
|
|
|
|
raise RuntimeError(f"NAT indirect private helper was not used: {actual}") |
|
|
|
|
agents[first.name].rpc("nat_auto", enabled=0) |
|
|
|
|
print(f"NAT routed private helper: {private_helper.name} through {second.name}, group={actual['group']}", flush=True) |
|
|
|
|
|
|
|
|
|
verified = {} |
|
|
|
|
for owner in public + [node for node in NODES if node.nat]: |
|
|
|
|
observer = second if owner.name == first.name else first |
|
|
|
|
|