diff --git a/api/panel/user.go b/api/panel/user.go index edf92284..3bbb4240 100644 --- a/api/panel/user.go +++ b/api/panel/user.go @@ -34,24 +34,24 @@ func (c *Client) GetUserList() ([]UserInfo, error) { SetHeader("If-None-Match", c.userEtag). ForceContentType("application/json"). Get(path) - if err = c.checkResponse(r, path, err); err != nil { - return nil, err - } - if r != nil { - defer r.RawResponse.Body.Close() - } else { - return nil, fmt.Errorf("received nil response") + if r == nil || r.RawResponse == nil { + return nil, fmt.Errorf("received nil response or raw response") } + defer r.RawResponse.Body.Close() if r.StatusCode() == 304 { return nil, nil - } else { - if err := json.Unmarshal(r.Body(), c.UserList); err != nil { - return nil, fmt.Errorf("unmarshal user list error: %w", err) - } - c.userEtag = r.Header().Get("ETag") } - return c.UserList.Users, nil + + if err = c.checkResponse(r, path, err); err != nil { + return nil, err + } + userlist := &UserListBody{} + if err := json.Unmarshal(r.Body(), userlist); err != nil { + return nil, fmt.Errorf("unmarshal user list error: %w", err) + } + c.userEtag = r.Header().Get("ETag") + return userlist.Users, nil } // GetUserAlive will fetch the alive_ip count for users @@ -60,14 +60,15 @@ func (c *Client) GetUserAlive() (map[int]int, error) { r, err := c.client.R(). ForceContentType("application/json"). Get(path) - if err != nil || r.StatusCode() >= 399 { - return make(map[int]int), nil + if r == nil || r.RawResponse == nil { + return nil, fmt.Errorf("received nil response or raw response") } + defer r.RawResponse.Body.Close() - if r != nil { - defer r.RawResponse.Body.Close() - } else { - return nil, fmt.Errorf("received nil response") + c.AliveMap = &AliveMap{} + if err != nil || r.StatusCode() >= 399 { + c.AliveMap.Alive = make(map[int]int) + return c.AliveMap.Alive, nil } if err := json.Unmarshal(r.Body(), c.AliveMap); err != nil { diff --git a/core/xray/inbound.go b/core/xray/inbound.go index 18d8492c..d5b3e1cb 100644 --- a/core/xray/inbound.go +++ b/core/xray/inbound.go @@ -213,11 +213,6 @@ func buildV2ray(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCon if err != nil { return fmt.Errorf("unmarshal grpc settings error: %s", err) } - case "quic": - err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.QUICSettings) - if err != nil { - return fmt.Errorf("unmarshal grpc settings error: %s", err) - } case "httpupgrade": err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.HTTPUPGRADESettings) if err != nil { diff --git a/limiter/limiter.go b/limiter/limiter.go index 6f59822b..39aa3db9 100644 --- a/limiter/limiter.go +++ b/limiter/limiter.go @@ -104,7 +104,9 @@ func DeleteLimiter(tag string) { func (l *Limiter) UpdateUser(tag string, added []panel.UserInfo, deleted []panel.UserInfo) { for i := range deleted { l.UserLimitInfo.Delete(format.UserTag(tag, deleted[i].Uuid)) + l.UserOnlineIP.Delete(format.UserTag(tag, deleted[i].Uuid)) delete(l.UUIDtoUID, deleted[i].Uuid) + delete(l.AliveList, deleted[i].Id) } for i := range added { userLimit := &UserLimitInfo{