web/frpc: support more info (#3334)

This commit is contained in:
fatedier
2023-02-26 02:54:53 +08:00
committed by GitHub
parent 871511ba52
commit 8c6303c1e5
20 changed files with 277 additions and 340 deletions

View File

@@ -39,43 +39,15 @@ func (c *Client) GetProxyStatus(name string) (*client.ProxyStatusResp, error) {
if err != nil {
return nil, err
}
allStatus := &client.StatusResp{}
allStatus := make(client.StatusResp)
if err = json.Unmarshal([]byte(content), &allStatus); err != nil {
return nil, fmt.Errorf("unmarshal http response error: %s", strings.TrimSpace(content))
}
for _, s := range allStatus.TCP {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.UDP {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.HTTP {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.HTTPS {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.STCP {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.XTCP {
if s.Name == name {
return &s, nil
}
}
for _, s := range allStatus.SUDP {
if s.Name == name {
return &s, nil
for _, pss := range allStatus {
for _, ps := range pss {
if ps.Name == name {
return &ps, nil
}
}
}
return nil, fmt.Errorf("no proxy status found")