[PR #5698] [MERGED] feat(inbound): DisableFlow — opt an inbound out of auto XTLS Vision (#5689) #5964

Closed
opened 2026-11-02 04:05:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5698
Author: @FZ1010
Created: 6/30/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @MHSanaei

Base: main ← Head: feat/inbound-disable-flow


📝 Commits (10+)

  • 6f90191 feat(inbound): add DisableFlow to opt an inbound out of auto XTLS Vision
  • 605e8a9 feat(inbound): DisableFlow toggle in the inbound form (frontend)
  • a38a1bb fix(inbound): honor DisableFlow in all emitters + on toggle; regen OpenAPI
  • c3a07f6 fix(inbound): make DisableFlow durable, clamp on create, guard live config
  • e16acf4 style(inbound): drop // line comments per repo CLAUDE.md
  • 0a66cb2 Merge remote-tracking branch 'origin/main' into feat/inbound-disable-flow
  • 74d30b4 Merge remote-tracking branch 'origin/main' into feat/inbound-disable-flow
  • 04d0807 Merge branch 'main' into feat/inbound-disable-flow
  • de08a2e Merge branch 'main' into feat/inbound-disable-flow
  • 897059b Merge branch 'main' into feat/inbound-disable-flow

📊 Changes

41 files changed (+428 additions, -10 deletions)

View changed files

📝 frontend/public/openapi.json (+6 -0)
📝 frontend/src/generated/examples.ts (+1 -0)
📝 frontend/src/generated/schemas.ts (+5 -0)
📝 frontend/src/generated/types.ts (+1 -0)
📝 frontend/src/generated/zod.ts (+1 -0)
📝 frontend/src/lib/xray/inbound-form-adapter.ts (+4 -0)
📝 frontend/src/models/dbinbound.ts (+3 -0)
📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+13 -0)
📝 frontend/src/schemas/forms/inbound-form.ts (+1 -0)
📝 frontend/src/test/inbound-form-adapter.test.ts (+30 -0)
📝 internal/database/model/model.go (+2 -0)
📝 internal/sub/clash_service.go (+1 -1)
📝 internal/sub/clash_service_test.go (+25 -0)
📝 internal/sub/json_service.go (+1 -1)
📝 internal/sub/json_service_test.go (+10 -0)
📝 internal/sub/service.go (+2 -2)
📝 internal/sub/service_flow_test.go (+10 -0)
📝 internal/web/runtime/remote.go (+1 -0)
📝 internal/web/runtime/remote_test.go (+11 -0)
📝 internal/web/service/client_bulk.go (+2 -1)

...and 21 more files

📄 Description

Closes #5689.

Two alternative approaches to #5689 — this one (inbound-scoped) and the per-(client,inbound) override in #5699. Merge whichever fits; the other can be closed.

Problem

A VLESS client attached to multiple inbounds carries a single client-level flow. The panel clamps that flow onto every flow-capable inbound the client is on, so you cannot keep xtls-rprx-vision on a Reality inbound while turning it off on a tunneled XHTTP + VLESS-encryption inbound for the same client. Vision over a CDN/tunneled transport is frequently undesirable, but today it is all-or-nothing.

Approach — per-inbound DisableFlow

An inbound flagged DisableFlow never advertises or expects XTLS flow, regardless of the client's flow on its other inbounds.

Backend

  • model.Inbound.DisableFlow — additive column (AutoMigrate; default:false, so no behavior change on upgrade).
  • AddInbound / UpdateInbound: when set, strip each client's flow from the stored settings (and the parsed clients fed to SyncInbound) so the live Xray config never expects Vision.
  • GetXrayConfig: force flow="" for DisableFlow inbounds (VLESS + Trojan) — authoritative on the read side too, so a stray flow_override cannot cause a server/client handshake mismatch.
  • Subscription generation (VLESS link, Clash, JSON) and genTrojanLink suppress the flow for such inbounds, keeping Xray and the subscription in agreement.
  • MigrationRestoreVisionFlow skips DisableFlow inbounds, so the boot/edit Vision-restore pass never re-injects the flow.

Frontend

  • A VLESS-only Disable XTLS flow switch in the inbound form (wired through the DBInbound model, the form schema, and the adapter in both directions); cleared automatically when the protocol is changed away from VLESS.
  • disableFlow / disableFlowHelp added to all 13 locale files.

Tests

  • stripClientFlows table-driven unit cases.
  • DB-backed: AddInbound clamps flow on a disabled inbound; UpdateInbound persists DisableFlow + strips flow + the result survives MigrationRestoreVisionFlow (a regression test that fails without the persist fix).
  • Frontend: DBInbound + adapter round-trip (fails without the model field).

make verify — ✅ verify: OK

Ran the full CI-mirroring gate locally (CGO sqlite via MinGW; golangci-lint built for go 1.26.4):

stage result
gen-check clean — no codegen drift
lint (golangci-lint + eslint) 0 issues
typecheck (tsc --noEmit) clean
test — go test -shuffle=on ./... all packages pass, 0 failures
test — frontend vitest 621 passing
build (Vite bundles + go build ./...) OK

No // line comments in committed Go/TS, per the repo guidelines.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5698 **Author:** [@FZ1010](https://github.com/FZ1010) **Created:** 6/30/2026 **Status:** ✅ Merged **Merged:** 8/15/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/inbound-disable-flow` --- ### 📝 Commits (10+) - [`6f90191`](https://github.com/MHSanaei/3x-ui/commit/6f901915ada5bb6902dfd29b527a758607f9723e) feat(inbound): add DisableFlow to opt an inbound out of auto XTLS Vision - [`605e8a9`](https://github.com/MHSanaei/3x-ui/commit/605e8a9f5d4aacf81fe0ec1c4147f3a09e462713) feat(inbound): DisableFlow toggle in the inbound form (frontend) - [`a38a1bb`](https://github.com/MHSanaei/3x-ui/commit/a38a1bb02e9e59e18b4f16f11186f069a7927eb4) fix(inbound): honor DisableFlow in all emitters + on toggle; regen OpenAPI - [`c3a07f6`](https://github.com/MHSanaei/3x-ui/commit/c3a07f634f465b5dffac783ff1ee46fc7179bef7) fix(inbound): make DisableFlow durable, clamp on create, guard live config - [`e16acf4`](https://github.com/MHSanaei/3x-ui/commit/e16acf4dcabdc3c6a8c961e4f8cc14341238b8f6) style(inbound): drop // line comments per repo CLAUDE.md - [`0a66cb2`](https://github.com/MHSanaei/3x-ui/commit/0a66cb27598650cc2ad745ce4effc189dbaa2f90) Merge remote-tracking branch 'origin/main' into feat/inbound-disable-flow - [`74d30b4`](https://github.com/MHSanaei/3x-ui/commit/74d30b405a442cf8a5d612f6574528e5de78924c) Merge remote-tracking branch 'origin/main' into feat/inbound-disable-flow - [`04d0807`](https://github.com/MHSanaei/3x-ui/commit/04d08073adff5bad9405cf899af9ac8af3e230b4) Merge branch 'main' into feat/inbound-disable-flow - [`de08a2e`](https://github.com/MHSanaei/3x-ui/commit/de08a2e5c15123c4655f5c077d169c006562cfb4) Merge branch 'main' into feat/inbound-disable-flow - [`897059b`](https://github.com/MHSanaei/3x-ui/commit/897059bd87864ea150ff7829d6f7878891986da8) Merge branch 'main' into feat/inbound-disable-flow ### 📊 Changes **41 files changed** (+428 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `frontend/public/openapi.json` (+6 -0) 📝 `frontend/src/generated/examples.ts` (+1 -0) 📝 `frontend/src/generated/schemas.ts` (+5 -0) 📝 `frontend/src/generated/types.ts` (+1 -0) 📝 `frontend/src/generated/zod.ts` (+1 -0) 📝 `frontend/src/lib/xray/inbound-form-adapter.ts` (+4 -0) 📝 `frontend/src/models/dbinbound.ts` (+3 -0) 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+13 -0) 📝 `frontend/src/schemas/forms/inbound-form.ts` (+1 -0) 📝 `frontend/src/test/inbound-form-adapter.test.ts` (+30 -0) 📝 `internal/database/model/model.go` (+2 -0) 📝 `internal/sub/clash_service.go` (+1 -1) 📝 `internal/sub/clash_service_test.go` (+25 -0) 📝 `internal/sub/json_service.go` (+1 -1) 📝 `internal/sub/json_service_test.go` (+10 -0) 📝 `internal/sub/service.go` (+2 -2) 📝 `internal/sub/service_flow_test.go` (+10 -0) 📝 `internal/web/runtime/remote.go` (+1 -0) 📝 `internal/web/runtime/remote_test.go` (+11 -0) 📝 `internal/web/service/client_bulk.go` (+2 -1) _...and 21 more files_ </details> ### 📄 Description Closes #5689. > Two alternative approaches to #5689 — this one (inbound-scoped) and the per-(client,inbound) override in #5699. Merge whichever fits; the other can be closed. ## Problem A VLESS client attached to multiple inbounds carries a single client-level `flow`. The panel clamps that flow onto **every** flow-capable inbound the client is on, so you cannot keep `xtls-rprx-vision` on a Reality inbound while turning it off on a tunneled XHTTP + VLESS-encryption inbound for the same client. Vision over a CDN/tunneled transport is frequently undesirable, but today it is all-or-nothing. ## Approach — per-inbound `DisableFlow` An inbound flagged `DisableFlow` never advertises or expects XTLS flow, regardless of the client's flow on its other inbounds. ### Backend - `model.Inbound.DisableFlow` — additive column (AutoMigrate; `default:false`, so no behavior change on upgrade). - `AddInbound` / `UpdateInbound`: when set, strip each client's flow from the stored settings (and the parsed clients fed to `SyncInbound`) so the live Xray config never expects Vision. - `GetXrayConfig`: force `flow=""` for `DisableFlow` inbounds (VLESS + Trojan) — authoritative on the read side too, so a stray `flow_override` cannot cause a server/client handshake mismatch. - Subscription generation (VLESS link, Clash, JSON) and `genTrojanLink` suppress the flow for such inbounds, keeping Xray and the subscription in agreement. - `MigrationRestoreVisionFlow` skips `DisableFlow` inbounds, so the boot/edit Vision-restore pass never re-injects the flow. ### Frontend - A VLESS-only **Disable XTLS flow** switch in the inbound form (wired through the `DBInbound` model, the form schema, and the adapter in both directions); cleared automatically when the protocol is changed away from VLESS. - `disableFlow` / `disableFlowHelp` added to all 13 locale files. ### Tests - `stripClientFlows` table-driven unit cases. - DB-backed: `AddInbound` clamps flow on a disabled inbound; `UpdateInbound` persists `DisableFlow` + strips flow + the result survives `MigrationRestoreVisionFlow` (a regression test that fails without the persist fix). - Frontend: `DBInbound` + adapter round-trip (fails without the model field). ## `make verify` — ✅ `verify: OK` Ran the full CI-mirroring gate locally (CGO sqlite via MinGW; golangci-lint built for go 1.26.4): | stage | result | |---|---| | `gen-check` | clean — no codegen drift | | `lint` (golangci-lint + eslint) | **0 issues** | | `typecheck` (`tsc --noEmit`) | clean | | `test` — `go test -shuffle=on ./...` | all packages pass, **0 failures** | | `test` — frontend vitest | **621 passing** | | `build` (Vite bundles + `go build ./...`) | OK | No `//` line comments in committed Go/TS, per the repo guidelines. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5964
No description provided.