(mux *http.ServeMux)
| 138 | } |
| 139 | |
| 140 | func (a *API) Register(mux *http.ServeMux) { |
| 141 | mux.HandleFunc("/v1/nodes", a.handleNodes) |
| 142 | // 精确路由优先于 /v1/nodes/ 通配 |
| 143 | mux.HandleFunc("GET /v1/nodes/metrics/stream", a.handleAllNodeMetricsStream) |
| 144 | mux.HandleFunc("GET /v1/nodes/traceroute/latest", a.handleAllTracerouteLatest) |
| 145 | mux.HandleFunc("GET /v1/nodes/latency", a.handleLatency) |
| 146 | mux.HandleFunc("/v1/nodes/", a.handleNodeRoutes) |
| 147 | mux.HandleFunc("GET /v1/audit/logs", a.handleAuditLogs) |
| 148 | mux.HandleFunc("GET /v1/audit/users", a.handleAuditUsers) |
| 149 | mux.HandleFunc("GET /v1/audit/count", a.handleAuditCount) |
| 150 | mux.HandleFunc("GET /v1/audit/analysis", a.handleAuditAnalysis) |
| 151 | mux.HandleFunc("/v1/audit/rules", a.handleAuditRules) |
| 152 | mux.HandleFunc("/v1/audit/rules/", a.handleAuditRuleByID) |
| 153 | } |
| 154 | |
| 155 | func (a *API) handleNodes(w http.ResponseWriter, r *http.Request) { |
| 156 | switch r.Method { |
no outgoing calls