fix(inbounds): serve fresh client UUIDs for list and allLinks (#6458)

* fix(inbounds): serve fresh client UUIDs for list and allLinks (#6436)

Resolve clients from the clients table in inboundLinks and
backfillClientStats so /inbounds/list ClientStats and allLinks match
the running Xray identity when embedded settings JSON is stale.

* fix(sub): keep WG/AWG settings identity in link exports (#6436)

clientsForLinkExport uses the clients table for UUID-bearing protocols and
the inbound settings JSON for WireGuard/AmneziaWG so allLinks and per-client
QR links stay consistent without collapsing per-inbound tunnel keys.

* fix(sub): fall back to settings clients for link export (#6458)

Prefer ListClientsForInbound for UUID protocols, but when the clients
table is empty or unavailable fall back to GetClients so settings-only
inbounds (and share-link unit tests) still produce links. Keep WG/AWG
on settings identity.

---------

Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
This commit is contained in:
mrchatam
2026-09-12 12:42:13 +03:30
committed by GitHub
parent 7a41c59494
commit 67addab343
6 changed files with 325 additions and 12 deletions
+8
View File
@@ -573,6 +573,14 @@ func (s *InboundService) GetClientsBySubId(inboundId int, subId string) ([]model
return s.clientService.ListForInboundBySubId(nil, inboundId, subId)
}
// ListClientsForInbound returns every client attached to the inbound from the
// normalized clients tables — the same source the running Xray config uses —
// instead of parsing the embedded settings JSON, which can hold a stale UUID
// after a client identity change (#6436).
func (s *InboundService) ListClientsForInbound(inboundId int) ([]model.Client, error) {
return s.clientService.ListForInbound(nil, inboundId)
}
func (s *InboundService) GetAllEmails() ([]string, error) {
db := database.GetDB()
var emails []string