Add commands for listing inbound and outbound tags.

This commit is contained in:
Sergey Gorbunov 2025-05-13 16:56:23 +03:00
parent 7cb8cfb9eb
commit 229a4b3fe1
No known key found for this signature in database
GPG key ID: A8C3D74066B8E768
8 changed files with 181 additions and 235 deletions

View file

@ -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