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

Method handleUserStats

backend/wireguard/stats.go:28–38  ·  view source on GitHub ↗
(ctx context.Context, request *common.StatRequest)

Source from the content-addressed store, hash-verified

26}
27
28func (wg *WireGuard) handleUserStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error) {
29 var keys []string
30 if peer := wg.peerStore.GetByEmail(request.GetName()); peer != nil {
31 keys = []string{peer.PublicKey.String()}
32 }
33 if len(keys) == 0 {
34 return &common.StatResponse{Stats: []*common.Stat{}}, nil
35 }
36
37 return wg.statsTracker.GetStats(ctx, keys, request.GetReset_()), nil
38}
39
40func (wg *WireGuard) handleUsersStats(ctx context.Context, request *common.StatRequest) (*common.StatResponse, error) {
41 return wg.statsTracker.GetUsersStats(ctx, request.GetReset_()), nil

Callers 1

GetStatsMethod · 0.95

Calls 5

GetByEmailMethod · 0.80
GetReset_Method · 0.80
GetStatsMethod · 0.65
GetNameMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected