@@ -3,6 +3,7 @@ package command
33import (
44 "context"
55
6+ "github.com/xtls/xray-core/app/commander"
67 "github.com/xtls/xray-core/common"
78 "github.com/xtls/xray-core/common/errors"
89 "github.com/xtls/xray-core/common/protocol"
@@ -99,6 +100,19 @@ func (s *handlerServer) AlterInbound(ctx context.Context, request *AlterInboundR
99100 return & AlterInboundResponse {}, operation .ApplyInbound (ctx , handler )
100101}
101102
103+ func (s * handlerServer ) ListInbounds (ctx context.Context , request * ListInboundsRequest ) (* ListInboundsResponse , error ) {
104+ handlers := s .ihm .ListHandlers (ctx )
105+ response := & ListInboundsResponse {}
106+ for _ , handler := range handlers {
107+ response .Inbounds = append (response .Inbounds , & core.InboundHandlerConfig {
108+ Tag : handler .Tag (),
109+ ReceiverSettings : handler .ReceiverSettings (),
110+ ProxySettings : handler .ProxySettings (),
111+ })
112+ }
113+ return response , nil
114+ }
115+
102116func (s * handlerServer ) GetInboundUsers (ctx context.Context , request * GetInboundUserRequest ) (* GetInboundUserResponse , error ) {
103117 handler , err := s .ihm .GetHandler (ctx , request .Tag )
104118 if err != nil {
@@ -164,6 +178,23 @@ func (s *handlerServer) AlterOutbound(ctx context.Context, request *AlterOutboun
164178 return & AlterOutboundResponse {}, operation .ApplyOutbound (ctx , handler )
165179}
166180
181+ func (s * handlerServer ) ListOutbounds (ctx context.Context , request * ListOutboundsRequest ) (* ListOutboundsResponse , error ) {
182+ handlers := s .ohm .ListHandlers (ctx )
183+ response := & ListOutboundsResponse {}
184+ for _ , handler := range handlers {
185+ // Ignore gRPC outbound
186+ if _ , ok := handler .(* commander.Outbound ); ok {
187+ continue
188+ }
189+ response .Outbounds = append (response .Outbounds , & core.OutboundHandlerConfig {
190+ Tag : handler .Tag (),
191+ SenderSettings : handler .SenderSettings (),
192+ ProxySettings : handler .ProxySettings (),
193+ })
194+ }
195+ return response , nil
196+ }
197+
167198func (s * handlerServer ) mustEmbedUnimplementedHandlerServiceServer () {}
168199
169200type service struct {
0 commit comments