diff --git a/app/commander/outbound.go b/app/commander/outbound.go index 001423ff..7f520d74 100644 --- a/app/commander/outbound.go +++ b/app/commander/outbound.go @@ -8,6 +8,7 @@ import ( "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/signal/done" "github.com/xtls/xray-core/transport" ) @@ -108,3 +109,13 @@ func (co *Outbound) Close() error { co.closed = true return co.listener.Close() } + +// SenderSettings implements outbound.Handler. +func (co *Outbound) SenderSettings() *serial.TypedMessage { + return nil +} + +// ProxySettings implements outbound.Handler. +func (co *Outbound) ProxySettings() *serial.TypedMessage { + return nil +} diff --git a/app/metrics/outbound.go b/app/metrics/outbound.go index 40f19383..e55b33fb 100644 --- a/app/metrics/outbound.go +++ b/app/metrics/outbound.go @@ -8,6 +8,7 @@ import ( "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/signal/done" "github.com/xtls/xray-core/transport" ) @@ -108,3 +109,13 @@ func (co *Outbound) Close() error { co.closed = true return co.listener.Close() } + +// SenderSettings implements outbound.Handler. +func (co *Outbound) SenderSettings() *serial.TypedMessage { + return nil +} + +// ProxySettings implements outbound.Handler. +func (co *Outbound) ProxySettings() *serial.TypedMessage { + return nil +} diff --git a/app/proxyman/command/command.go b/app/proxyman/command/command.go index ef710521..227a95c3 100644 --- a/app/proxyman/command/command.go +++ b/app/proxyman/command/command.go @@ -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" @@ -99,6 +100,19 @@ func (s *handlerServer) AlterInbound(ctx context.Context, request *AlterInboundR return &AlterInboundResponse{}, operation.ApplyInbound(ctx, handler) } +func (s *handlerServer) ListInbounds(ctx context.Context, request *ListInboundsRequest) (*ListInboundsResponse, error) { + handlers := s.ihm.ListHandlers(ctx) + response := &ListInboundsResponse{} + for _, handler := range handlers { + response.Inbounds = append(response.Inbounds, &core.InboundHandlerConfig{ + Tag: handler.Tag(), + ReceiverSettings: handler.ReceiverSettings(), + ProxySettings: handler.ProxySettings(), + }) + } + return response, nil +} + func (s *handlerServer) GetInboundUsers(ctx context.Context, request *GetInboundUserRequest) (*GetInboundUserResponse, error) { handler, err := s.ihm.GetHandler(ctx, request.Tag) if err != nil { @@ -164,6 +178,23 @@ func (s *handlerServer) AlterOutbound(ctx context.Context, request *AlterOutboun return &AlterOutboundResponse{}, operation.ApplyOutbound(ctx, handler) } +func (s *handlerServer) ListOutbounds(ctx context.Context, request *ListOutboundsRequest) (*ListOutboundsResponse, error) { + 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(), + ProxySettings: handler.ProxySettings(), + }) + } + return response, nil +} + func (s *handlerServer) mustEmbedUnimplementedHandlerServiceServer() {} type service struct { diff --git a/app/proxyman/command/command.pb.go b/app/proxyman/command/command.pb.go index a98da103..f4219d91 100644 --- a/app/proxyman/command/command.pb.go +++ b/app/proxyman/command/command.pb.go @@ -364,6 +364,87 @@ func (*AlterInboundResponse) Descriptor() ([]byte, []int) { return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{7} } +type ListInboundsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListInboundsRequest) Reset() { + *x = ListInboundsRequest{} + mi := &file_app_proxyman_command_command_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListInboundsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListInboundsRequest) ProtoMessage() {} + +func (x *ListInboundsRequest) ProtoReflect() protoreflect.Message { + mi := &file_app_proxyman_command_command_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListInboundsRequest.ProtoReflect.Descriptor instead. +func (*ListInboundsRequest) Descriptor() ([]byte, []int) { + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{8} +} + +type ListInboundsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Inbounds []*core.InboundHandlerConfig `protobuf:"bytes,1,rep,name=inbounds,proto3" json:"inbounds,omitempty"` +} + +func (x *ListInboundsResponse) Reset() { + *x = ListInboundsResponse{} + mi := &file_app_proxyman_command_command_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListInboundsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListInboundsResponse) ProtoMessage() {} + +func (x *ListInboundsResponse) ProtoReflect() protoreflect.Message { + mi := &file_app_proxyman_command_command_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListInboundsResponse.ProtoReflect.Descriptor instead. +func (*ListInboundsResponse) Descriptor() ([]byte, []int) { + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{9} +} + +func (x *ListInboundsResponse) GetInbounds() []*core.InboundHandlerConfig { + if x != nil { + return x.Inbounds + } + return nil +} + type GetInboundUserRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -375,7 +456,7 @@ type GetInboundUserRequest struct { func (x *GetInboundUserRequest) Reset() { *x = GetInboundUserRequest{} - mi := &file_app_proxyman_command_command_proto_msgTypes[8] + mi := &file_app_proxyman_command_command_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -387,7 +468,7 @@ func (x *GetInboundUserRequest) String() string { func (*GetInboundUserRequest) ProtoMessage() {} func (x *GetInboundUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[8] + mi := &file_app_proxyman_command_command_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -400,7 +481,7 @@ func (x *GetInboundUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetInboundUserRequest.ProtoReflect.Descriptor instead. func (*GetInboundUserRequest) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{8} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{10} } func (x *GetInboundUserRequest) GetTag() string { @@ -427,7 +508,7 @@ type GetInboundUserResponse struct { func (x *GetInboundUserResponse) Reset() { *x = GetInboundUserResponse{} - mi := &file_app_proxyman_command_command_proto_msgTypes[9] + mi := &file_app_proxyman_command_command_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -439,7 +520,7 @@ func (x *GetInboundUserResponse) String() string { func (*GetInboundUserResponse) ProtoMessage() {} func (x *GetInboundUserResponse) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[9] + mi := &file_app_proxyman_command_command_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -452,7 +533,7 @@ func (x *GetInboundUserResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetInboundUserResponse.ProtoReflect.Descriptor instead. func (*GetInboundUserResponse) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{9} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{11} } func (x *GetInboundUserResponse) GetUsers() []*protocol.User { @@ -472,7 +553,7 @@ type GetInboundUsersCountResponse struct { func (x *GetInboundUsersCountResponse) Reset() { *x = GetInboundUsersCountResponse{} - mi := &file_app_proxyman_command_command_proto_msgTypes[10] + mi := &file_app_proxyman_command_command_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -484,7 +565,7 @@ func (x *GetInboundUsersCountResponse) String() string { func (*GetInboundUsersCountResponse) ProtoMessage() {} func (x *GetInboundUsersCountResponse) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[10] + mi := &file_app_proxyman_command_command_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -497,7 +578,7 @@ func (x *GetInboundUsersCountResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetInboundUsersCountResponse.ProtoReflect.Descriptor instead. func (*GetInboundUsersCountResponse) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{10} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{12} } func (x *GetInboundUsersCountResponse) GetCount() int64 { @@ -517,7 +598,7 @@ type AddOutboundRequest struct { func (x *AddOutboundRequest) Reset() { *x = AddOutboundRequest{} - mi := &file_app_proxyman_command_command_proto_msgTypes[11] + mi := &file_app_proxyman_command_command_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -529,7 +610,7 @@ func (x *AddOutboundRequest) String() string { func (*AddOutboundRequest) ProtoMessage() {} func (x *AddOutboundRequest) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[11] + mi := &file_app_proxyman_command_command_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -542,7 +623,7 @@ func (x *AddOutboundRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddOutboundRequest.ProtoReflect.Descriptor instead. func (*AddOutboundRequest) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{11} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{13} } func (x *AddOutboundRequest) GetOutbound() *core.OutboundHandlerConfig { @@ -560,7 +641,7 @@ type AddOutboundResponse struct { func (x *AddOutboundResponse) Reset() { *x = AddOutboundResponse{} - mi := &file_app_proxyman_command_command_proto_msgTypes[12] + mi := &file_app_proxyman_command_command_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -572,7 +653,7 @@ func (x *AddOutboundResponse) String() string { func (*AddOutboundResponse) ProtoMessage() {} func (x *AddOutboundResponse) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[12] + mi := &file_app_proxyman_command_command_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -585,7 +666,7 @@ func (x *AddOutboundResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AddOutboundResponse.ProtoReflect.Descriptor instead. func (*AddOutboundResponse) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{12} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{14} } type RemoveOutboundRequest struct { @@ -598,7 +679,7 @@ type RemoveOutboundRequest struct { func (x *RemoveOutboundRequest) Reset() { *x = RemoveOutboundRequest{} - mi := &file_app_proxyman_command_command_proto_msgTypes[13] + mi := &file_app_proxyman_command_command_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +691,7 @@ func (x *RemoveOutboundRequest) String() string { func (*RemoveOutboundRequest) ProtoMessage() {} func (x *RemoveOutboundRequest) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[13] + mi := &file_app_proxyman_command_command_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +704,7 @@ func (x *RemoveOutboundRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveOutboundRequest.ProtoReflect.Descriptor instead. func (*RemoveOutboundRequest) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{13} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{15} } func (x *RemoveOutboundRequest) GetTag() string { @@ -641,7 +722,7 @@ type RemoveOutboundResponse struct { func (x *RemoveOutboundResponse) Reset() { *x = RemoveOutboundResponse{} - mi := &file_app_proxyman_command_command_proto_msgTypes[14] + mi := &file_app_proxyman_command_command_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -653,7 +734,7 @@ func (x *RemoveOutboundResponse) String() string { func (*RemoveOutboundResponse) ProtoMessage() {} func (x *RemoveOutboundResponse) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[14] + mi := &file_app_proxyman_command_command_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -666,7 +747,7 @@ func (x *RemoveOutboundResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveOutboundResponse.ProtoReflect.Descriptor instead. func (*RemoveOutboundResponse) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{14} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{16} } type AlterOutboundRequest struct { @@ -680,7 +761,7 @@ type AlterOutboundRequest struct { func (x *AlterOutboundRequest) Reset() { *x = AlterOutboundRequest{} - mi := &file_app_proxyman_command_command_proto_msgTypes[15] + mi := &file_app_proxyman_command_command_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -692,7 +773,7 @@ func (x *AlterOutboundRequest) String() string { func (*AlterOutboundRequest) ProtoMessage() {} func (x *AlterOutboundRequest) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[15] + mi := &file_app_proxyman_command_command_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -705,7 +786,7 @@ func (x *AlterOutboundRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AlterOutboundRequest.ProtoReflect.Descriptor instead. func (*AlterOutboundRequest) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{15} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{17} } func (x *AlterOutboundRequest) GetTag() string { @@ -730,7 +811,7 @@ type AlterOutboundResponse struct { func (x *AlterOutboundResponse) Reset() { *x = AlterOutboundResponse{} - mi := &file_app_proxyman_command_command_proto_msgTypes[16] + mi := &file_app_proxyman_command_command_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -742,7 +823,7 @@ func (x *AlterOutboundResponse) String() string { func (*AlterOutboundResponse) ProtoMessage() {} func (x *AlterOutboundResponse) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[16] + mi := &file_app_proxyman_command_command_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -755,7 +836,88 @@ func (x *AlterOutboundResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AlterOutboundResponse.ProtoReflect.Descriptor instead. func (*AlterOutboundResponse) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{16} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{18} +} + +type ListOutboundsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListOutboundsRequest) Reset() { + *x = ListOutboundsRequest{} + mi := &file_app_proxyman_command_command_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListOutboundsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOutboundsRequest) ProtoMessage() {} + +func (x *ListOutboundsRequest) ProtoReflect() protoreflect.Message { + mi := &file_app_proxyman_command_command_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOutboundsRequest.ProtoReflect.Descriptor instead. +func (*ListOutboundsRequest) Descriptor() ([]byte, []int) { + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{19} +} + +type ListOutboundsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Outbounds []*core.OutboundHandlerConfig `protobuf:"bytes,1,rep,name=outbounds,proto3" json:"outbounds,omitempty"` +} + +func (x *ListOutboundsResponse) Reset() { + *x = ListOutboundsResponse{} + mi := &file_app_proxyman_command_command_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListOutboundsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOutboundsResponse) ProtoMessage() {} + +func (x *ListOutboundsResponse) ProtoReflect() protoreflect.Message { + mi := &file_app_proxyman_command_command_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOutboundsResponse.ProtoReflect.Descriptor instead. +func (*ListOutboundsResponse) Descriptor() ([]byte, []int) { + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{20} +} + +func (x *ListOutboundsResponse) GetOutbounds() []*core.OutboundHandlerConfig { + if x != nil { + return x.Outbounds + } + return nil } type Config struct { @@ -766,7 +928,7 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - mi := &file_app_proxyman_command_command_proto_msgTypes[17] + mi := &file_app_proxyman_command_command_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -778,7 +940,7 @@ func (x *Config) String() string { func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_app_proxyman_command_command_proto_msgTypes[17] + mi := &file_app_proxyman_command_command_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -791,7 +953,7 @@ func (x *Config) ProtoReflect() protoreflect.Message { // Deprecated: Use Config.ProtoReflect.Descriptor instead. func (*Config) Descriptor() ([]byte, []int) { - return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{17} + return file_app_proxyman_command_command_proto_rawDescGZIP(), []int{21} } var File_app_proxyman_command_command_proto protoreflect.FileDescriptor @@ -831,61 +993,82 @@ var file_app_proxyman_command_command_proto_rawDesc = []byte{ 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, - 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x15, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x4a, 0x0a, - 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x34, 0x0a, 0x1c, 0x47, 0x65, 0x74, - 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x52, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, - 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, - 0x75, 0x6e, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x0a, 0x15, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x0a, 0x13, + 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x53, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, + 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x69, + 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, + 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, + 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, + 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x34, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x12, 0x41, + 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x22, + 0x15, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, + 0x67, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x14, 0x41, + 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, - 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x68, 0x0a, 0x14, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, - 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, - 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x17, 0x0a, 0x15, 0x41, 0x6c, 0x74, - 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x32, 0xc5, 0x07, 0x0a, - 0x0e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x6b, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2c, 0x2e, - 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, - 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, - 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x78, 0x72, + 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, + 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x17, 0x0a, 0x15, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, + 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, + 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x57, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, + 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3e, 0x0a, 0x09, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, + 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x09, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, + 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x32, 0xae, 0x09, 0x0a, 0x0e, 0x48, 0x61, + 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0a, + 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2c, 0x2e, 0x78, 0x72, 0x61, + 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, + 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x0d, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2f, 0x2e, 0x78, 0x72, 0x61, + 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x0d, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2f, 0x2e, - 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, - 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, - 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, - 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x71, 0x0a, 0x0c, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x12, 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, - 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x71, 0x0a, 0x0c, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, + 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65, + 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65, + 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x71, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x73, 0x12, 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, - 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, @@ -924,14 +1107,22 @@ var file_app_proxyman_command_command_proto_rawDesc = []byte{ 0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x42, 0x6d, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, - 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x19, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, - 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x12, 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x6d, 0x0a, 0x1d, 0x63, 0x6f, + 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2e, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, + 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, + 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x19, + 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, + 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -946,7 +1137,7 @@ func file_app_proxyman_command_command_proto_rawDescGZIP() []byte { return file_app_proxyman_command_command_proto_rawDescData } -var file_app_proxyman_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_app_proxyman_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_app_proxyman_command_command_proto_goTypes = []any{ (*AddUserOperation)(nil), // 0: xray.app.proxyman.command.AddUserOperation (*RemoveUserOperation)(nil), // 1: xray.app.proxyman.command.RemoveUserOperation @@ -956,49 +1147,59 @@ var file_app_proxyman_command_command_proto_goTypes = []any{ (*RemoveInboundResponse)(nil), // 5: xray.app.proxyman.command.RemoveInboundResponse (*AlterInboundRequest)(nil), // 6: xray.app.proxyman.command.AlterInboundRequest (*AlterInboundResponse)(nil), // 7: xray.app.proxyman.command.AlterInboundResponse - (*GetInboundUserRequest)(nil), // 8: xray.app.proxyman.command.GetInboundUserRequest - (*GetInboundUserResponse)(nil), // 9: xray.app.proxyman.command.GetInboundUserResponse - (*GetInboundUsersCountResponse)(nil), // 10: xray.app.proxyman.command.GetInboundUsersCountResponse - (*AddOutboundRequest)(nil), // 11: xray.app.proxyman.command.AddOutboundRequest - (*AddOutboundResponse)(nil), // 12: xray.app.proxyman.command.AddOutboundResponse - (*RemoveOutboundRequest)(nil), // 13: xray.app.proxyman.command.RemoveOutboundRequest - (*RemoveOutboundResponse)(nil), // 14: xray.app.proxyman.command.RemoveOutboundResponse - (*AlterOutboundRequest)(nil), // 15: xray.app.proxyman.command.AlterOutboundRequest - (*AlterOutboundResponse)(nil), // 16: xray.app.proxyman.command.AlterOutboundResponse - (*Config)(nil), // 17: xray.app.proxyman.command.Config - (*protocol.User)(nil), // 18: xray.common.protocol.User - (*core.InboundHandlerConfig)(nil), // 19: xray.core.InboundHandlerConfig - (*serial.TypedMessage)(nil), // 20: xray.common.serial.TypedMessage - (*core.OutboundHandlerConfig)(nil), // 21: xray.core.OutboundHandlerConfig + (*ListInboundsRequest)(nil), // 8: xray.app.proxyman.command.ListInboundsRequest + (*ListInboundsResponse)(nil), // 9: xray.app.proxyman.command.ListInboundsResponse + (*GetInboundUserRequest)(nil), // 10: xray.app.proxyman.command.GetInboundUserRequest + (*GetInboundUserResponse)(nil), // 11: xray.app.proxyman.command.GetInboundUserResponse + (*GetInboundUsersCountResponse)(nil), // 12: xray.app.proxyman.command.GetInboundUsersCountResponse + (*AddOutboundRequest)(nil), // 13: xray.app.proxyman.command.AddOutboundRequest + (*AddOutboundResponse)(nil), // 14: xray.app.proxyman.command.AddOutboundResponse + (*RemoveOutboundRequest)(nil), // 15: xray.app.proxyman.command.RemoveOutboundRequest + (*RemoveOutboundResponse)(nil), // 16: xray.app.proxyman.command.RemoveOutboundResponse + (*AlterOutboundRequest)(nil), // 17: xray.app.proxyman.command.AlterOutboundRequest + (*AlterOutboundResponse)(nil), // 18: xray.app.proxyman.command.AlterOutboundResponse + (*ListOutboundsRequest)(nil), // 19: xray.app.proxyman.command.ListOutboundsRequest + (*ListOutboundsResponse)(nil), // 20: xray.app.proxyman.command.ListOutboundsResponse + (*Config)(nil), // 21: xray.app.proxyman.command.Config + (*protocol.User)(nil), // 22: xray.common.protocol.User + (*core.InboundHandlerConfig)(nil), // 23: xray.core.InboundHandlerConfig + (*serial.TypedMessage)(nil), // 24: xray.common.serial.TypedMessage + (*core.OutboundHandlerConfig)(nil), // 25: xray.core.OutboundHandlerConfig } var file_app_proxyman_command_command_proto_depIdxs = []int32{ - 18, // 0: xray.app.proxyman.command.AddUserOperation.user:type_name -> xray.common.protocol.User - 19, // 1: xray.app.proxyman.command.AddInboundRequest.inbound:type_name -> xray.core.InboundHandlerConfig - 20, // 2: xray.app.proxyman.command.AlterInboundRequest.operation:type_name -> xray.common.serial.TypedMessage - 18, // 3: xray.app.proxyman.command.GetInboundUserResponse.users:type_name -> xray.common.protocol.User - 21, // 4: xray.app.proxyman.command.AddOutboundRequest.outbound:type_name -> xray.core.OutboundHandlerConfig - 20, // 5: xray.app.proxyman.command.AlterOutboundRequest.operation:type_name -> xray.common.serial.TypedMessage - 2, // 6: xray.app.proxyman.command.HandlerService.AddInbound:input_type -> xray.app.proxyman.command.AddInboundRequest - 4, // 7: xray.app.proxyman.command.HandlerService.RemoveInbound:input_type -> xray.app.proxyman.command.RemoveInboundRequest - 6, // 8: xray.app.proxyman.command.HandlerService.AlterInbound:input_type -> xray.app.proxyman.command.AlterInboundRequest - 8, // 9: xray.app.proxyman.command.HandlerService.GetInboundUsers:input_type -> xray.app.proxyman.command.GetInboundUserRequest - 8, // 10: xray.app.proxyman.command.HandlerService.GetInboundUsersCount:input_type -> xray.app.proxyman.command.GetInboundUserRequest - 11, // 11: xray.app.proxyman.command.HandlerService.AddOutbound:input_type -> xray.app.proxyman.command.AddOutboundRequest - 13, // 12: xray.app.proxyman.command.HandlerService.RemoveOutbound:input_type -> xray.app.proxyman.command.RemoveOutboundRequest - 15, // 13: xray.app.proxyman.command.HandlerService.AlterOutbound:input_type -> xray.app.proxyman.command.AlterOutboundRequest - 3, // 14: xray.app.proxyman.command.HandlerService.AddInbound:output_type -> xray.app.proxyman.command.AddInboundResponse - 5, // 15: xray.app.proxyman.command.HandlerService.RemoveInbound:output_type -> xray.app.proxyman.command.RemoveInboundResponse - 7, // 16: xray.app.proxyman.command.HandlerService.AlterInbound:output_type -> xray.app.proxyman.command.AlterInboundResponse - 9, // 17: xray.app.proxyman.command.HandlerService.GetInboundUsers:output_type -> xray.app.proxyman.command.GetInboundUserResponse - 10, // 18: xray.app.proxyman.command.HandlerService.GetInboundUsersCount:output_type -> xray.app.proxyman.command.GetInboundUsersCountResponse - 12, // 19: xray.app.proxyman.command.HandlerService.AddOutbound:output_type -> xray.app.proxyman.command.AddOutboundResponse - 14, // 20: xray.app.proxyman.command.HandlerService.RemoveOutbound:output_type -> xray.app.proxyman.command.RemoveOutboundResponse - 16, // 21: xray.app.proxyman.command.HandlerService.AlterOutbound:output_type -> xray.app.proxyman.command.AlterOutboundResponse - 14, // [14:22] is the sub-list for method output_type - 6, // [6:14] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 22, // 0: xray.app.proxyman.command.AddUserOperation.user:type_name -> xray.common.protocol.User + 23, // 1: xray.app.proxyman.command.AddInboundRequest.inbound:type_name -> xray.core.InboundHandlerConfig + 24, // 2: xray.app.proxyman.command.AlterInboundRequest.operation:type_name -> xray.common.serial.TypedMessage + 23, // 3: xray.app.proxyman.command.ListInboundsResponse.inbounds:type_name -> xray.core.InboundHandlerConfig + 22, // 4: xray.app.proxyman.command.GetInboundUserResponse.users:type_name -> xray.common.protocol.User + 25, // 5: xray.app.proxyman.command.AddOutboundRequest.outbound:type_name -> xray.core.OutboundHandlerConfig + 24, // 6: xray.app.proxyman.command.AlterOutboundRequest.operation:type_name -> xray.common.serial.TypedMessage + 25, // 7: xray.app.proxyman.command.ListOutboundsResponse.outbounds:type_name -> xray.core.OutboundHandlerConfig + 2, // 8: xray.app.proxyman.command.HandlerService.AddInbound:input_type -> xray.app.proxyman.command.AddInboundRequest + 4, // 9: xray.app.proxyman.command.HandlerService.RemoveInbound:input_type -> xray.app.proxyman.command.RemoveInboundRequest + 6, // 10: xray.app.proxyman.command.HandlerService.AlterInbound:input_type -> xray.app.proxyman.command.AlterInboundRequest + 8, // 11: xray.app.proxyman.command.HandlerService.ListInbounds:input_type -> xray.app.proxyman.command.ListInboundsRequest + 10, // 12: xray.app.proxyman.command.HandlerService.GetInboundUsers:input_type -> xray.app.proxyman.command.GetInboundUserRequest + 10, // 13: xray.app.proxyman.command.HandlerService.GetInboundUsersCount:input_type -> xray.app.proxyman.command.GetInboundUserRequest + 13, // 14: xray.app.proxyman.command.HandlerService.AddOutbound:input_type -> xray.app.proxyman.command.AddOutboundRequest + 15, // 15: xray.app.proxyman.command.HandlerService.RemoveOutbound:input_type -> xray.app.proxyman.command.RemoveOutboundRequest + 17, // 16: xray.app.proxyman.command.HandlerService.AlterOutbound:input_type -> xray.app.proxyman.command.AlterOutboundRequest + 19, // 17: xray.app.proxyman.command.HandlerService.ListOutbounds:input_type -> xray.app.proxyman.command.ListOutboundsRequest + 3, // 18: xray.app.proxyman.command.HandlerService.AddInbound:output_type -> xray.app.proxyman.command.AddInboundResponse + 5, // 19: xray.app.proxyman.command.HandlerService.RemoveInbound:output_type -> xray.app.proxyman.command.RemoveInboundResponse + 7, // 20: xray.app.proxyman.command.HandlerService.AlterInbound:output_type -> xray.app.proxyman.command.AlterInboundResponse + 9, // 21: xray.app.proxyman.command.HandlerService.ListInbounds:output_type -> xray.app.proxyman.command.ListInboundsResponse + 11, // 22: xray.app.proxyman.command.HandlerService.GetInboundUsers:output_type -> xray.app.proxyman.command.GetInboundUserResponse + 12, // 23: xray.app.proxyman.command.HandlerService.GetInboundUsersCount:output_type -> xray.app.proxyman.command.GetInboundUsersCountResponse + 14, // 24: xray.app.proxyman.command.HandlerService.AddOutbound:output_type -> xray.app.proxyman.command.AddOutboundResponse + 16, // 25: xray.app.proxyman.command.HandlerService.RemoveOutbound:output_type -> xray.app.proxyman.command.RemoveOutboundResponse + 18, // 26: xray.app.proxyman.command.HandlerService.AlterOutbound:output_type -> xray.app.proxyman.command.AlterOutboundResponse + 20, // 27: xray.app.proxyman.command.HandlerService.ListOutbounds:output_type -> xray.app.proxyman.command.ListOutboundsResponse + 18, // [18:28] is the sub-list for method output_type + 8, // [8:18] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_app_proxyman_command_command_proto_init() } @@ -1012,7 +1213,7 @@ func file_app_proxyman_command_command_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_app_proxyman_command_command_proto_rawDesc, NumEnums: 0, - NumMessages: 18, + NumMessages: 22, NumExtensions: 0, NumServices: 1, }, diff --git a/app/proxyman/command/command.proto b/app/proxyman/command/command.proto index 9a2d0142..4ff499eb 100644 --- a/app/proxyman/command/command.proto +++ b/app/proxyman/command/command.proto @@ -37,6 +37,12 @@ message AlterInboundRequest { message AlterInboundResponse {} +message ListInboundsRequest {} + +message ListInboundsResponse { + repeated core.InboundHandlerConfig inbounds = 1; +} + message GetInboundUserRequest { string tag = 1; string email = 2; @@ -69,6 +75,12 @@ message AlterOutboundRequest { message AlterOutboundResponse {} +message ListOutboundsRequest {} + +message ListOutboundsResponse { + repeated core.OutboundHandlerConfig outbounds = 1; +} + service HandlerService { rpc AddInbound(AddInboundRequest) returns (AddInboundResponse) {} @@ -76,6 +88,8 @@ service HandlerService { rpc AlterInbound(AlterInboundRequest) returns (AlterInboundResponse) {} + rpc ListInbounds(ListInboundsRequest) returns (ListInboundsResponse) {} + rpc GetInboundUsers(GetInboundUserRequest) returns (GetInboundUserResponse) {} rpc GetInboundUsersCount(GetInboundUserRequest) returns (GetInboundUsersCountResponse) {} @@ -85,6 +99,8 @@ service HandlerService { rpc RemoveOutbound(RemoveOutboundRequest) returns (RemoveOutboundResponse) {} rpc AlterOutbound(AlterOutboundRequest) returns (AlterOutboundResponse) {} + + rpc ListOutbounds(ListOutboundsRequest) returns (ListOutboundsResponse) {} } message Config {} diff --git a/app/proxyman/command/command_grpc.pb.go b/app/proxyman/command/command_grpc.pb.go index 7abbae8e..8bc48f0a 100644 --- a/app/proxyman/command/command_grpc.pb.go +++ b/app/proxyman/command/command_grpc.pb.go @@ -22,11 +22,13 @@ const ( HandlerService_AddInbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AddInbound" HandlerService_RemoveInbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/RemoveInbound" HandlerService_AlterInbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AlterInbound" + HandlerService_ListInbounds_FullMethodName = "/xray.app.proxyman.command.HandlerService/ListInbounds" HandlerService_GetInboundUsers_FullMethodName = "/xray.app.proxyman.command.HandlerService/GetInboundUsers" HandlerService_GetInboundUsersCount_FullMethodName = "/xray.app.proxyman.command.HandlerService/GetInboundUsersCount" HandlerService_AddOutbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AddOutbound" HandlerService_RemoveOutbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/RemoveOutbound" HandlerService_AlterOutbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AlterOutbound" + HandlerService_ListOutbounds_FullMethodName = "/xray.app.proxyman.command.HandlerService/ListOutbounds" ) // HandlerServiceClient is the client API for HandlerService service. @@ -36,11 +38,13 @@ type HandlerServiceClient interface { AddInbound(ctx context.Context, in *AddInboundRequest, opts ...grpc.CallOption) (*AddInboundResponse, error) RemoveInbound(ctx context.Context, in *RemoveInboundRequest, opts ...grpc.CallOption) (*RemoveInboundResponse, error) AlterInbound(ctx context.Context, in *AlterInboundRequest, opts ...grpc.CallOption) (*AlterInboundResponse, error) + ListInbounds(ctx context.Context, in *ListInboundsRequest, opts ...grpc.CallOption) (*ListInboundsResponse, error) GetInboundUsers(ctx context.Context, in *GetInboundUserRequest, opts ...grpc.CallOption) (*GetInboundUserResponse, error) GetInboundUsersCount(ctx context.Context, in *GetInboundUserRequest, opts ...grpc.CallOption) (*GetInboundUsersCountResponse, error) AddOutbound(ctx context.Context, in *AddOutboundRequest, opts ...grpc.CallOption) (*AddOutboundResponse, error) RemoveOutbound(ctx context.Context, in *RemoveOutboundRequest, opts ...grpc.CallOption) (*RemoveOutboundResponse, error) AlterOutbound(ctx context.Context, in *AlterOutboundRequest, opts ...grpc.CallOption) (*AlterOutboundResponse, error) + ListOutbounds(ctx context.Context, in *ListOutboundsRequest, opts ...grpc.CallOption) (*ListOutboundsResponse, error) } type handlerServiceClient struct { @@ -81,6 +85,16 @@ func (c *handlerServiceClient) AlterInbound(ctx context.Context, in *AlterInboun return out, nil } +func (c *handlerServiceClient) ListInbounds(ctx context.Context, in *ListInboundsRequest, opts ...grpc.CallOption) (*ListInboundsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListInboundsResponse) + err := c.cc.Invoke(ctx, HandlerService_ListInbounds_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *handlerServiceClient) GetInboundUsers(ctx context.Context, in *GetInboundUserRequest, opts ...grpc.CallOption) (*GetInboundUserResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetInboundUserResponse) @@ -131,6 +145,16 @@ func (c *handlerServiceClient) AlterOutbound(ctx context.Context, in *AlterOutbo return out, nil } +func (c *handlerServiceClient) ListOutbounds(ctx context.Context, in *ListOutboundsRequest, opts ...grpc.CallOption) (*ListOutboundsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListOutboundsResponse) + err := c.cc.Invoke(ctx, HandlerService_ListOutbounds_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // HandlerServiceServer is the server API for HandlerService service. // All implementations must embed UnimplementedHandlerServiceServer // for forward compatibility. @@ -138,11 +162,13 @@ type HandlerServiceServer interface { AddInbound(context.Context, *AddInboundRequest) (*AddInboundResponse, error) RemoveInbound(context.Context, *RemoveInboundRequest) (*RemoveInboundResponse, error) AlterInbound(context.Context, *AlterInboundRequest) (*AlterInboundResponse, error) + ListInbounds(context.Context, *ListInboundsRequest) (*ListInboundsResponse, error) GetInboundUsers(context.Context, *GetInboundUserRequest) (*GetInboundUserResponse, error) GetInboundUsersCount(context.Context, *GetInboundUserRequest) (*GetInboundUsersCountResponse, error) AddOutbound(context.Context, *AddOutboundRequest) (*AddOutboundResponse, error) RemoveOutbound(context.Context, *RemoveOutboundRequest) (*RemoveOutboundResponse, error) AlterOutbound(context.Context, *AlterOutboundRequest) (*AlterOutboundResponse, error) + ListOutbounds(context.Context, *ListOutboundsRequest) (*ListOutboundsResponse, error) mustEmbedUnimplementedHandlerServiceServer() } @@ -162,6 +188,9 @@ func (UnimplementedHandlerServiceServer) RemoveInbound(context.Context, *RemoveI func (UnimplementedHandlerServiceServer) AlterInbound(context.Context, *AlterInboundRequest) (*AlterInboundResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AlterInbound not implemented") } +func (UnimplementedHandlerServiceServer) ListInbounds(context.Context, *ListInboundsRequest) (*ListInboundsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListInbounds not implemented") +} func (UnimplementedHandlerServiceServer) GetInboundUsers(context.Context, *GetInboundUserRequest) (*GetInboundUserResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetInboundUsers not implemented") } @@ -177,6 +206,9 @@ func (UnimplementedHandlerServiceServer) RemoveOutbound(context.Context, *Remove func (UnimplementedHandlerServiceServer) AlterOutbound(context.Context, *AlterOutboundRequest) (*AlterOutboundResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AlterOutbound not implemented") } +func (UnimplementedHandlerServiceServer) ListOutbounds(context.Context, *ListOutboundsRequest) (*ListOutboundsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOutbounds not implemented") +} func (UnimplementedHandlerServiceServer) mustEmbedUnimplementedHandlerServiceServer() {} func (UnimplementedHandlerServiceServer) testEmbeddedByValue() {} @@ -252,6 +284,24 @@ func _HandlerService_AlterInbound_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _HandlerService_ListInbounds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListInboundsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HandlerServiceServer).ListInbounds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: HandlerService_ListInbounds_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HandlerServiceServer).ListInbounds(ctx, req.(*ListInboundsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _HandlerService_GetInboundUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetInboundUserRequest) if err := dec(in); err != nil { @@ -342,6 +392,24 @@ func _HandlerService_AlterOutbound_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _HandlerService_ListOutbounds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOutboundsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HandlerServiceServer).ListOutbounds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: HandlerService_ListOutbounds_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HandlerServiceServer).ListOutbounds(ctx, req.(*ListOutboundsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // HandlerService_ServiceDesc is the grpc.ServiceDesc for HandlerService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -361,6 +429,10 @@ var HandlerService_ServiceDesc = grpc.ServiceDesc{ MethodName: "AlterInbound", Handler: _HandlerService_AlterInbound_Handler, }, + { + MethodName: "ListInbounds", + Handler: _HandlerService_ListInbounds_Handler, + }, { MethodName: "GetInboundUsers", Handler: _HandlerService_GetInboundUsers_Handler, @@ -381,6 +453,10 @@ var HandlerService_ServiceDesc = grpc.ServiceDesc{ MethodName: "AlterOutbound", Handler: _HandlerService_AlterOutbound_Handler, }, + { + MethodName: "ListOutbounds", + Handler: _HandlerService_ListOutbounds_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "app/proxyman/command/command.proto", diff --git a/app/proxyman/inbound/always.go b/app/proxyman/inbound/always.go index ff585c87..f6a769fb 100644 --- a/app/proxyman/inbound/always.go +++ b/app/proxyman/inbound/always.go @@ -9,11 +9,13 @@ import ( "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/net" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/proxy" "github.com/xtls/xray-core/transport/internet" + "google.golang.org/protobuf/proto" ) func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) { @@ -42,10 +44,12 @@ func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) } type AlwaysOnInboundHandler struct { - proxy proxy.Inbound - workers []worker - mux *mux.Server - tag string + proxyConfig interface{} + receiverConfig *proxyman.ReceiverConfig + proxy proxy.Inbound + workers []worker + mux *mux.Server + tag string } func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *proxyman.ReceiverConfig, proxyConfig interface{}) (*AlwaysOnInboundHandler, error) { @@ -59,9 +63,11 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig * } h := &AlwaysOnInboundHandler{ - proxy: p, - mux: mux.NewServer(ctx), - tag: tag, + receiverConfig: receiverConfig, + proxyConfig: proxyConfig, + proxy: p, + mux: mux.NewServer(ctx), + tag: tag, } uplinkCounter, downlinkCounter := getStatCounter(core.MustFromContext(ctx), tag) @@ -187,3 +193,16 @@ func (h *AlwaysOnInboundHandler) Tag() string { func (h *AlwaysOnInboundHandler) GetInbound() proxy.Inbound { return h.proxy } + +// ReceiverSettings implements inbound.Handler. +func (h *AlwaysOnInboundHandler) ReceiverSettings() *serial.TypedMessage { + return serial.ToTypedMessage(h.receiverConfig) +} + +// ProxySettings implements inbound.Handler. +func (h *AlwaysOnInboundHandler) ProxySettings() *serial.TypedMessage { + if v, ok := h.proxyConfig.(proto.Message); ok { + return serial.ToTypedMessage(v) + } + return nil +} diff --git a/app/proxyman/inbound/dynamic.go b/app/proxyman/inbound/dynamic.go index 9bf49717..f14a9952 100644 --- a/app/proxyman/inbound/dynamic.go +++ b/app/proxyman/inbound/dynamic.go @@ -10,10 +10,12 @@ import ( "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/net" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/proxy" "github.com/xtls/xray-core/transport/internet" + "google.golang.org/protobuf/proto" ) type DynamicInboundHandler struct { @@ -205,3 +207,16 @@ func (h *DynamicInboundHandler) GetRandomInboundProxy() (interface{}, net.Port, func (h *DynamicInboundHandler) Tag() string { return h.tag } + +// ReceiverSettings implements inbound.Handler. +func (h *DynamicInboundHandler) ReceiverSettings() *serial.TypedMessage { + return serial.ToTypedMessage(h.receiverConfig) +} + +// ProxySettings implements inbound.Handler. +func (h *DynamicInboundHandler) ProxySettings() *serial.TypedMessage { + if v, ok := h.proxyConfig.(proto.Message); ok { + return serial.ToTypedMessage(v) + } + return nil +} diff --git a/app/proxyman/inbound/inbound.go b/app/proxyman/inbound/inbound.go index 2148f423..5d64c5b2 100644 --- a/app/proxyman/inbound/inbound.go +++ b/app/proxyman/inbound/inbound.go @@ -89,6 +89,21 @@ func (m *Manager) RemoveHandler(ctx context.Context, tag string) error { return common.ErrNoClue } +// ListHandlers implements inbound.Manager. +func (m *Manager) ListHandlers(ctx context.Context) []inbound.Handler { + m.access.RLock() + defer m.access.RUnlock() + + var response []inbound.Handler + copy(m.untaggedHandler, response) + + for _, v := range m.taggedHandlers { + response = append(response, v) + } + + return response +} + // Start implements common.Runnable. func (m *Manager) Start() error { m.access.Lock() diff --git a/app/proxyman/outbound/handler.go b/app/proxyman/outbound/handler.go index 9a91480f..45821b0c 100644 --- a/app/proxyman/outbound/handler.go +++ b/app/proxyman/outbound/handler.go @@ -16,6 +16,7 @@ import ( "github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/outbound" @@ -27,6 +28,7 @@ import ( "github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/pipe" + "google.golang.org/protobuf/proto" ) func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) { @@ -59,6 +61,7 @@ type Handler struct { tag string senderSettings *proxyman.SenderConfig streamSettings *internet.MemoryStreamConfig + proxyConfig proto.Message proxy proxy.Outbound outboundManager outbound.Manager mux *mux.ClientManager @@ -101,6 +104,7 @@ func NewHandler(ctx context.Context, config *core.OutboundHandlerConfig) (outbou if err != nil { return nil, err } + h.proxyConfig = proxyConfig rawProxyHandler, err := common.CreateObject(ctx, proxyConfig) if err != nil { @@ -349,6 +353,16 @@ func (h *Handler) Close() error { return nil } +// SenderSettings implements outbound.Handler. +func (h *Handler) SenderSettings() *serial.TypedMessage { + return serial.ToTypedMessage(h.senderSettings) +} + +// ProxySettings implements outbound.Handler. +func (h *Handler) ProxySettings() *serial.TypedMessage { + return serial.ToTypedMessage(h.proxyConfig) +} + func ParseRandomIP(addr net.Address, prefix string) net.Address { _, ipnet, _ := gonet.ParseCIDR(addr.IP().String() + "/" + prefix) diff --git a/app/proxyman/outbound/outbound.go b/app/proxyman/outbound/outbound.go index 8660e6a5..ed47b778 100644 --- a/app/proxyman/outbound/outbound.go +++ b/app/proxyman/outbound/outbound.go @@ -145,6 +145,21 @@ func (m *Manager) RemoveHandler(ctx context.Context, tag string) error { return nil } +// ListHandlers implements outbound.Manager. +func (m *Manager) ListHandlers(ctx context.Context) []outbound.Handler { + m.access.RLock() + defer m.access.RUnlock() + + var response []outbound.Handler + copy(m.untaggedHandlers, response) + + for _, v := range m.taggedHandler { + response = append(response, v) + } + + return response +} + // Select implements outbound.HandlerSelector. func (m *Manager) Select(selectors []string) []string { diff --git a/app/reverse/portal.go b/app/reverse/portal.go index d57ac29a..818c5718 100644 --- a/app/reverse/portal.go +++ b/app/reverse/portal.go @@ -10,6 +10,7 @@ import ( "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/net" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/features/outbound" @@ -111,6 +112,16 @@ func (o *Outbound) Close() error { return nil } +// SenderSettings implements outbound.Handler. +func (o *Outbound) SenderSettings() *serial.TypedMessage { + return nil +} + +// ProxySettings implements outbound.Handler. +func (o *Outbound) ProxySettings() *serial.TypedMessage { + return nil +} + type StaticMuxPicker struct { access sync.Mutex workers []*PortalWorker diff --git a/features/inbound/inbound.go b/features/inbound/inbound.go index adcf7571..1d3ba7b1 100644 --- a/features/inbound/inbound.go +++ b/features/inbound/inbound.go @@ -5,6 +5,7 @@ import ( "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/features" ) @@ -15,6 +16,10 @@ type Handler interface { common.Runnable // The tag of this handler. Tag() string + // Returns the active receiver settings. + ReceiverSettings() *serial.TypedMessage + // Returns the active proxy settings. + ProxySettings() *serial.TypedMessage // Deprecated: Do not use in new code. GetRandomInboundProxy() (interface{}, net.Port, int) @@ -32,6 +37,9 @@ type Manager interface { // RemoveHandler removes a handler from Manager. RemoveHandler(ctx context.Context, tag string) error + + // ListHandlers returns a list of inbound.Handler. + ListHandlers(ctx context.Context) []Handler } // ManagerType returns the type of Manager interface. Can be used for implementing common.HasType. diff --git a/features/outbound/outbound.go b/features/outbound/outbound.go index ed875439..ecde6e1e 100644 --- a/features/outbound/outbound.go +++ b/features/outbound/outbound.go @@ -4,6 +4,7 @@ import ( "context" "github.com/xtls/xray-core/common" + "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/features" "github.com/xtls/xray-core/transport" ) @@ -15,6 +16,8 @@ type Handler interface { common.Runnable Tag() string Dispatch(ctx context.Context, link *transport.Link) + SenderSettings() *serial.TypedMessage + ProxySettings() *serial.TypedMessage } type HandlerSelector interface { @@ -35,6 +38,9 @@ type Manager interface { // RemoveHandler removes a handler from outbound.Manager. RemoveHandler(ctx context.Context, tag string) error + + // ListHandlers returns a list of outbound.Handler. + ListHandlers(ctx context.Context) []Handler } // ManagerType returns the type of Manager interface. Can be used to implement common.HasType. diff --git a/main/commands/all/api/api.go b/main/commands/all/api/api.go index 8188d071..14a7c564 100644 --- a/main/commands/all/api/api.go +++ b/main/commands/all/api/api.go @@ -21,6 +21,8 @@ var CmdAPI = &base.Command{ cmdAddOutbounds, cmdRemoveInbounds, cmdRemoveOutbounds, + cmdListInbounds, + cmdListOutbounds, cmdInboundUser, cmdInboundUserCount, cmdAddRules, diff --git a/main/commands/all/api/inbounds_list.go b/main/commands/all/api/inbounds_list.go new file mode 100644 index 00000000..e4267a6b --- /dev/null +++ b/main/commands/all/api/inbounds_list.go @@ -0,0 +1,44 @@ +package api + +import ( + handlerService "github.com/xtls/xray-core/app/proxyman/command" + "github.com/xtls/xray-core/main/commands/base" +) + +var cmdListInbounds = &base.Command{ + CustomFlags: true, + UsageLine: "{{.Exec}} api lsi [--server=127.0.0.1:8080]", + Short: "List inbounds", + Long: ` +List inbounds in Xray. + +Arguments: + + -s, -server + The API server address. Default 127.0.0.1:8080 + + -t, -timeout + Timeout in seconds for calling API. Default 3 + +Example: + + {{.Exec}} {{.LongName}} --server=127.0.0.1:8080 +`, + Run: executeListInbounds, +} + +func executeListInbounds(cmd *base.Command, args []string) { + setSharedFlags(cmd) + cmd.Flag.Parse(args) + + conn, ctx, close := dialAPIServer() + defer close() + + client := handlerService.NewHandlerServiceClient(conn) + + resp, err := client.ListInbounds(ctx, &handlerService.ListInboundsRequest{}) + if err != nil { + base.Fatalf("failed to list inbounds: %s", err) + } + showJSONResponse(resp) +} diff --git a/main/commands/all/api/outbounds_list.go b/main/commands/all/api/outbounds_list.go new file mode 100644 index 00000000..be7f077b --- /dev/null +++ b/main/commands/all/api/outbounds_list.go @@ -0,0 +1,43 @@ +package api + +import ( + handlerService "github.com/xtls/xray-core/app/proxyman/command" + "github.com/xtls/xray-core/main/commands/base" +) + +var cmdListOutbounds = &base.Command{ + CustomFlags: true, + UsageLine: "{{.Exec}} api lso [--server=127.0.0.1:8080]", + Short: "List outbounds", + Long: ` +List outbounds in Xray. + +Arguments: + + -s, -server + The API server address. Default 127.0.0.1:8080 + + -t, -timeout + Timeout in seconds for calling API. Default 3 + +Example: + + {{.Exec}} {{.LongName}} --server=127.0.0.1:8080 +`, + Run: executeListOutbounds, +} + +func executeListOutbounds(cmd *base.Command, args []string) { + setSharedFlags(cmd) + cmd.Flag.Parse(args) + + conn, ctx, close := dialAPIServer() + defer close() + + client := handlerService.NewHandlerServiceClient(conn) + resp, err := client.ListOutbounds(ctx, &handlerService.ListOutboundsRequest{}) + if err != nil { + base.Fatalf("failed to list outbounds: %s", err) + } + showJSONResponse(resp) +} diff --git a/testing/mocks/outbound.go b/testing/mocks/outbound.go index 4f1083cf..f6352bff 100644 --- a/testing/mocks/outbound.go +++ b/testing/mocks/outbound.go @@ -91,6 +91,20 @@ func (mr *OutboundManagerMockRecorder) GetHandler(arg0 interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHandler", reflect.TypeOf((*OutboundManager)(nil).GetHandler), arg0) } +// ListHandlers mocks base method +func (m *OutboundManager) ListHandlers(arg0 context.Context) []outbound.Handler { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListHandlers", arg0) + ret0, _ := ret[0].([]outbound.Handler) + return ret0 +} + +// ListHandlers indicates an expected call of ListHandlers +func (mr *OutboundManagerMockRecorder) ListHandlers(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListHandlers", reflect.TypeOf((*OutboundManager)(nil).ListHandlers), arg0) +} + // RemoveHandler mocks base method func (m *OutboundManager) RemoveHandler(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() diff --git a/testing/scenarios/command_test.go b/testing/scenarios/command_test.go index 037255a9..e562952b 100644 --- a/testing/scenarios/command_test.go +++ b/testing/scenarios/command_test.go @@ -31,6 +31,7 @@ import ( "github.com/xtls/xray-core/testing/servers/tcp" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/protobuf/testing/protocmp" ) func TestCommanderListenConfigurationItem(t *testing.T) { @@ -202,6 +203,104 @@ func TestCommanderRemoveHandler(t *testing.T) { } } +func TestCommanderListHandlers(t *testing.T) { + tcpServer := tcp.Server{ + MsgProcessor: xor, + } + dest, err := tcpServer.Start() + common.Must(err) + defer tcpServer.Close() + + clientPort := tcp.PickPort() + cmdPort := tcp.PickPort() + clientConfig := &core.Config{ + App: []*serial.TypedMessage{ + serial.ToTypedMessage(&commander.Config{ + Tag: "api", + Service: []*serial.TypedMessage{ + serial.ToTypedMessage(&command.Config{}), + }, + }), + serial.ToTypedMessage(&router.Config{ + Rule: []*router.RoutingRule{ + { + InboundTag: []string{"api"}, + TargetTag: &router.RoutingRule_Tag{ + Tag: "api", + }, + }, + }, + }), + }, + Inbound: []*core.InboundHandlerConfig{ + { + Tag: "d", + ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ + PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(clientPort)}}, + Listen: net.NewIPOrDomain(net.LocalHostIP), + }), + ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), + Networks: []net.Network{net.Network_TCP}, + }), + }, + { + Tag: "api", + ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ + PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(cmdPort)}}, + Listen: net.NewIPOrDomain(net.LocalHostIP), + }), + ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), + Networks: []net.Network{net.Network_TCP}, + }), + }, + }, + Outbound: []*core.OutboundHandlerConfig{ + { + Tag: "default-outbound", + SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{}), + ProxySettings: serial.ToTypedMessage(&freedom.Config{}), + }, + }, + } + + servers, err := InitializeServerConfigs(clientConfig) + common.Must(err) + defer CloseAllServers(servers) + + if err := testTCPConn(clientPort, 1024, time.Second*5)(); err != nil { + t.Fatal(err) + } + + cmdConn, err := grpc.Dial(fmt.Sprintf("127.0.0.1:%d", cmdPort), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + common.Must(err) + defer cmdConn.Close() + + hsClient := command.NewHandlerServiceClient(cmdConn) + inboundResp, err := hsClient.ListInbounds(context.Background(), &command.ListInboundsRequest{}) + common.Must(err) + if inboundResp == nil { + t.Error("unexpected nil response") + } + + if !cmp.Equal(inboundResp.Inbounds, clientConfig.Inbound, protocmp.Transform()) { + t.Fatal("inbound response doesn't match config") + } + + outboundResp, err := hsClient.ListOutbounds(context.Background(), &command.ListOutboundsRequest{}) + common.Must(err) + if outboundResp == nil { + t.Error("unexpected nil response") + } + + if !cmp.Equal(outboundResp.Outbounds, clientConfig.Outbound, protocmp.Transform()) { + t.Fatal("outbound response doesn't match config") + } +} + func TestCommanderAddRemoveUser(t *testing.T) { tcpServer := tcp.Server{ MsgProcessor: xor,