MCPcopy Create free account
hub / github.com/M1r0ku/frp-Modify / apiReload

Method apiReload

frp-dev/client/admin_api.go:44–71  ·  view source on GitHub ↗

GET api/reload

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

42
43// GET api/reload
44func (svr *Service) apiReload(w http.ResponseWriter, r *http.Request) {
45 res := GeneralResponse{Code: 200}
46
47 log.Info("api request [/api/reload]")
48 defer func() {
49 log.Info("api response [/api/reload], code [%d]", res.Code)
50 w.WriteHeader(res.Code)
51 if len(res.Msg) > 0 {
52 _, _ = w.Write([]byte(res.Msg))
53 }
54 }()
55
56 _, pxyCfgs, visitorCfgs, err := config.ParseClientConfig(svr.cfgFile)
57 if err != nil {
58 res.Code = 400
59 res.Msg = err.Error()
60 log.Warn("reload frpc proxy config error: %s", res.Msg)
61 return
62 }
63
64 if err = svr.ReloadConf(pxyCfgs, visitorCfgs); err != nil {
65 res.Code = 500
66 res.Msg = err.Error()
67 log.Warn("reload frpc proxy config error: %s", res.Msg)
68 return
69 }
70 log.Info("success reload conf")
71}
72
73type StatusResp struct {
74 TCP []ProxyStatusResp `json:"tcp"`

Callers

nothing calls this directly

Calls 5

ReloadConfMethod · 0.95
InfoMethod · 0.80
ErrorMethod · 0.80
WarnMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected