MCPcopy Create free account
hub / github.com/PasarGuard/node / buildStatResponse

Function buildStatResponse

backend/xray/api/stats.go:140–157  ·  view source on GitHub ↗
(queryStats []*command.Stat)

Source from the content-addressed store, hash-verified

138}
139
140func buildStatResponse(queryStats []*command.Stat) *common.StatResponse {
141 stats := &common.StatResponse{}
142 for _, stat := range queryStats {
143 name, link, statType, ok := parseStatName(stat.GetName())
144 if !ok {
145 continue
146 }
147
148 stats.Stats = append(stats.Stats, &common.Stat{
149 Name: name,
150 Type: statType,
151 Link: link,
152 Value: stat.GetValue(),
153 })
154 }
155
156 return stats
157}
158
159func parseStatName(raw string) (name, link, statType string, ok bool) {
160 parts := strings.Split(raw, ">>>")

Callers 7

GetUsersStatsMethod · 0.85
GetInboundsStatsMethod · 0.85
GetOutboundsStatsMethod · 0.85
GetUserStatsMethod · 0.85
GetInboundStatsMethod · 0.85
GetOutboundStatsMethod · 0.85

Calls 3

parseStatNameFunction · 0.85
GetNameMethod · 0.45
GetValueMethod · 0.45