Repository navigation
XMC finalmask: Switch to native frame padding (breaking); delay supports range (receiver waits at least minimal ms) - #7402
Conversation
Add direction field to Padding protobuf message to allow users to specify whether each padding turn goes from client to server (1) or server to client (2). This removes the previous limitation where padding turns had to alternate directions. Changes: - Add direction field to Padding message in config.proto - Update config.go to read direction from config instead of alternating - Remove validation that prevented consecutive same-direction turns - Update all tests to specify direction explicitly - Add test case for consecutive same-direction padding
Parse direction field and use explicit object format.
Per rprx's request: array fields use plural form, and add configurable delay in milliseconds after each turn.
Bring the PR branch up to date without rewriting the original author's commits. Regenerate the XMC protobuf from config.proto and adapt the packet-stream test to the new (conn, dest, dialer) WrapConnClient signature introduced upstream. Assisted-by: DeepSeek (AI)
Replace the integer per-turn delay with delay_min/delay_max, parsed from the JSON "delay" string (a fixed value or an inclusive "min-max" range). The sender now samples the pause uniformly inside the range after sending its turn, while the receiver waits at least the minimum before reading or sending the next turn, so both endpoints enforce the same spacing. Skip the delay of the last turn to avoid adding latency before the proxy stream starts, reject negative/reversed/overflowing ranges, and update the README example plus timing tests. Assisted-by: DeepSeek (AI)
This comment was marked as outdated.
This comment was marked as outdated.
9ade89d to
5d17b87
Compare
|
#6769 (comment) rebase main |
Sync with the squashed XTLS#6769 merge and keep the follow-up delay-range change. Follow the maintainer's cleanup of XTLS#6769 and drop the XMC README/*_test.go files it removed; the unrelated XMC tests deleted by that squash are not restored here. The XMC delay implementation, its validation, and the infra/conf delay parsing tests remain. Assisted-by: DeepSeek (AI)
下一步动作是什么,还需要处理什么吗 |
|
因为目前还有一些问题没修,按要求一个PR一个功能,这些问题后续修复PR再说
|
这个去掉 |
OK,这边我处理下,可能要点时间 |
然后这里有哪些先开PR修,说明一下。因为目前还在折腾其它处理,如果不给顺序,我一个人忙不过来 |
RPRX asked to drop the special case that ignored the last turn's delay. The sender now samples the configured range and the receiver waits at least the minimum after the final padding turn, before the proxy stream starts. Assisted-by: DeepSeek (AI)
|
Done in |
|
@RPRX 借这个 padding PR 问一个关于 padding 线格式的问题(和 delay 语义相关但独立):能否把 padding 做成完全原生的 MC 帧? 背景:我在写 XMC 的服务端 Fabric 模组(真实 26.1 服务端、同端口),目标是不接管 MC 的登录/认证,只注册
结果就是:真服务端必须在 Login Ack 处拆掉 vanilla 的 splitter/decoder 才能跑 padding —— 这正是想避免的接管(也因此不得不搞"密码/专用端口"之类的区分手段)。 想确认的是,padding 能否改成合法 MC 帧,例如承载在配置状态的 另外两个相关问题:
如果这个方向可行,我可以单独出一个只改 padding 承载方式的 PR(不碰现有 length/direction/delay 语义),模组那边配合改。 |
|
要不这样,原来的xmc保留现在的模式,不要求兼容真实 MC 然后你再单独做个兼容真实mc的模式,需要真实mc服务端,fabric等,这样有需要的人就能自己选择🤔 |
|
我的担心是特征问题,具体看
|
|
这边还是看PRRX怎么选择 |
|
选更像的就行,可以 breaking |
行,我修一下,等这个解决了,再算前面 #7402 (comment) 的账,然后去处理下 #7416 这个草案 |
The startup padding used opaque records whose length field includes its own varint, so a vanilla server split the stream one header short and had to take the protocol pipeline over. RPRX said picking the more realistic option is fine even if it is a breaking change, so padding is now carried in ordinary Minecraft configuration-state custom payload packets. Wire format: - one padding chunk becomes one or more custom payload frames on "xmc:pad"; the length field has the vanilla meaning (bytes after the field), the frame overhead is whatever the vanilla encoder adds; - a chunk longer than the 32767 byte serverbound payload limit is split, and captured turns smaller than the smallest frame (the 2-byte turns) send that smallest frame instead; - the receiver no longer reads or validates turns: they are ordinary traffic that the next reader drops as unknown packets, so both sides only send and keep the configured pauses; - the first turn still counts the two Login Acknowledged bytes as its prefix; those bytes are simply not repeated. This is a breaking change: both ends must run this version. No config or proto field was added; the existing paddings/length/direction/delay semantics are unchanged. The packet reader bound is raised from 32 KiB to 1 MiB, vanilla's own clientbound custom payload limit, because a real configuration state can send registry data of that size. Assisted-by: DeepSeek (AI)
|
Picked the native one, breaking as allowed, in Each padding chunk is now one or more configuration-state custom payload frames on Why it matters in practice: with the old format a real vanilla server split one header short and a server-side Fabric mod had to take the login pipeline over to run padding, which also meant reloading all The reader bound also goes from 32 KiB to 1 MiB, since a real configuration state can send registry data of that size. Remaining known items from the earlier list (cancellable delay, caps, early-arrival check, explicit no-padding mode, tail behavior) are untouched — separate PRs as agreed. |
Minecraft enables zlib framing from the login Set Compression packet onwards, so Login Success, the configuration state and the padding schedule all use Packet Length + Data Length framing. Read the threshold in client.go and wrap the connection before the packet that follows it, and implement the framing in a new compression.go: compressed packets are inflated back to the plain frame, and packets below the threshold are written with Data Length = 0. A zero Data Length keeps a body uncompressed, which vanilla servers accept at any size, so padding frames can keep their configured wire size; there is no need to compress payloads that do not benefit from it. threshold < 0 leaves the connection uncompressed. Adds compression_test.go for the threshold boundary, chunked writes and the uncompressed-over-threshold case. Tested end to end against Fabric 26.1 (protocol 775) with this mod at network-compression-threshold 256 and 65536, 64 MiB and 256 MiB in both directions, sha256 verified: XTLS#7394 (comment) This commit was produced with AI assistance (DeepSeek Harness).
The Xray client now reads the login Set Compression framing (XTLS/Xray-core#7402), so the mod no longer requires network-compression-threshold=-1. Recommend 65536 so padding and tunnel payloads stay uncompressed while large registry packets are still compressed, and update the startup warning and the architecture notes to match. Link the pull request and the test comment in full instead of short references. This commit was produced with AI assistance (DeepSeek Harness).
|
Added the login compression codec on top of the native padding work (
There is no E2E: Fabric 26.1 (protocol 775), threshold 256 and 65536, 64 MiB / 256 MiB in both directions, sha256 verified. Numbers and caveats: #7394 (comment) |
|
|
我总感觉还有什么流程没跑完,因为这边改太多了,我再本地扫一下看看,没问题就合,然后前面哪些BUG后面的PR再算账 |
The pre-shared password travels with the four-byte verify token inside one RSA-1024 PKCS#1 v1.5 block, which holds at most 128-11 bytes. A longer password passed configuration validation and then failed every handshake at runtime: rsa.EncryptPKCS1v15 reports "message too long for RSA key size" on the client, and the server cannot decrypt the block either. Both sides were already deriving their key pair from that password, so the configuration looked valid and simply never connected. Validate the limit when the configuration is built, and also in newClientConn for configurations assembled without infra/conf. This commit was produced with AI assistance (DeepSeek Harness).
|
@RPRX 这个可以先合并了,然后剩下的草案后续再处理 |
delay supports range (receiver waits at least minimal ms)
|
目前应该是跟在 padding 后的而不是之前,这样的话逻辑上似乎有点问题?wait 选择的值是哪个? |
…ports range (receiver waits at least minimal ms) (#7402) #6769 (comment) #7394 (comment) #6769 (comment) #7402 (comment) #7402 (comment) #7402 (comment) #7394 (comment) #7402 (comment)
本地Agent扫出来的情况,具体为啥要delay就得问问看 #6769 是怎么打算的了 @spr334-a
|
Follow-up to #6769 (merged in
5d17b872): completes the remainingdelayrequirement and, per this reply, switches padding to the more realistic wire format even though that is a breaking change.Delay
delayis now a string:"100"or"50-150"(milliseconds). A number written against XMC finalmask: Make startuppaddingsconfigurable (direction,lengthanddelay) #6769 no longer parses, so this is a configuration-level breaking change as well.[min, max]after its turn.minafter each turn, including the last one, before the proxy stream starts.config.proto:delaybecomesdelay_min/delay_max; negative, reversed and duration-overflowing ranges are rejected at config load.infra/conf: parses the string delay; tests cover fixed values, ranges and invalid forms.Native frame padding (
ea2c7edc, breaking)The opaque format wrote a length field that includes its own varint. A vanilla server therefore split the stream one header short and had to take the protocol pipeline over — something a Fabric server mod cannot do without affecting ordinary players.
xmc:pad; the length field now has the vanilla meaning (bytes after the field).maxPacketDataLengthis raised from 32 KiB to 1 MiB (vanilla's clientbound custom payload limit), which a real configuration state can reach with registry data.Breaking: both ends must run this version. No proto field was added for padding; the
paddingslength/direction semantics are unchanged, anddelaymoved from a number to a millisecond string.Example:
Both endpoints should still use the same array and the same
delayranges, because that is what reproduces the captured shape. Nothing is compared against the peer's schedule any more, though: the receiver does not consume padding, so a length, direction or turn-count difference can no longer fail or stall the handshake, it only changes what each side sends.Scope
Per the cleanup in #6769, this PR does not restore the XMC
README.md/*_test.gofiles deleted in that squash commit. The only new test file ispadding_frames_test.go, which covers the frame plan/reachability and the source of the padding stream, because the wire format changed here.Tests
Validation fix
A legacy password longer than 113 bytes is now rejected when the configuration is built (
035c45de), instead of being accepted and then failing every handshake: the verify token plus the password must fit one RSA-1024 PKCS#1 v1.5 block (128-11 bytes), sorsa.EncryptPKCS1v15was failing on the client and the server could not decrypt it either.