mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #3635] [CLOSED] feat: 3X-UI(3.0.0) Multi-Node Architecture, Client Management, HWID Tracking, Host Management, Glass Morphism UI & Redis Cache #5492
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#5492
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/3635
Author: @konstpic
Created: 1/6/2026
Status: ❌ Closed
Base:
main← Head:node-mode📝 Commits (10+)
d7175e7multi-node supportcdd90deedit nodes config,api,checks,dash09c5c05edit nodes config,api,checks,dash37906b7edit nodes config,api,checks,dash3d3ad23edit nodes config,api,checks,dash8a5c270Merge branch 'main' into node-mode5d355f9Remove unnecessary files from PR42b28a5Restore dokcer-compose.ymlb6f336atranslate to eng66662affeat: add geo files to nodes and fix func inbounds📊 Changes
86 files changed (+14439 additions, -1123 deletions)
View changed files
➕
README_node_mode.md(+172 -0)📝
database/db.go(+7 -0)📝
database/model/model.go(+130 -0)📝
docker-compose.yml(+5 -0)📝
go.mod(+14 -0)📝
go.sum(+10 -0)📝
logger/logger.go(+34 -5)📝
main.go(+7 -0)➕
node/Dockerfile(+124 -0)➕
node/README.md(+79 -0)➕
node/api/server.go(+303 -0)➕
node/bin/config.json(+1 -0)➕
node/config/config.go(+156 -0)➕
node/docker-compose.yml(+23 -0)➕
node/logs/pusher.go(+346 -0)➕
node/main.go(+114 -0)➕
node/xray/manager.go(+541 -0)📝
sub/subController.go(+13 -5)📝
sub/subJsonService.go(+15 -1)📝
sub/subService.go(+1364 -217)...and 66 more files
📄 Description
Multi-Node Architecture, Client Management, HWID Tracking, Host Management, Glass Morphism UI & Redis Cache
Description
This pull request introduces a comprehensive architectural overhaul of the 3x-ui panel, adding support for distributed multi-node architecture, independent client management with many-to-many relationships, hardware ID tracking, host management for load balancing, a modern Glass Morphism UI theme, and Redis caching for improved performance.
What Changed?
1. Node Mechanism (Multi-Node Architecture)
Overview
The panel now supports distributed architecture with multiple worker nodes. Instead of running XRAY Core locally, the panel can manage multiple remote nodes running XRAY Core instances.
Node Registration and Interaction
Node Registration Process:
Adding a Node: Users can add nodes through the UI by providing:
Automatic API Key Validation: When adding or updating a node, the system:
Node Health Monitoring:
CheckNodeHealthJob)online(green),offline(orange),unknown(gray)Node Interaction
API Endpoints on Panel:
GET /panel/node/list- Get list of all nodesGET /panel/node/get/:id- Get information about a specific nodePOST /panel/node/add- Add a new node (with validation)POST /panel/node/update/:id- Update a node (supports partial updates)POST /panel/node/del/:id- Delete a nodePOST /panel/node/check/:id- Check health of a specific nodePOST /panel/node/checkAll- Check health of all nodesPOST /panel/node/reload/:id- Reload XRAY on a nodePOST /panel/node/reloadAll- Reload XRAY on all nodesGET /panel/node/status/:id- Get detailed status of a nodeNode Service API (on Worker Nodes):
POST /api/v1/apply- Apply XRAY configurationPOST /api/v1/reload- Reload XRAYPOST /api/v1/force-reload- Force reload XRAYGET /api/v1/status- Get XRAY statusGET /api/v1/stats- Get traffic statistics and online clientsGET /health- Health check endpoint (no authentication required)Configuration Synchronization:
Statistics Collection:
CollectNodeStatsJob)ClientEntitytable2. Client Entities (Many-to-Many with Inbounds)
Overview
Clients are now independent entities stored in a separate
client_entitiestable. A single client can be assigned to multiple inbounds, enabling flexible configuration management.Client Entity Structure
Many-to-Many Relationship
ClientInboundMapping Table:
How It Works:
ClientInboundMappingrecords are created/updatedInbound.Settingsis automatically regenerated from all assignedClientEntityrecordsBenefits:
API Endpoints
GET /panel/client/list- Get all clients for userGET /panel/client/get/:id- Get client by IDPOST /panel/client/add- Add new client (with inbound assignments)POST /panel/client/update/:id- Update client (updates all related inbounds)POST /panel/client/del/:id- Delete client (removes from all inbounds)3. Inbound Entities (Many-to-Many with Nodes)
Overview
Inbounds can now be assigned to multiple nodes, enabling load distribution and redundancy.
Inbound Structure
Many-to-Many Relationship
InboundNodeMapping Table:
How It Works:
NodeIdsarrayExample:
Work Modes
Single-Mode (Default):
Multi-Mode:
4. Host Management (Address Override for Load Balancing)
Overview
Hosts allow overriding the endpoint address in subscription links, useful for load balancing, CDN integration, or custom routing.
Host Structure
Many-to-Many Relationship
HostInboundMapping Table:
How It Works:
Example:
cdn.example.cominstead of192.168.1.100API Endpoints
GET /panel/host/list- Get all hosts for userGET /panel/host/get/:id- Get host by IDPOST /panel/host/add- Add new host (with inbound assignments)POST /panel/host/update/:id- Update hostPOST /panel/host/del/:id- Delete host5. HWID Tracking (Hardware ID Tracking)
Overview
HWID tracking allows limiting the number of devices that can simultaneously use a client account, preventing unauthorized credential sharing and controlling resource usage.
HWID Structure
How It Works
Registration Process:
x-hwidheader when requesting subscriptionHWIDEnabledis true andMaxHWIDis set, device limit is checkedclient_hw_idstableModes:
off- HWID tracking disabledclient_header- Explicit registration via header (recommended)ip_based- Generate HWID from IP (deprecated)Features:
API Endpoints
GET /panel/client/hwid/list/:clientId- Get all HWIDs for clientPOST /panel/client/hwid/register- Register HWID (via subscription request)POST /panel/client/hwid/del/:id- Delete HWIDPOST /panel/client/hwid/block/:id- Block HWIDPOST /panel/client/hwid/unblock/:id- Unblock HWIDBackground Jobs
CheckClientHWIDJob- Periodic check of HWID limits and status updates6. Glass Morphism UI Theme
Overview
A modern Glass Morphism design theme has been added to the panel, providing a sleek, translucent glass-like appearance with backdrop blur effects.
Features
Visual Design:
Theme Switching:
Implementation:
UI Components Updated:
Pages with Glass Morphism:
7. Redis Cache Integration
Overview
Redis caching has been integrated to significantly improve panel performance by caching frequently accessed data.
Cache Implementation
Cache Layer:
web/cache/cache.go- Cache interfaceweb/cache/redis.go- Redis implementationweb/cache/redisstore.go- Redis store for sessionsCached Data:
Cache Invalidation:
Middleware:
web/middleware/cache.go- Cache middleware for HTTP requestsPerformance Benefits
Configuration
Redis connection configured via environment variables or settings:
Database Changes
New Tables
client_entities- Client tableuser_id,email(unique per user),sub_idclient_inbound_mappings- Client-Inbound mapping(client_id, inbound_id)nodes- Node tableinbound_node_mappings- Inbound-Node mapping(inbound_id, node_id)client_hw_ids- HWID table(client_id, hwid)hosts- Host tablehost_inbound_mappings- Host-Inbound mapping(host_id, inbound_id)Updated Tables
inbounds- Settings now auto-generated from ClientEntityBackend (Go)
New Services
NodeService: Node management, health checks, API validationClientService: Client CRUD operations, inbound assignmentsClientHWIDService: HWID tracking and managementClientTrafficService: Client traffic statisticsHostService: Host management and subscription address overrideNew Controllers
NodeController: Node API endpointsClientController: Client API endpointsClientHWIDController: HWID API endpointsHostController: Host API endpointsNew Background Jobs
CheckNodeHealthJob: Health checks every 5 minutesCollectNodeStatsJob: Statistics collection every 30 secondsCheckClientHWIDJob: HWID limit checksUpdated Services
InboundService: Updated for multi-node and client entity supportXrayService: Multi-node configuration distributionSubService: Node address and host override supportServerService: Node availability in system statusFrontend (Vue.js/HTML)
New Pages
nodes.html: Node management interfaceclients.html: Client management interfacehosts.html: Host management interfaceNew Modals
node_modal.html: Node add/edit modalclient_entity_modal.html: Client add/edit modalhost_modal.html: Host add/edit modalUpdated Pages
inbounds.html: Multi-node selection, client entity integrationindex.html: Nodes availability speedometer, Glass Morphismsettings.html: Multi-Node mode toggle, Glass Morphism settingsUpdated Components
aThemeSwitch.html: Glass Morphism toggleaSidebar.html: Glass Morphism stylingaClientTable.html: Client entity displayNode Service (New Component)
Structure
Features
Localization
Technical Details
Architecture
nodeIdfieldSecurity
Performance
Type of Changes
Affected Parts of Application
Testing
Migration
When updating an existing installation:
Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.