mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-25 03:54:47 +03:00
feat(wireguard): support multiple devices per client (#7143)
A WireGuard client had one key pair and one tunnel address, so an operator who gave the same config to a phone and a laptop saw the two fight over the peer endpoint. One client can now own extra devices, up to a per-client limit: each has its own keys and address, shares the client's quota, expiry and switch, and gets its own config, QR code and subscription. Devices become extra peers under the client's email, built by the same core-user map the other paths use, and a device change is applied to the running inbound in place instead of rebuilding it. Nodes advertise a wg-devices capability; the master refuses a device for a node that would ignore it, before storing it and again when pushing the inbound.
This commit is contained in:
@@ -28,8 +28,11 @@ const (
|
||||
CapAmneziaWGKernel = "awg-kernel"
|
||||
// CapPreserveClientTraffic marks a node that supports inbound-only scheduled resets.
|
||||
CapPreserveClientTraffic = "preserve-client-traffic"
|
||||
// CapWireguardDevices marks a node that serves a WireGuard client's extra devices;
|
||||
// an older node ignores them and keeps only the client's first peer.
|
||||
CapWireguardDevices = "wg-devices"
|
||||
// NodeCaps is the full CapsHeader value this build advertises.
|
||||
NodeCaps = CapZstd + "," + CapAmneziaWGKernel + "," + CapPreserveClientTraffic
|
||||
NodeCaps = CapZstd + "," + CapAmneziaWGKernel + "," + CapPreserveClientTraffic + "," + CapWireguardDevices
|
||||
|
||||
// maxDecodeBytes bounds in-memory decompression to defuse a zstd bomb from
|
||||
// an (authenticated) node-API caller.
|
||||
|
||||
Reference in New Issue
Block a user