mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-16 00:01:02 +00:00
feat(inbounds): improve multi-node online attribution (#6164)
This commit is contained in:
@@ -698,8 +698,13 @@ type TrafficSnapshot struct {
|
||||
// OnlineEmails so the master can attribute deeply nested clients to the real
|
||||
// node across a chain (#4983). Empty when the node is an old build without
|
||||
// the per-GUID endpoint — OnlineEmails is the fallback then.
|
||||
OnlineTree map[string][]string
|
||||
LastOnlineMap map[string]int64
|
||||
OnlineTree map[string][]string
|
||||
// ActiveInboundTree is the GUID-keyed subtree of inbound tags that carried
|
||||
// traffic within the node's online grace window. Empty when the node is an
|
||||
// old build without the endpoint; the master then falls back to email-only
|
||||
// online attribution for that node.
|
||||
ActiveInboundTree map[string][]string
|
||||
LastOnlineMap map[string]int64
|
||||
// HostGroups carries the node's per-inbound host overrides (TLS/SNI/
|
||||
// fingerprint), fetched only when the snapshot holds a not-yet-adopted tag.
|
||||
HostGroups []*entity.HostGroup
|
||||
@@ -754,6 +759,13 @@ func (r *Remote) FetchTrafficSnapshot(ctx context.Context) (*TrafficSnapshot, er
|
||||
_ = json.Unmarshal(envLastOnline.Obj, &snap.LastOnlineMap)
|
||||
}
|
||||
|
||||
envActiveInbounds, err := r.do(ctx, http.MethodPost, "panel/api/clients/activeInbounds", nil)
|
||||
if err != nil {
|
||||
logger.Debugf("remote %s active inbounds fetch failed: %v", r.node.Name, err)
|
||||
} else if len(envActiveInbounds.Obj) > 0 {
|
||||
_ = json.Unmarshal(envActiveInbounds.Obj, &snap.ActiveInboundTree)
|
||||
}
|
||||
|
||||
return snap, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user