Skip to content

feat(stun): STUN server deduplication and concurrent multi-provider resolution - #82

Merged
dweekly merged 2 commits into
mainfrom
feat/stun-redundancy
Sep 4, 2026
Merged

feat(stun): STUN server deduplication and concurrent multi-provider resolution#82
dweekly merged 2 commits into
mainfrom
feat/stun-redundancy

Conversation

@dweekly

@dweekly dweekly commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses Item 2 of ROADMAP.md ("STUN server list provides no actual redundancy"):

  • Deduplicated STUN server list: Removed redundant stun1.l.google.com (which resolves to the exact same IP as stun.l.google.com, providing zero IP-level failover while multiplying DNS stall costs). The server list now contains distinct independent providers on distinct networks: Google (stun.l.google.com:19302) and Cloudflare (stun.cloudflare.com:3478).
  • Concurrent multi-provider resolution: STUN fallback now resolves all endpoints concurrently across worker threads using DispatchQueue.concurrentPerform and thread-safe collection. If one provider's DNS query stalls (e.g. against an unresponsive or slow resolver), the other provider's resolution completes in parallel rather than paying consecutive 30-second serial timeouts.
  • Pre-resolved query path: Added internal stunGetPublicIP overload operating on pre-resolved sockaddr_storage, preserving zero DNS delay between retries.

Stacked on top of #81 (feat/seed-public-ip).

Testing

  • Unit tests in STUNTests.swift:
    • testSTUNServerList: Verifies multi-provider presence (Google + Cloudflare) and asserts no duplicate hostnames exist.
    • testResolveSTUNServer: Verifies resolution succeeds for valid targets and fails cleanly for invalid hosts.
    • All 40 STUN tests and 334 repository tests pass.
  • Formatting checked with swift format lint --strict.
  • DocC documentation builds warning-clean with --warnings-as-errors.

@dweekly
dweekly force-pushed the feat/seed-public-ip branch 2 times, most recently from 9515dec to cc67069 Compare September 3, 2026 00:24
@dweekly
dweekly force-pushed the feat/stun-redundancy branch from 278e712 to 26e8d53 Compare September 3, 2026 00:24
@dweekly
dweekly force-pushed the feat/seed-public-ip branch from cc67069 to 5244313 Compare September 3, 2026 01:44
@dweekly
dweekly force-pushed the feat/stun-redundancy branch from 26e8d53 to c43e3d7 Compare September 3, 2026 01:44
@dweekly
dweekly force-pushed the feat/seed-public-ip branch from 5244313 to deb2c3a Compare September 3, 2026 01:50
@dweekly
dweekly force-pushed the feat/stun-redundancy branch from c43e3d7 to f392faa Compare September 3, 2026 01:50
@dweekly
dweekly force-pushed the feat/stun-redundancy branch from f392faa to 2d36e42 Compare September 3, 2026 23:59
@dweekly
dweekly changed the base branch from feat/seed-public-ip to main September 4, 2026 00:00
@dweekly
dweekly merged commit 489b395 into main Sep 4, 2026
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