api/proxies/:name
(ctx *httppkg.Context)
| 190 | |
| 191 | // /api/proxies/:name |
| 192 | func (c *Controller) APIProxyByName(ctx *httppkg.Context) (any, error) { |
| 193 | name := ctx.Param("name") |
| 194 | |
| 195 | ps := mem.StatsCollector.GetProxyByName(name) |
| 196 | if ps == nil { |
| 197 | return nil, httppkg.NewError(http.StatusNotFound, "no proxy info found") |
| 198 | } |
| 199 | |
| 200 | proxyInfo := model.GetProxyStatsResp{ |
| 201 | Name: ps.Name, |
| 202 | User: ps.User, |
| 203 | ClientID: ps.ClientID, |
| 204 | TodayTrafficIn: ps.TodayTrafficIn, |
| 205 | TodayTrafficOut: ps.TodayTrafficOut, |
| 206 | CurConns: ps.CurConns, |
| 207 | LastStartTime: ps.LastStartTime, |
| 208 | LastCloseTime: ps.LastCloseTime, |
| 209 | } |
| 210 | |
| 211 | if pxy, ok := c.pxyManager.GetByName(name); ok { |
| 212 | proxyInfo.Conf = getConfFromConfigurer(pxy.GetConfigurer()) |
| 213 | proxyInfo.Status = "online" |
| 214 | } else { |
| 215 | proxyInfo.Status = "offline" |
| 216 | } |
| 217 | |
| 218 | return proxyInfo, nil |
| 219 | } |
| 220 | |
| 221 | // DELETE /api/proxies?status=offline |
| 222 | func (c *Controller) DeleteProxies(ctx *httppkg.Context) (any, error) { |
nothing calls this directly
no test coverage detected