mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-14 07:10:58 +00:00
feat(wireguard): multi-client support
WireGuard inbounds now manage per-client peers using xray-core's native WireGuard users (AddUser/RemoveUser). Each client lives in settings.clients (canonical, like every other protocol) and is projected to peers[] only when emitting the xray config, at level 0 so the dispatcher's per-user traffic/online counters work with no extra plumbing. Backend: internal/util/wireguard gains KeyToHex (base64 to hex for the gRPC path), PublicKeyFromPrivate and GenerateWireguardPSK; xray/api.go builds a wireguard account in AddUser with hex keys (RemoveUser already worked); client CRUD generates a keypair and allocates a unique tunnel address per client and never rotates keys on edit; an idempotent migration converts legacy settings.peers into managed clients; WireGuard is included in the raw subscription. Frontend: WireGuard in the add-client modal with keys on the credential tab, client schema, per-client QR/link/.conf, inbound form reduced to server settings; i18n added across 13 locales. Fix: guard the settings[clients] assertion in add/update so a legacy WireGuard inbound stored without a clients key no longer panics.
This commit is contained in:
@@ -1084,6 +1084,12 @@
|
||||
"Client": {
|
||||
"description": "Client represents a client configuration for Xray inbounds with traffic limits and settings.",
|
||||
"properties": {
|
||||
"allowedIPs": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"auth": {
|
||||
"description": "Auth password (Hysteria)",
|
||||
"type": "string"
|
||||
@@ -1120,6 +1126,9 @@
|
||||
"description": "Unique client identifier",
|
||||
"type": "string"
|
||||
},
|
||||
"keepAlive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"limitIp": {
|
||||
"description": "IP limit for this client",
|
||||
"type": "integer"
|
||||
@@ -1128,6 +1137,15 @@
|
||||
"description": "Client password",
|
||||
"type": "string"
|
||||
},
|
||||
"preSharedKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"privateKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"publicKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"reset": {
|
||||
"description": "Reset period in days",
|
||||
"type": "integer"
|
||||
@@ -1201,6 +1219,9 @@
|
||||
},
|
||||
"ClientRecord": {
|
||||
"properties": {
|
||||
"allowedIPs": {
|
||||
"type": "string"
|
||||
},
|
||||
"auth": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1228,12 +1249,24 @@
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"keepAlive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"limitIp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"preSharedKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"privateKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"publicKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"reset": {
|
||||
"type": "integer"
|
||||
},
|
||||
@@ -1258,6 +1291,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"allowedIPs",
|
||||
"auth",
|
||||
"comment",
|
||||
"createdAt",
|
||||
@@ -1267,8 +1301,12 @@
|
||||
"flow",
|
||||
"group",
|
||||
"id",
|
||||
"keepAlive",
|
||||
"limitIp",
|
||||
"password",
|
||||
"preSharedKey",
|
||||
"privateKey",
|
||||
"publicKey",
|
||||
"reset",
|
||||
"reverse",
|
||||
"security",
|
||||
|
||||
Reference in New Issue
Block a user