mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-11 13:56:14 -08:00
Register one UDP flow at bind so sockets can receive from new peers before their first send. Allocate and reserve ports within each instance independently of TUN and Host sockets. Release the endpoint on close. Search the ephemeral range once and preserve concurrent cursor progress. Route local UDP fragments by the first fragment's bound endpoint. Buffer earlier tails in a bounded shallow cache and forward original packets to one recipient. Preserve cached ownership across binding changes, expire idle entries, and clear state on address changes and runtime shutdown. This avoids orphan fragments exhausting smoltcp's reassembly slots while keeping original packet sizes for TUN and proxy consumers. Randomize each new stack's seed to avoid replaying IP IDs on rebuild. Document accepted residual collision-related UDP loss or downstream delivery instead of adding fragment completion tracking. Allow peer filters to return a batch, resuming each packet at the next filter without repeating earlier filters. The single-packet path does not allocate a batch queue. Keep ZCPacket and IpReassembler unchanged. Cover endpoint ownership, ephemeral allocation, out-of-order fragments, cache limits and expiry, binding changes, batch continuation, and large UDP datagrams after more than 16 complete unrelated fragmented datagrams. Exercise two recreated sending stacks with controlled seeds to verify that new fragments do not inherit an old downstream route. Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>