Conversation
Port daeuniverse/dae PR #1030 (fixes #1029): a proxy WriteTo may report the on-wire byte count including protocol encapsulation overhead (e.g. shadowsocks AES-128-GCM + IPv4 = +39), so n can legitimately exceed len(b). UDP datagrams are atomic, so only n < len(b) is a genuine short write worth retiring the endpoint over. Relaxing 'n != len(b)' -> 'n < len(b)' stops false-positive endpoint retirement that manifested as udp4 flapping / QUIC jitter with encapsulating outbounds (Shadowsocks/VMess packet-addr). Success return is left as the on-wire n (not normalized to len(b)) to stay byte-for-byte with upstream #1030 for future rebases. Adds two regression tests (verbatim from #1030): - TestUdpEndpointWriteTo_AcceptsProxyOverheadBytes: over-write stays alive - TestUdpEndpointWriteTo_StillRetiresOnTruePartialWrite: true under-write retires
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
来源
从 daeuniverse/dae 官方 PR #1030 迁移至 itoywh/kdae。
功能
UDP endpoint
WriteTo的 short-write 判定从n != len(b)修正为n < len(b)。代理 WriteTo 报告的字节数可能包含协议封装开销(如 shadowsocks AES-128-GCM + IPv4 会多 39 字节),导致
n合法地大于len(b)。UDP 数据报是原子传输的,只有n < len(b)才是真正的短写、值得 retire endpoint;n > len(b)不应误判。影响文件
control/udp_endpoint_pool.go(+ 单元测试)