Skip to content

Better server failure detection and PreserveSourceIPPortWhenDestNATMa…#3648

Merged
xiaokangwang merged 2 commits intov2fly:masterfrom
xiaokangwang:dev-stun-nat-type-detect-improve-k9cg4f9ms4izwcxp041jzeoniog318z8nv2g
Mar 10, 2026
Merged

Better server failure detection and PreserveSourceIPPortWhenDestNATMa…#3648
xiaokangwang merged 2 commits intov2fly:masterfrom
xiaokangwang:dev-stun-nat-type-detect-improve-k9cg4f9ms4izwcxp041jzeoniog318z8nv2g

Conversation

@xiaokangwang
Copy link
Copy Markdown
Contributor

(Machine Generated)
This pull request introduces improvements to the NAT mapping behavior tests in common/natTraversal/stun/natTypeTest.go. The main focus is on increasing the reliability of the mapping behavior test by validating the distinctness of test endpoints and refining the logic for determining whether source IP and port are preserved during NAT traversal.

Validation improvements for mapping behavior:

  • Added a check to ensure that OTHER-ADDRESS from the STUN server differs from the primary server in both IP and port, preventing false positives in mapping behavior tests.

Refined NAT mapping detection logic:

  • Updated the CalcReminderValues method to prioritize using the RESPONSE-ORIGIN attribute for detecting preservation of source IP and port, falling back to hairpin detection only if RESPONSE-ORIGIN is unavailable. This improves accuracy in determining NAT mapping characteristics.
  • Improved fallback logic to more reliably detect whether source address rewriting occurs when RESPONSE-ORIGIN is not present, ensuring the NAT mapping result is set appropriately.…

@xiaokangwang xiaokangwang merged commit e93e5ac into v2fly:master Mar 10, 2026
38 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant