Skip to content

feat(subscription): add xhttp support for Clash Meta subscriptions#347

Merged
M03ED merged 2 commits intoPasarGuard:devfrom
Nemu-x:feat/clash-meta-config
Apr 1, 2026
Merged

feat(subscription): add xhttp support for Clash Meta subscriptions#347
M03ED merged 2 commits intoPasarGuard:devfrom
Nemu-x:feat/clash-meta-config

Conversation

@Nemu-x
Copy link
Copy Markdown

@Nemu-x Nemu-x commented Apr 1, 2026

Summary

Adds xhttp transport support for Clash Meta subscription output.

Motivation

Recent Mihomo (Clash Meta) releases introduced support for xhttp transport, which is already used in modern VLESS deployments.

This PR enables PasarGuard to generate compatible configurations for clients supporting xhttp.

Changes

  • add XHTTPTransportConfig
  • register xhttp transport handler
  • implement _transport_xhttp
  • allow xhttp for ClashMetaConfiguration
  • keep xhttp unsupported for regular Clash

References

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b4c55b1-244b-4937-bcd1-bf91aa3c641d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@M03ED
Copy link
Copy Markdown
Contributor

M03ED commented Apr 1, 2026

Splithttp is old name of xhttp, you have to remove that too

@M03ED
Copy link
Copy Markdown
Contributor

M03ED commented Apr 1, 2026

And I think you should parse download settings into a clash acceptable format

@Nemu-x
Copy link
Copy Markdown
Author

Nemu-x commented Apr 1, 2026

And I think you should parse download settings into a clash acceptable format

Thanks. I already fixed splithttp as a legacy alias of xhttp.

For download-settings, I tested the generated config with Mihomo 1.19.22 (clash verge client) and it is accepted and works correctly. From Mihomo's xhttp config structure, download-settings is a nested xhttp config object, so the current shape is intentionally passed through as nested xhttp settings.

If you want, I can still add explicit normalization for the nested download-settings fields to make the output stricter and more self-documenting.

@ImMohammad20000
Copy link
Copy Markdown
Contributor

Can you send the document of xhttp for clash meta

@Nemu-x
Copy link
Copy Markdown
Author

Nemu-x commented Apr 1, 2026

There is no dedicated public documentation page for xhttp in Mihomo yet.

The references I used are based on the actual Mihomo implementation and related PRs where xhttp support was introduced:

From these changes, xhttp is implemented as a transport with fields like mode, headers, no-grpc-header, x-padding-bytes, and download-settings, where download-settings itself is a nested xhttp config.

So the current output shape follows the actual Mihomo config structure.

I also tested the generated config with Mihomo 1.19.22 (Clash Verge), and it is accepted and works correctly.

If needed, I can still add explicit normalization for download-settings to make the output more strict and self-documenting.

@M03ED M03ED merged commit 23a9c02 into PasarGuard:dev Apr 1, 2026
9 checks passed
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.

3 participants