Skip to content

feat(xhttp): implement stream-up and download-settings support#2655

Merged
wwqgtxx merged 8 commits into
MetaCubeX:Alphafrom
Nemu-x:xhttp-stream-up-downloadsettings
Mar 31, 2026
Merged

feat(xhttp): implement stream-up and download-settings support#2655
wwqgtxx merged 8 commits into
MetaCubeX:Alphafrom
Nemu-x:xhttp-stream-up-downloadsettings

Conversation

@Nemu-x

@Nemu-x Nemu-x commented Mar 30, 2026

Copy link
Copy Markdown

Summary

This PR adds full support for XHTTP bidirectional transport improvements:

  • stream-up support (client → server upload path)
  • download-settings support (server → client download path)
  • additional TLS/REALITY overrides for download-side connections

Together, this brings mihomo's XHTTP implementation closer to Xray-style behavior and enables full duplex transport handling.


Changes

Stream-up

  • Implemented XHTTP upload (stream-up) support
  • Integrated with current Alpha transport helpers
  • Ensures proper request/response streaming behavior

Download-settings

  • Added support for download-settings in XHTTP
  • Implemented separate connection handling for download path

TLS / REALITY overrides (download-side)

Added support for:

  • servername
  • client-fingerprint
  • skip-cert-verify

Details:

  • Added fields to XHTTPDownloadSettings
  • Propagated into xhttp.DownloadConfig
  • Extended streamTLSConnWith
  • Added override logic in dialXHTTPConn

Verification

Build & tests

go test ./transport/xhttp/...     # OK
go test ./adapter/outbound/...    # OK
go test ./listener/inbound/...    # OK
go build                          # OK

Runtime testing

Tested locally using built binary and real configs.

Stream-up + download-settings

[TCP] 127.0.0.1 → www.cloudflare.com:443 → OK
[TCP] 127.0.0.1 → httpbin.org:443 → OK

REALITY (inherit)

REALITY Authentication: true
AEAD: *gcm.GCM

REALITY (explicit overrides)

use specified fingerprint: Chrome
REALITY Authentication: true

curl verification

curl -x http://127.0.0.1:7890 https://www.cloudflare.com/cdn-cgi/trace
ip=<proxy_ip>
tls=TLSv1.3
kex=X25519
curl -x http://127.0.0.1:7890 https://httpbin.org/get
{
  "origin": "<proxy_ip>"
}

@wwqgtxx

wwqgtxx commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

First, all options in XHTTPDownloadSettings that have the same meaning as VlessOption should maintain the same naming convention.

Second, both of these added features should have inbound testing.

… parsing test

- rename address → server for consistency
- add servername, client-fingerprint, skip-cert-verify support
- add config-level test for download-settings via parseProxies
@wwqgtxx

wwqgtxx commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

we don't need config-level test, should add the inbound test

@Nemu-x

Nemu-x commented Mar 30, 2026

Copy link
Copy Markdown
Author

First, all options in XHTTPDownloadSettings that have the same meaning as VlessOption should maintain the same naming convention.

Second, both of these added features should have inbound testing.

Renamed address -> server to align with VlessOption, and added a config parsing test (parseProxies) to verify download-settings.
Let me know if you’d like me to add inbound-side testing as well.

@wwqgtxx

wwqgtxx commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Similarly, mihomo does not require a security configuration item; it is controlled jointly by tls and reality-opts.

@Nemu-x

Nemu-x commented Mar 30, 2026

Copy link
Copy Markdown
Author

Similarly, mihomo does not require a security configuration item; it is controlled jointly by tls and reality-opts.

Updated as suggested:

  • aligned XHTTPDownloadSettings naming with VlessOption
  • removed security from download-settings
  • added inbound coverage for both stream-up and download-settings

Also re-verified runtime behavior locally for stream-up, download-settings (TLS / REALITY inherit / REALITY explicit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants