MCPcopy
hub / github.com/IceWhaleTech/CasaOS / GetSystemNetInfo

Function GetSystemNetInfo

route/v1/system.go:296–312  ·  view source on GitHub ↗

@Summary get Net info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/net [get]

(ctx echo.Context)

Source from the content-addressed store, hash-verified

294// @Success 200 {string} string "ok"
295// @Router /sys/net [get]
296func GetSystemNetInfo(ctx echo.Context) error {
297 netList := service.MyService.System().GetNetInfo()
298 newNet := []model.IOCountersStat{}
299 for _, n := range netList {
300 for _, netCardName := range service.MyService.System().GetNet(true) {
301 if n.Name == netCardName {
302 item := *(*model.IOCountersStat)(unsafe.Pointer(&n))
303 item.State = strings.TrimSpace(service.MyService.System().GetNetState(n.Name))
304 item.Time = time.Now().Unix()
305 newNet = append(newNet, item)
306 break
307 }
308 }
309 }
310
311 return ctx.JSON(http.StatusOK, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: newNet})
312}
313
314func GetSystemProxy(ctx echo.Context) error {
315 url := ctx.QueryParam("url")

Callers

nothing calls this directly

Calls 5

GetMsgFunction · 0.92
GetNetInfoMethod · 0.65
SystemMethod · 0.65
GetNetMethod · 0.65
GetNetStateMethod · 0.65

Tested by

no test coverage detected