github.com/v2fly/v2ray-core/v4@v4.45.2/app/router/command/command_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  
     3  package command
     4  
     5  import (
     6  	context "context"
     7  	grpc "google.golang.org/grpc"
     8  	codes "google.golang.org/grpc/codes"
     9  	status "google.golang.org/grpc/status"
    10  )
    11  
    12  // This is a compile-time assertion to ensure that this generated file
    13  // is compatible with the grpc package it is being compiled against.
    14  // Requires gRPC-Go v1.32.0 or later.
    15  const _ = grpc.SupportPackageIsVersion7
    16  
    17  // RoutingServiceClient is the client API for RoutingService service.
    18  //
    19  // 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.
    20  type RoutingServiceClient interface {
    21  	SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error)
    22  	TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error)
    23  }
    24  
    25  type routingServiceClient struct {
    26  	cc grpc.ClientConnInterface
    27  }
    28  
    29  func NewRoutingServiceClient(cc grpc.ClientConnInterface) RoutingServiceClient {
    30  	return &routingServiceClient{cc}
    31  }
    32  
    33  func (c *routingServiceClient) SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error) {
    34  	stream, err := c.cc.NewStream(ctx, &RoutingService_ServiceDesc.Streams[0], "/v2ray.core.app.router.command.RoutingService/SubscribeRoutingStats", opts...)
    35  	if err != nil {
    36  		return nil, err
    37  	}
    38  	x := &routingServiceSubscribeRoutingStatsClient{stream}
    39  	if err := x.ClientStream.SendMsg(in); err != nil {
    40  		return nil, err
    41  	}
    42  	if err := x.ClientStream.CloseSend(); err != nil {
    43  		return nil, err
    44  	}
    45  	return x, nil
    46  }
    47  
    48  type RoutingService_SubscribeRoutingStatsClient interface {
    49  	Recv() (*RoutingContext, error)
    50  	grpc.ClientStream
    51  }
    52  
    53  type routingServiceSubscribeRoutingStatsClient struct {
    54  	grpc.ClientStream
    55  }
    56  
    57  func (x *routingServiceSubscribeRoutingStatsClient) Recv() (*RoutingContext, error) {
    58  	m := new(RoutingContext)
    59  	if err := x.ClientStream.RecvMsg(m); err != nil {
    60  		return nil, err
    61  	}
    62  	return m, nil
    63  }
    64  
    65  func (c *routingServiceClient) TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error) {
    66  	out := new(RoutingContext)
    67  	err := c.cc.Invoke(ctx, "/v2ray.core.app.router.command.RoutingService/TestRoute", in, out, opts...)
    68  	if err != nil {
    69  		return nil, err
    70  	}
    71  	return out, nil
    72  }
    73  
    74  // RoutingServiceServer is the server API for RoutingService service.
    75  // All implementations must embed UnimplementedRoutingServiceServer
    76  // for forward compatibility
    77  type RoutingServiceServer interface {
    78  	SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error
    79  	TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error)
    80  	mustEmbedUnimplementedRoutingServiceServer()
    81  }
    82  
    83  // UnimplementedRoutingServiceServer must be embedded to have forward compatible implementations.
    84  type UnimplementedRoutingServiceServer struct {
    85  }
    86  
    87  func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error {
    88  	return status.Errorf(codes.Unimplemented, "method SubscribeRoutingStats not implemented")
    89  }
    90  func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) {
    91  	return nil, status.Errorf(codes.Unimplemented, "method TestRoute not implemented")
    92  }
    93  func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {}
    94  
    95  // UnsafeRoutingServiceServer may be embedded to opt out of forward compatibility for this service.
    96  // Use of this interface is not recommended, as added methods to RoutingServiceServer will
    97  // result in compilation errors.
    98  type UnsafeRoutingServiceServer interface {
    99  	mustEmbedUnimplementedRoutingServiceServer()
   100  }
   101  
   102  func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) {
   103  	s.RegisterService(&RoutingService_ServiceDesc, srv)
   104  }
   105  
   106  func _RoutingService_SubscribeRoutingStats_Handler(srv interface{}, stream grpc.ServerStream) error {
   107  	m := new(SubscribeRoutingStatsRequest)
   108  	if err := stream.RecvMsg(m); err != nil {
   109  		return err
   110  	}
   111  	return srv.(RoutingServiceServer).SubscribeRoutingStats(m, &routingServiceSubscribeRoutingStatsServer{stream})
   112  }
   113  
   114  type RoutingService_SubscribeRoutingStatsServer interface {
   115  	Send(*RoutingContext) error
   116  	grpc.ServerStream
   117  }
   118  
   119  type routingServiceSubscribeRoutingStatsServer struct {
   120  	grpc.ServerStream
   121  }
   122  
   123  func (x *routingServiceSubscribeRoutingStatsServer) Send(m *RoutingContext) error {
   124  	return x.ServerStream.SendMsg(m)
   125  }
   126  
   127  func _RoutingService_TestRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   128  	in := new(TestRouteRequest)
   129  	if err := dec(in); err != nil {
   130  		return nil, err
   131  	}
   132  	if interceptor == nil {
   133  		return srv.(RoutingServiceServer).TestRoute(ctx, in)
   134  	}
   135  	info := &grpc.UnaryServerInfo{
   136  		Server:     srv,
   137  		FullMethod: "/v2ray.core.app.router.command.RoutingService/TestRoute",
   138  	}
   139  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   140  		return srv.(RoutingServiceServer).TestRoute(ctx, req.(*TestRouteRequest))
   141  	}
   142  	return interceptor(ctx, in, info, handler)
   143  }
   144  
   145  // RoutingService_ServiceDesc is the grpc.ServiceDesc for RoutingService service.
   146  // It's only intended for direct use with grpc.RegisterService,
   147  // and not to be introspected or modified (even as a copy)
   148  var RoutingService_ServiceDesc = grpc.ServiceDesc{
   149  	ServiceName: "v2ray.core.app.router.command.RoutingService",
   150  	HandlerType: (*RoutingServiceServer)(nil),
   151  	Methods: []grpc.MethodDesc{
   152  		{
   153  			MethodName: "TestRoute",
   154  			Handler:    _RoutingService_TestRoute_Handler,
   155  		},
   156  	},
   157  	Streams: []grpc.StreamDesc{
   158  		{
   159  			StreamName:    "SubscribeRoutingStats",
   160  			Handler:       _RoutingService_SubscribeRoutingStats_Handler,
   161  			ServerStreams: true,
   162  		},
   163  	},
   164  	Metadata: "app/router/command/command.proto",
   165  }