feat: optimize edge routing for global latency reduction

โœ“ Ready for Review Merge Pull Request Update Branch

This PR introduces the new adaptive edge routing algorithm. It significantly reduces latency by ~40ms for users in AP-AC and EU-West regions by caching DNS lookups more aggressively and utilizing the new UDP-based handshake protocol.

Changes included:

  • Refactored `EdgeRouter` class to support async resolution.
  • Added fallback logic for IPv6 connectivity issues.
  • Updated unit tests to cover edge cases in `resolver.test.ts`.
๐Ÿ“„ src/core/EdgeRouter.ts
+42 -18 lines
18 // Legacy DNS resolution
19 async resolve(host: string) { return await fetchDNS(host);}
20
21 // New adaptive resolution with caching
22 async resolve(host: string) { if (this.cache.has(host)) return this.cache.get(host); const target = await this.upstream.resolve(host); this.cache.set(host, target, { ttl: 60000 }); return target;}
๐Ÿงช tests/EdgeRouter.test.ts
+128 -0 lines
45
46 it('should cache successful DNS lookups', async () => { // ... test implementation });
Conversation 1
MK Marcus.Kim reviewed 2 hours ago
Looks solid. The caching TTL logic is exactly what we discussed in the architecture review. Just one question about the fallback handler on line 45 in `utils.ts`.
Reviewers
SL
Sarah_Lee โœ“ Approved
JT
John_Torres Pending
Checks
โœ“ continuous-integration/github-action (Build)
โœ“ license/cla (All CLA signed)
โณ performance/regression-test (Running)
Linked Issues
# #1204 Improve edge latency