(w http.ResponseWriter, r *http.Request)
| 356 | } |
| 357 | |
| 358 | func (h *Handler) statJSON(w http.ResponseWriter, r *http.Request) { |
| 359 | payload, err := h.buildStatPayload() |
| 360 | if err != nil { |
| 361 | http.Error(w, "internal server error", http.StatusInternalServerError) |
| 362 | return |
| 363 | } |
| 364 | w.Header().Set("Content-Type", "application/json") |
| 365 | json.NewEncoder(w).Encode(payload) |
| 366 | } |
| 367 | |
| 368 | // statStream 是 /v1/stat/stream 的 SSE 处理器(无需认证)。 |
| 369 | // 连接时立即推送 event:init(完整 stat 数据),之后每 2s 推送 event:metrics(实时网速), |
nothing calls this directly
no test coverage detected