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