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

Method GetUserOnlineIpListStats

controller/rest/stats.go:48–65  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

46}
47
48func (s *Service) GetUserOnlineIpListStats(w http.ResponseWriter, r *http.Request) {
49 var request common.StatRequest
50 if err := common.ReadProtoBody(r.Body, &request); err != nil {
51 http.Error(w, err.Error(), http.StatusBadRequest)
52 return
53 }
54
55 stats, err := s.Backend().GetUserOnlineIpListStats(r.Context(), request.GetName())
56 if err != nil {
57 err = common.InterceptNotFound(err)
58 st, _ := status.FromError(err)
59 httpCode := common.GrpcCodeToHTTP(st.Code())
60 http.Error(w, err.Error(), httpCode)
61 return
62 }
63
64 common.SendProtoResponse(w, stats)
65}
66
67func (s *Service) GetBackendStats(w http.ResponseWriter, r *http.Request) {
68 stats, err := s.Backend().GetSysStats(r.Context())

Callers

nothing calls this directly

Implementers 1

Controllercontroller/controller.go

Calls 8

GetNameMethod · 0.95
ReadProtoBodyFunction · 0.92
InterceptNotFoundFunction · 0.92
GrpcCodeToHTTPFunction · 0.92
SendProtoResponseFunction · 0.92
ErrorMethod · 0.80
BackendMethod · 0.80

Tested by

no test coverage detected