[PR #3269] [CLOSED] feat: Add multi-server support #5379

Closed
opened 2026-10-31 20:46:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3269
Author: @javadtgh
Created: 7/24/2025
Status: ❌ Closed

Base: main ← Head: feature/multi-server-support


📝 Commits (10+)

  • 11dc068 feat: Add multi-server support for Sanai panel
  • d65233c Merge branch 'main' into feature/multi-server-support
  • ae82373 Merge branch 'main' into feature/multi-server-support
  • 3299d15 Merge branch 'main' into feature/multi-server-support
  • a3ccccf Merge branch 'main' into feature/multi-server-support
  • 747af37 Merge branch 'main' into feature/multi-server-support
  • 5e953ba Merge branch 'main' into feature/multi-server-support
  • edd8b12 Merge branch 'main' into feature/multi-server-support
  • 4c7249c Merge branch 'main' into feature/multi-server-support
  • 3b262cf Merge branch 'main' into feature/multi-server-support

📊 Changes

17 files changed (+624 additions, -29 deletions)

View changed files

📝 database/db.go (+1 -0)
📝 database/model/model.go (+9 -0)
📝 go.mod (+1 -0)
📝 install.sh (+7 -0)
📝 main.go (+14 -2)
📝 sub/subService.go (+48 -27)
📝 web/controller/inbound.go (+1 -0)
➕ web/controller/multi_server_controller.go (+89 -0)
📝 web/controller/xui.go (+5 -0)
📝 web/html/component/aSidebar.html (+5 -0)
➕ web/html/servers.html (+165 -0)
➕ web/middleware/auth.go (+34 -0)
📝 web/service/inbound.go (+58 -0)
➕ web/service/inbound_service_sync_test.go (+72 -0)
➕ web/service/multi_server_service.go (+37 -0)
➕ web/service/multi_server_service_test.go (+63 -0)
📝 web/service/setting.go (+15 -0)

📄 Description

This commit introduces a multi-server architecture to the Sanai panel, allowing you to manage clients across multiple servers from a central panel.

Key changes include:

  • Database Schema: Added a servers table to store information about slave servers.
  • Server Management: Implemented a new service and controller (MultiServerService and MultiServerController) for CRUD operations on servers.
  • Web UI: Created a new web page for managing servers, accessible from the sidebar.
  • Client Synchronization: Modified the InboundService to synchronize client additions, updates, and deletions across all active slave servers via a REST API.
  • API Security: Added an API key authentication middleware to secure the communication between the master and slave panels.
  • Multi-Server Subscriptions: Updated the subscription service to generate links that include configurations for all active servers.
  • Installation Script: Modified the install.sh script to generate a random API key during installation.

Known Issues:

  • The integration test for client synchronization (TestInboundServiceSync) is currently failing. It seems that the API request to the mock slave server is not being sent correctly or the API key is not being included in the request header. Further investigation is needed to resolve this issue.

What is the pull request?

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Screenshots


🔄 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/3269 **Author:** [@javadtgh](https://github.com/javadtgh) **Created:** 7/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/multi-server-support` --- ### 📝 Commits (10+) - [`11dc068`](https://github.com/MHSanaei/3x-ui/commit/11dc06863e95108e54416dfd5ccc87753bb2f4c6) feat: Add multi-server support for Sanai panel - [`d65233c`](https://github.com/MHSanaei/3x-ui/commit/d65233cc2cbaf27a65f63f276b58afa2c3d2131f) Merge branch 'main' into feature/multi-server-support - [`ae82373`](https://github.com/MHSanaei/3x-ui/commit/ae8237345753d8ff8d64a53bfe12ecce22b76e5b) Merge branch 'main' into feature/multi-server-support - [`3299d15`](https://github.com/MHSanaei/3x-ui/commit/3299d15f28ba5b2bea1fcd628b3aec356bbac8bc) Merge branch 'main' into feature/multi-server-support - [`a3ccccf`](https://github.com/MHSanaei/3x-ui/commit/a3ccccfe529399c604d64cc4f183e14b4ee778fd) Merge branch 'main' into feature/multi-server-support - [`747af37`](https://github.com/MHSanaei/3x-ui/commit/747af376f270c46530f480da44221eba24fdd364) Merge branch 'main' into feature/multi-server-support - [`5e953ba`](https://github.com/MHSanaei/3x-ui/commit/5e953bae451c5622da9adc333ad6782ce8aa2ea2) Merge branch 'main' into feature/multi-server-support - [`edd8b12`](https://github.com/MHSanaei/3x-ui/commit/edd8b12988745eaec0a74b1bf736fe056b34dec6) Merge branch 'main' into feature/multi-server-support - [`4c7249c`](https://github.com/MHSanaei/3x-ui/commit/4c7249c451bdf0b6fa78f450468b686ca70b5440) Merge branch 'main' into feature/multi-server-support - [`3b262cf`](https://github.com/MHSanaei/3x-ui/commit/3b262cf180bb206dd84c83bd19536e9c2cf2fe9a) Merge branch 'main' into feature/multi-server-support ### 📊 Changes **17 files changed** (+624 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `database/db.go` (+1 -0) 📝 `database/model/model.go` (+9 -0) 📝 `go.mod` (+1 -0) 📝 `install.sh` (+7 -0) 📝 `main.go` (+14 -2) 📝 `sub/subService.go` (+48 -27) 📝 `web/controller/inbound.go` (+1 -0) ➕ `web/controller/multi_server_controller.go` (+89 -0) 📝 `web/controller/xui.go` (+5 -0) 📝 `web/html/component/aSidebar.html` (+5 -0) ➕ `web/html/servers.html` (+165 -0) ➕ `web/middleware/auth.go` (+34 -0) 📝 `web/service/inbound.go` (+58 -0) ➕ `web/service/inbound_service_sync_test.go` (+72 -0) ➕ `web/service/multi_server_service.go` (+37 -0) ➕ `web/service/multi_server_service_test.go` (+63 -0) 📝 `web/service/setting.go` (+15 -0) </details> ### 📄 Description This commit introduces a multi-server architecture to the Sanai panel, allowing you to manage clients across multiple servers from a central panel. Key changes include: - **Database Schema:** Added a `servers` table to store information about slave servers. - **Server Management:** Implemented a new service and controller (`MultiServerService` and `MultiServerController`) for CRUD operations on servers. - **Web UI:** Created a new web page for managing servers, accessible from the sidebar. - **Client Synchronization:** Modified the `InboundService` to synchronize client additions, updates, and deletions across all active slave servers via a REST API. - **API Security:** Added an API key authentication middleware to secure the communication between the master and slave panels. - **Multi-Server Subscriptions:** Updated the subscription service to generate links that include configurations for all active servers. - **Installation Script:** Modified the `install.sh` script to generate a random API key during installation. **Known Issues:** - The integration test for client synchronization (`TestInboundServiceSync`) is currently failing. It seems that the API request to the mock slave server is not being sent correctly or the API key is not being included in the request header. Further investigation is needed to resolve this issue. ## What is the pull request? <!-- Briefly describe the changes introduced by this pull request --> ## Which part of the application is affected by the change? - [ ] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [x] New feature - [ ] Refactoring - [ ] Other ## Screenshots <!-- Add screenshots to illustrate the changes --> <!-- Remove this section if it is not applicable. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:46:35 +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#5379
No description provided.