mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-17 17:48:40 +00:00
Add commands for listing inbound and outbound tags.
This commit is contained in:
parent
7cb8cfb9eb
commit
229a4b3fe1
8 changed files with 181 additions and 235 deletions
|
@ -150,27 +150,6 @@ func (s *handlerServer) GetInboundUsersCount(ctx context.Context, request *GetIn
|
|||
return &GetInboundUsersCountResponse{Count: um.GetUsersCount(ctx)}, nil
|
||||
}
|
||||
|
||||
func (s *handlerServer) ListInboundUsers(ctx context.Context, request *ListInboundUserRequest) (*ListInboundUserResponse, error) {
|
||||
handlers := s.ihm.ListHandlers(ctx)
|
||||
var result = make([]*protocol.User, 0, 100)
|
||||
for _, handler := range handlers {
|
||||
p, err := getInbound(handler)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
um, ok := p.(proxy.UserManager)
|
||||
if !ok {
|
||||
return nil, errors.New("proxy is not a UserManager")
|
||||
}
|
||||
|
||||
users := um.GetUsers(ctx)
|
||||
for _, u := range users {
|
||||
result = append(result, protocol.ToProtoUser(u))
|
||||
}
|
||||
}
|
||||
return &ListInboundUserResponse{Users: result}, nil
|
||||
}
|
||||
|
||||
func (s *handlerServer) AddOutbound(ctx context.Context, request *AddOutboundRequest) (*AddOutboundResponse, error) {
|
||||
if err := core.AddOutboundHandler(s.s, request.Outbound); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue