Skip to content

Enable flow_enabled for VLESS when inbound encryption is set#370

Open
Red0Core wants to merge 1 commit intoPasarGuard:mainfrom
Red0Core:patch-1
Open

Enable flow_enabled for VLESS when inbound encryption is set#370
Red0Core wants to merge 1 commit intoPasarGuard:mainfrom
Red0Core:patch-1

Conversation

@Red0Core
Copy link
Copy Markdown

@Red0Core Red0Core commented Apr 12, 2026

What

  • Refactor flow_enabled calculation in app/core/hosts.py:
    • Keep the existing strict conditions as base_flow_enabled.
    • Additionally set flow_enabled=True for VLESS when inbound encryption is enabled (encryption not in None, "", "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:

Verification

  • Tested locally using docker compose.
  • Confirmed behavior is unchanged when encryption: "none" (in that case flow_enabled still depends only on the original base_flow_enabled conditions).

Notes

  • Change is scoped to protocol == "vless" only.
  • No impact on other protocols/transports.

Summary by CodeRabbit

  • Bug Fixes
    • Updated flow configuration logic to enable flow under broader protocol and encryption combinations.

Refactor flow_enabled logic to include encryption check for VLESS.
Copilot AI review requested due to automatic review settings April 12, 2026 01:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bfc99e70-1220-4443-aa03-84e46dcb6ef8

📥 Commits

Reviewing files that changed from the base of the PR and between 3d749e0 and b406bbb.

📒 Files selected for processing (1)
  • app/core/hosts.py

Walkthrough

The change modifies flow-enabled computation in app/core/hosts.py's _prepare_subscription_inbound_data function to expand flow enablement for VLESS protocol when encryption is configured, beyond the prior constraints.

Changes

Cohort / File(s) Summary
Flow-enabled Logic Expansion
app/core/hosts.py
Modified _prepare_subscription_inbound_data to replace single flow_enabled boolean with base_flow_enabled plus an additional condition that enables flow for protocol == "vless" when encryption is set to any value other than None, "", or "none".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A flow of logic, refined and bright,
VLESS now dances through the night,
When encryption whispers its sacred code,
The flow takes wing down the digital road,
Simpler rules, yet oh so right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: enabling flow_enabled for VLESS protocol when inbound encryption is configured.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_enabled for protocol == "vless" when inbound encryption is set (not None, "", or "none").

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/core/hosts.py
Comment on lines +267 to +269
# Enable also when inbound vless encryption is enabled (not "none")
flow_enabled = base_flow_enabled or (
protocol == "vless" and encryption not in (None, "", "none")
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'”).

Suggested change
# 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")

Copilot uses AI. Check for mistakes.
Comment thread app/core/hosts.py
@@ -257,13 +257,18 @@ async def _prepare_subscription_inbound_data(

# Compute flow_enabled: only for VLESS with specific conditions
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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".

Copilot uses AI. Check for mistakes.
@ImMohammad20000
Copy link
Copy Markdown
Contributor

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

@muffintime77
Copy link
Copy Markdown

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?

@mayoroffk
Copy link
Copy Markdown

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!

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.

5 participants