Enable flow_enabled for VLESS when inbound encryption is set#370
Enable flow_enabled for VLESS when inbound encryption is set#370Red0Core wants to merge 1 commit intoPasarGuard:mainfrom
Conversation
Refactor flow_enabled logic to include encryption check for VLESS.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe change modifies flow-enabled computation in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adjusts how flow_enabled is derived for subscription inbounds so VLESS inbounds with explicit inbound encryption are treated as flow-capable, even when they don’t match the previous strict TLS+transport constraints.
Changes:
- Split the original strict flow conditions into
base_flow_enabled. - Extend
flow_enabledforprotocol == "vless"when inboundencryptionis set (notNone,"", or"none").
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Enable also when inbound vless encryption is enabled (not "none") | ||
| flow_enabled = base_flow_enabled or ( | ||
| protocol == "vless" and encryption not in (None, "", "none") |
There was a problem hiding this comment.
encryption is pulled directly from inbound_config (defaulting to "none") and is not normalized. The new check encryption not in (None, "", "none") is therefore case/whitespace sensitive (e.g., "None", "NONE", or " none " would be treated as enabled and turn flow_enabled on unexpectedly). Consider normalizing once (e.g., strip + lowercase) before this comparison so the behavior matches the comment intent (“not 'none'”).
| # Enable also when inbound vless encryption is enabled (not "none") | |
| flow_enabled = base_flow_enabled or ( | |
| protocol == "vless" and encryption not in (None, "", "none") | |
| normalized_encryption = encryption.strip().lower() if isinstance(encryption, str) else encryption | |
| # Enable also when inbound vless encryption is enabled (not "none") | |
| flow_enabled = base_flow_enabled or ( | |
| protocol == "vless" and normalized_encryption not in (None, "", "none") |
| @@ -257,13 +257,18 @@ async def _prepare_subscription_inbound_data( | |||
|
|
|||
| # Compute flow_enabled: only for VLESS with specific conditions | |||
There was a problem hiding this comment.
The comment says flow is computed “only for VLESS with specific conditions”, but flow_enabled is now also enabled for VLESS when inbound encryption is set. Please update the comment to reflect the full set of conditions so future readers don’t assume tls_value/transport constraints are still required.
| # Compute flow_enabled: only for VLESS with specific conditions | |
| # Compute flow_enabled for VLESS either when the TLS/transport/header | |
| # constraints below are met, or when inbound VLESS encryption is set | |
| # to a non-empty value other than "none". |
|
This is not an acceptable behavior for our current setup it need change in panel i m not merging this but i keep it open as reminder to change the behavior in the future |
|
Please confirm this PR, as it appears legitimate and does not interfere with the panel's operation, and there are no other ways to enable this mode. Pleeeease? |
|
Great PR! I was actually planning to implement this myself until I came across your work. I’m currently trying to set up a combination of xhttp + vless encryption + xtls-vision, and this functionality is a total blocker for me right now. I don't see any reason why these changes would interfere with the panel's stability, but they definitely solve a huge distribution issue. Really looking forward to seeing this merged soon. Thanks! |
What
flow_enabledcalculation inapp/core/hosts.py:base_flow_enabled.flow_enabled=Truefor VLESS when inboundencryptionis enabled (encryptionnot inNone,"","none").Why
Some VLESS setups use VLESS Encryption (e.g. with XTLS Vision) and expect “flow”/optimized behavior to be treated as enabled even when the previous TLS+transport constraints don’t match. This change makes the flag align better with VLESS encryption usage and avoids missing flow in encrypted VLESS configs.
References:
https://xtls.github.io/en/config/inbounds/vless.html#:~:text=VLESS%20Encryption%3A%20No%20underlying%20transport%20restrictions.%20If%20the%20underlying%20layer%20does%20not%20support%20direct%20copying%20(see%20above)%2C%20it%20only%20penetrates%20Encryption.
https://xraycore.org/en/misc/vless-encryption/#2-%D1%81-xtls-vision-%D0%BC%D0%B0%D0%BA%D1%81%D0%B8%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%B2%D0%BE%D0%B4%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%D1%81%D1%82%D1%8C
Verification
encryption: "none"(in that caseflow_enabledstill depends only on the originalbase_flow_enabledconditions).Notes
protocol == "vless"only.Summary by CodeRabbit