mirror of
https://github.com/fosrl/newt.git
synced 2026-03-06 02:36:41 +00:00
Replace O(n) linear search through NAT table with O(1) reverse lookup map for reply packet NAT translation. Changes: - Add reverseConnKey type for reverse NAT lookups - Add reverseNatTable map to ProxyHandler for O(1) lookups - Populate both forward and reverse maps when creating NAT entries - Replace iteration-based reverse lookup with direct map access Performance: - O(n) → O(1) complexity for reverse NAT lookups - Eliminates lock-held iteration on every reply packet - Removes string comparisons from hot path - Expected 10-50x improvement for reverse NAT lookups This addresses Critical #1 from performance analysis where reply path was walking the entire NAT table to find original mapping.
23 KiB
23 KiB