Write a test covering both methods and ignore commander when listing outbounds.

This commit is contained in:
Sergey Gorbunov 2025-05-14 16:08:40 +03:00
parent 1f014eb655
commit 3af7a19c06
No known key found for this signature in database
GPG key ID: A8C3D74066B8E768
2 changed files with 104 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package command
import (
"context"
"github.com/xtls/xray-core/app/commander"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/protocol"
@ -181,6 +182,10 @@ func (s *handlerServer) ListOutbounds(ctx context.Context, request *ListOutbound
handlers := s.ohm.ListHandlers(ctx)
response := &ListOutboundsResponse{}
for _, handler := range handlers {
// Ignore gRPC outbound
if _, ok := handler.(*commander.Outbound); ok {
continue
}
response.Outbounds = append(response.Outbounds, &core.OutboundHandlerConfig{
Tag: handler.Tag(),
SenderSettings: handler.SenderSettings(),