feat: add xhttp transport support#2645
Conversation
|
Thank you for your contribution, but the existing code has the following issues: First, in the outbound, connections should be created in Second, you should check the commit content and avoid modifying anything unrelated to this PR (including but not limited to formatting other files). Finally, as mentioned in the previous PR, we need a working listener implementation; the current code still shows "xhttp listener is not implemented yet". If these three issues are resolved, we will consider merging it. |
a1f5e36 to
64bac05
Compare
|
Thanks for the review I’ve pushed an update addressing the points you mentioned:
Inbound tests are now passing:
Let me know if anything still looks off or needs to be adjusted. |
|
It looks good, but there are a few minor modifications needed: Since the XHTTP configuration items are only related to vless, they don't need to be placed in vmess.go. Also, in |
|
Thanks for the detailed review - pushed an update.
Re-tested locally with:
Everything is passing now. |
Add xhttp transport support for VLESS, including outbound dial paths and inbound listener handling. This implementation covers plain TLS and Reality-based xhttp flows, including listener-side HTTP/2 handling for Reality and session-aware upload/download processing required by inbound xhttp tests.
f2f45fe to
73c9f6e
Compare
|
@Nemu-x I tested XHTTP and found that if I don’t specify According to the documentation:
When using the Xray core directly without adding My understanding is that this should be the default behavior and does not need to be explicitly configured. Thanks. |
|
ScMinPostsIntervalMs 和 ScMaxEachPostBytes 似乎并没有使用 只是声明了变量 实际没有任何调用 因为它们依赖xray内部的pipe机制 所以好像被一并删除了 |
|
Good catch, @xream Added a small follow-up fix so that Thanks, You're right - those two options are currently only declared/plumbed through, but not really implemented with the same behavior as Xray. I'll remove |
|
thanks @Fangliding Those options were indeed only partially wired and could be misleading, so I removed them in a follow-up PR: #2648 Appreciate the review 👍 |
|
@Nemu-x |
This comment was marked as outdated.
This comment was marked as outdated.
I’m ready to try it if you can provide me with a prebuilt Mihomo binary for Linux x86_64. |
Thanks for the report I’m currently testing this on my side with sustained traffic load. Will update here once I have more concrete results. |
After about 12 hours of uptime, all XHTTP connections dropped, and the logs show HTTP errors. |
I’ve just installed your binary and will be testing it now. |
Thanks for the report, I’ve been testing this with sustained load and pprof. I couldn’t reproduce a persistent memory leak so far:
This was based on a ~1 hour soak test. I’ll now run a longer test (several hours) to check long-term behavior This looks more like connection churn than unreleased memory. However, the I’ve attached pprof snapshots and memory stats from my test. If you can reproduce again, pprof + FD count at failure point would help a lot. |
After 2 hours of running your executable, everything looks good — memory usage is stable and not increasing. The maximum consumption is around 179 MB with 100+ active connections, and the average is about 174 MB. |
Quick update from my side. I couldn’t reproduce a persistent heap memory leak. However, during a ~3.5 hour soak test on Windows, I observed connection accumulation after stopping the load. A noticeable number of sockets remained in This may be related to the reported Attached logs and pprof snapshots from the test. |
Are any additional code changes required, besides the ones already made to fix the transport‑closing issue, to fully resolve the problem? |
The Before suggesting any additional code changes, it makes sense to re-test with this commit included and verify whether the connection accumulation / I’ll run a new soak test (~4 hours) on my side with this change and share logs and results. |
Retested with dd3a149 included I ran another retest and checked TCP state both during load and after fully stopping the client traffic. On my side, the previous connection accumulation behavior is no longer reproducible: after load stops, extra sockets are released correctly and the process returns to its normal listening state. Attached a small retest bundle with TCP summaries and process snapshots. |
|
Thanks for bringing xhttp support. Does it support extra "downloadSettings" at the moment? i am looking for a template for these extra settings. |
Thanks for the feedback. At the moment, neither I’ll be working on both as follow-up improvements. |
|
Hi! Following up on the previous discussion about xhttp. I added explicit test coverage for sing-mux over VLESS xhttp (both From current results, sing-mux already works correctly over xhttp without additional changes. Before moving further with xmux-related work, I’d like to clarify: The test branch: |
|
I welcome support for xmux. As a sub-component of xhttp, combining the two can provide a better user experience compared to external components. |
I understand xmux should live inside xhttp rather than as an external SingMux wrapper. I’ll draft a minimal xhttp-native design first. |
|
#2695 |




What
Adds initial support for VLESS over XHTTP transport.
Details
network: xhttpxhttp-optssupport (host, path, mode)The implementation is intentionally minimal and focuses only on getting XHTTP working as a transport layer.
Notes
/vless-xhttp,/assets, etc.) is treated as user/server-side config and not restricted in codeTesting
Tested locally with:
Scope
This is an MVP implementation to introduce XHTTP transport support.
Further improvements (if needed):