github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/app/router/command/command_grpc.pb.go (about)

     1  package command
     2  
     3  import (
     4  	context "context"
     5  	grpc "google.golang.org/grpc"
     6  	codes "google.golang.org/grpc/codes"
     7  	status "google.golang.org/grpc/status"
     8  )
     9  
    10  // This is a compile-time assertion to ensure that this generated file
    11  // is compatible with the grpc package it is being compiled against.
    12  // Requires gRPC-Go v1.32.0 or later.
    13  const _ = grpc.SupportPackageIsVersion7
    14  
    15  const (
    16  	RoutingService_SubscribeRoutingStats_FullMethodName  = "/v2ray.core.app.router.command.RoutingService/SubscribeRoutingStats"
    17  	RoutingService_TestRoute_FullMethodName              = "/v2ray.core.app.router.command.RoutingService/TestRoute"
    18  	RoutingService_GetBalancerInfo_FullMethodName        = "/v2ray.core.app.router.command.RoutingService/GetBalancerInfo"
    19  	RoutingService_OverrideBalancerTarget_FullMethodName = "/v2ray.core.app.router.command.RoutingService/OverrideBalancerTarget"
    20  )
    21  
    22  // RoutingServiceClient is the client API for RoutingService service.
    23  //
    24  // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
    25  type RoutingServiceClient interface {
    26  	SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error)
    27  	TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error)
    28  	GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error)
    29  	OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error)
    30  }
    31  
    32  type routingServiceClient struct {
    33  	cc grpc.ClientConnInterface
    34  }
    35  
    36  func NewRoutingServiceClient(cc grpc.ClientConnInterface) RoutingServiceClient {
    37  	return &routingServiceClient{cc}
    38  }
    39  
    40  func (c *routingServiceClient) SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error) {
    41  	stream, err := c.cc.NewStream(ctx, &RoutingService_ServiceDesc.Streams[0], RoutingService_SubscribeRoutingStats_FullMethodName, opts...)
    42  	if err != nil {
    43  		return nil, err
    44  	}
    45  	x := &routingServiceSubscribeRoutingStatsClient{stream}
    46  	if err := x.ClientStream.SendMsg(in); err != nil {
    47  		return nil, err
    48  	}
    49  	if err := x.ClientStream.CloseSend(); err != nil {
    50  		return nil, err
    51  	}
    52  	return x, nil
    53  }
    54  
    55  type RoutingService_SubscribeRoutingStatsClient interface {
    56  	Recv() (*RoutingContext, error)
    57  	grpc.ClientStream
    58  }
    59  
    60  type routingServiceSubscribeRoutingStatsClient struct {
    61  	grpc.ClientStream
    62  }
    63  
    64  func (x *routingServiceSubscribeRoutingStatsClient) Recv() (*RoutingContext, error) {
    65  	m := new(RoutingContext)
    66  	if err := x.ClientStream.RecvMsg(m); err != nil {
    67  		return nil, err
    68  	}
    69  	return m, nil
    70  }
    71  
    72  func (c *routingServiceClient) TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error) {
    73  	out := new(RoutingContext)
    74  	err := c.cc.Invoke(ctx, RoutingService_TestRoute_FullMethodName, in, out, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return out, nil
    79  }
    80  
    81  func (c *routingServiceClient) GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error) {
    82  	out := new(GetBalancerInfoResponse)
    83  	err := c.cc.Invoke(ctx, RoutingService_GetBalancerInfo_FullMethodName, in, out, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return out, nil
    88  }
    89  
    90  func (c *routingServiceClient) OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error) {
    91  	out := new(OverrideBalancerTargetResponse)
    92  	err := c.cc.Invoke(ctx, RoutingService_OverrideBalancerTarget_FullMethodName, in, out, opts...)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  	return out, nil
    97  }
    98  
    99  // RoutingServiceServer is the server API for RoutingService service.
   100  // All implementations must embed UnimplementedRoutingServiceServer
   101  // for forward compatibility
   102  type RoutingServiceServer interface {
   103  	SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error
   104  	TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error)
   105  	GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error)
   106  	OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error)
   107  	mustEmbedUnimplementedRoutingServiceServer()
   108  }
   109  
   110  // UnimplementedRoutingServiceServer must be embedded to have forward compatible implementations.
   111  type UnimplementedRoutingServiceServer struct {
   112  }
   113  
   114  func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error {
   115  	return status.Errorf(codes.Unimplemented, "method SubscribeRoutingStats not implemented")
   116  }
   117  func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) {
   118  	return nil, status.Errorf(codes.Unimplemented, "method TestRoute not implemented")
   119  }
   120  func (UnimplementedRoutingServiceServer) GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error) {
   121  	return nil, status.Errorf(codes.Unimplemented, "method GetBalancerInfo not implemented")
   122  }
   123  func (UnimplementedRoutingServiceServer) OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error) {
   124  	return nil, status.Errorf(codes.Unimplemented, "method OverrideBalancerTarget not implemented")
   125  }
   126  func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {}
   127  
   128  // UnsafeRoutingServiceServer may be embedded to opt out of forward compatibility for this service.
   129  // Use of this interface is not recommended, as added methods to RoutingServiceServer will
   130  // result in compilation errors.
   131  type UnsafeRoutingServiceServer interface {
   132  	mustEmbedUnimplementedRoutingServiceServer()
   133  }
   134  
   135  func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) {
   136  	s.RegisterService(&RoutingService_ServiceDesc, srv)
   137  }
   138  
   139  func _RoutingService_SubscribeRoutingStats_Handler(srv interface{}, stream grpc.ServerStream) error {
   140  	m := new(SubscribeRoutingStatsRequest)
   141  	if err := stream.RecvMsg(m); err != nil {
   142  		return err
   143  	}
   144  	return srv.(RoutingServiceServer).SubscribeRoutingStats(m, &routingServiceSubscribeRoutingStatsServer{stream})
   145  }
   146  
   147  type RoutingService_SubscribeRoutingStatsServer interface {
   148  	Send(*RoutingContext) error
   149  	grpc.ServerStream
   150  }
   151  
   152  type routingServiceSubscribeRoutingStatsServer struct {
   153  	grpc.ServerStream
   154  }
   155  
   156  func (x *routingServiceSubscribeRoutingStatsServer) Send(m *RoutingContext) error {
   157  	return x.ServerStream.SendMsg(m)
   158  }
   159  
   160  func _RoutingService_TestRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   161  	in := new(TestRouteRequest)
   162  	if err := dec(in); err != nil {
   163  		return nil, err
   164  	}
   165  	if interceptor == nil {
   166  		return srv.(RoutingServiceServer).TestRoute(ctx, in)
   167  	}
   168  	info := &grpc.UnaryServerInfo{
   169  		Server:     srv,
   170  		FullMethod: RoutingService_TestRoute_FullMethodName,
   171  	}
   172  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   173  		return srv.(RoutingServiceServer).TestRoute(ctx, req.(*TestRouteRequest))
   174  	}
   175  	return interceptor(ctx, in, info, handler)
   176  }
   177  
   178  func _RoutingService_GetBalancerInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   179  	in := new(GetBalancerInfoRequest)
   180  	if err := dec(in); err != nil {
   181  		return nil, err
   182  	}
   183  	if interceptor == nil {
   184  		return srv.(RoutingServiceServer).GetBalancerInfo(ctx, in)
   185  	}
   186  	info := &grpc.UnaryServerInfo{
   187  		Server:     srv,
   188  		FullMethod: RoutingService_GetBalancerInfo_FullMethodName,
   189  	}
   190  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   191  		return srv.(RoutingServiceServer).GetBalancerInfo(ctx, req.(*GetBalancerInfoRequest))
   192  	}
   193  	return interceptor(ctx, in, info, handler)
   194  }
   195  
   196  func _RoutingService_OverrideBalancerTarget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   197  	in := new(OverrideBalancerTargetRequest)
   198  	if err := dec(in); err != nil {
   199  		return nil, err
   200  	}
   201  	if interceptor == nil {
   202  		return srv.(RoutingServiceServer).OverrideBalancerTarget(ctx, in)
   203  	}
   204  	info := &grpc.UnaryServerInfo{
   205  		Server:     srv,
   206  		FullMethod: RoutingService_OverrideBalancerTarget_FullMethodName,
   207  	}
   208  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   209  		return srv.(RoutingServiceServer).OverrideBalancerTarget(ctx, req.(*OverrideBalancerTargetRequest))
   210  	}
   211  	return interceptor(ctx, in, info, handler)
   212  }
   213  
   214  // RoutingService_ServiceDesc is the grpc.ServiceDesc for RoutingService service.
   215  // It's only intended for direct use with grpc.RegisterService,
   216  // and not to be introspected or modified (even as a copy)
   217  var RoutingService_ServiceDesc = grpc.ServiceDesc{
   218  	ServiceName: "v2ray.core.app.router.command.RoutingService",
   219  	HandlerType: (*RoutingServiceServer)(nil),
   220  	Methods: []grpc.MethodDesc{
   221  		{
   222  			MethodName: "TestRoute",
   223  			Handler:    _RoutingService_TestRoute_Handler,
   224  		},
   225  		{
   226  			MethodName: "GetBalancerInfo",
   227  			Handler:    _RoutingService_GetBalancerInfo_Handler,
   228  		},
   229  		{
   230  			MethodName: "OverrideBalancerTarget",
   231  			Handler:    _RoutingService_OverrideBalancerTarget_Handler,
   232  		},
   233  	},
   234  	Streams: []grpc.StreamDesc{
   235  		{
   236  			StreamName:    "SubscribeRoutingStats",
   237  			Handler:       _RoutingService_SubscribeRoutingStats_Handler,
   238  			ServerStreams: true,
   239  		},
   240  	},
   241  	Metadata: "app/router/command/command.proto",
   242  }