mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-11 15:45:00 +03:00
9c8cd08f90
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.
138 lines
2.7 KiB
Plaintext
138 lines
2.7 KiB
Plaintext
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
|
|
exports[`createDefault*InboundSettings factories > hysteria (v1, defaults to v2 wire version) 1`] = `
|
|
{
|
|
"clients": [],
|
|
"version": 2,
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > shadowsocks 1`] = `
|
|
{
|
|
"clients": [],
|
|
"ivCheck": false,
|
|
"method": "2022-blake3-aes-256-gcm",
|
|
"network": "tcp,udp",
|
|
"password": "ZmFrZS1zcy1zZWVk",
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > trojan 1`] = `
|
|
{
|
|
"clients": [],
|
|
"fallbacks": [],
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > tunnel 1`] = `
|
|
{
|
|
"allowedNetwork": "tcp,udp",
|
|
"followRedirect": false,
|
|
"portMap": {},
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > vless 1`] = `
|
|
{
|
|
"clients": [],
|
|
"decryption": "none",
|
|
"encryption": "none",
|
|
"fallbacks": [],
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > vmess 1`] = `
|
|
{
|
|
"clients": [],
|
|
}
|
|
`;
|
|
|
|
exports[`createDefault*InboundSettings factories > wireguard 1`] = `
|
|
{
|
|
"clients": [],
|
|
"mtu": 1420,
|
|
"noKernelTun": false,
|
|
"peers": [],
|
|
"secretKey": "QGVlb2dXc1ZTWGw0ZXBzZndsWmtMaUM5MUlNYjBHWFdYbz0=",
|
|
}
|
|
`;
|
|
|
|
exports[`createDefaultHysteriaClient > produces a Zod-valid client 1`] = `
|
|
{
|
|
"auth": "fixed-hyst-auth",
|
|
"comment": "",
|
|
"email": "fixture@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"reset": 0,
|
|
"subId": "fixed-sub-id-1234",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
}
|
|
`;
|
|
|
|
exports[`createDefaultShadowsocksClient > produces a Zod-valid client 1`] = `
|
|
{
|
|
"comment": "",
|
|
"email": "fixture@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"method": "",
|
|
"password": "ZmFrZS1zcy1wYXNzd29yZA==",
|
|
"reset": 0,
|
|
"subId": "fixed-sub-id-1234",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
}
|
|
`;
|
|
|
|
exports[`createDefaultTrojanClient > produces a Zod-valid client 1`] = `
|
|
{
|
|
"comment": "",
|
|
"email": "fixture@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"password": "fixed-trojan-pw",
|
|
"reset": 0,
|
|
"subId": "fixed-sub-id-1234",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
}
|
|
`;
|
|
|
|
exports[`createDefaultVlessClient > produces a Zod-valid client 1`] = `
|
|
{
|
|
"comment": "",
|
|
"email": "fixture@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"flow": "",
|
|
"id": "11111111-2222-4333-8444-555555555555",
|
|
"limitIp": 0,
|
|
"reset": 0,
|
|
"subId": "fixed-sub-id-1234",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
}
|
|
`;
|
|
|
|
exports[`createDefaultVmessClient > produces a Zod-valid client 1`] = `
|
|
{
|
|
"alterId": 0,
|
|
"comment": "",
|
|
"email": "fixture@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"id": "aaaaaaaa-bbbb-4ccc-9ddd-eeeeeeeeeeee",
|
|
"limitIp": 0,
|
|
"reset": 0,
|
|
"security": "auto",
|
|
"subId": "fixed-sub-id-1234",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
}
|
|
`;
|