mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5167] [MERGED] refactor: focused service files, leaf subpackages, and an internal/ layout #5800
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5800
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5167
Author: @MHSanaei
Created: 6/10/2026
Status: ✅ Merged
Merged: 6/10/2026
Merged by: @MHSanaei
Base:
main← Head:refactor/client-service-split📝 Commits (10+)
c4c1f6frefactor(service): split client.go into focused filesb98e4f6refactor(service): split inbound.go into focused files4883503refactor(service): split tgbot.go into focused files72d94f3refactor(client): dedupe single-field by-email settersa96b089refactor(service): extract panel/ subpackage93cfe95refactor(service): extract integration/ subpackageb3edf10refactor(service): extract tgbot/ subpackagea04ba49refactor(service): extract outbound/ subpackagee109457refactor(util): move wireguard into its own subpackage2a0a6bfrefactor(sub): drop redundant sub prefix from filenames📊 Changes
254 files changed (+13074 additions, -12836 deletions)
View changed files
📝
.dockerignore(+2 -1)📝
.github/workflows/ci.yml(+4 -4)📝
.github/workflows/claude-issue-bot.yml(+19 -19)📝
.github/workflows/release.yml(+2 -2)📝
.gitignore(+4 -7)📝
CONTRIBUTING.md(+9 -9)📝
Dockerfile(+3 -3)📝
README.md(+1 -1)📝
docs/custom-subscription-templates.md(+1 -1)📝
frontend/README.md(+5 -5)📝
frontend/eslint.config.js(+1 -1)📝
frontend/eslint.deprecated.config.js(+1 -1)📝
frontend/src/generated/types.ts(+0 -1)📝
frontend/src/generated/zod.ts(+0 -3)📝
frontend/src/i18n/react.ts(+4 -4)📝
frontend/src/test/setup.components.ts(+1 -1)📝
frontend/tsconfig.json(+1 -1)📝
frontend/vite.config.js(+1 -1)📝
internal/config/config.go(+7 -0)📝
internal/config/name(+0 -0)...and 80 more files
📄 Description
What & why
A structural reorganization of the Go backend so it's easier to navigate and follows an idiomatic, professional Go application layout. No runtime behavior change — the file splits are verbatim moves and the package moves are import-path-only. Best reviewed commit-by-commit (17 self-contained commits, each builds and tests green on its own).
Highlights
1. Split the three oversized service files (verbatim; identical declaration set verified before/after):
client.goclient_*.goinbound.goinbound_*.gotgbot.gotgbot_*.go2. Extract leaf service subpackages — services the core doesn't depend on (so no import cycles):
web/service/{panel,integration,outbound,tgbot}/. The mutually-coupled core (client ↔ inbound ↔ node ↔ setting) necessarily stays flat.3. Adopt an
internal/layout — movedconfig, database, logger, mtproto, sub, util, web, xrayunderinternal/(149 import rewrites).main.goandtools/stay at the root; the module path is unchanged. Includes the non-Go couplings the compiler can't see: ViteoutDir, the frontend'sweb/translationimports, Dockerfile COPYs,.gitignore/CI embed stubs, the openapigen package paths, and a repo-root-relative test path.4. Smaller cleanups & fixes
util/wireguard.go→util/wireguard/(it was the lone file of the rootutilpackage)subprefix fromsub/filenames;controller/xui.go→spa.gosub_templates/README.md→docs/custom-subscription-templates.md/xui → /panelredirect middlewarelog/directories through the source tree (GetLogFolder()now honorstesting.Testing())os.DirFS("web/dist/...")) theinternal/move missed — production was unaffected (embedded FS); onlygo runwith a live frontend build silently fell back to embed.dockerignore: corrected path and excluded the localx-ui/runtime dir from the build contextVerification
go build ./...,go vet ./...,go test ./...— all greentypecheck,lint,vitest(478 tests),build— all greendocker build— image builds; embedded + disk layout verified inside the container🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.