stream_grpc.pb.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package v2raygrpc
  2. import (
  3. context "context"
  4. grpc "google.golang.org/grpc"
  5. codes "google.golang.org/grpc/codes"
  6. status "google.golang.org/grpc/status"
  7. )
  8. // This is a compile-time assertion to ensure that this generated file
  9. // is compatible with the grpc package it is being compiled against.
  10. // Requires gRPC-Go v1.64.0 or later.
  11. const _ = grpc.SupportPackageIsVersion9
  12. const (
  13. GunService_Tun_FullMethodName = "/transport.v2raygrpc.GunService/Tun"
  14. )
  15. // GunServiceClient is the client API for GunService service.
  16. //
  17. // 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.
  18. type GunServiceClient interface {
  19. Tun(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Hunk, Hunk], error)
  20. }
  21. type gunServiceClient struct {
  22. cc grpc.ClientConnInterface
  23. }
  24. func NewGunServiceClient(cc grpc.ClientConnInterface) GunServiceClient {
  25. return &gunServiceClient{cc}
  26. }
  27. func (c *gunServiceClient) Tun(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Hunk, Hunk], error) {
  28. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  29. stream, err := c.cc.NewStream(ctx, &GunService_ServiceDesc.Streams[0], GunService_Tun_FullMethodName, cOpts...)
  30. if err != nil {
  31. return nil, err
  32. }
  33. x := &grpc.GenericClientStream[Hunk, Hunk]{ClientStream: stream}
  34. return x, nil
  35. }
  36. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  37. type GunService_TunClient = grpc.BidiStreamingClient[Hunk, Hunk]
  38. // GunServiceServer is the server API for GunService service.
  39. // All implementations must embed UnimplementedGunServiceServer
  40. // for forward compatibility.
  41. type GunServiceServer interface {
  42. Tun(grpc.BidiStreamingServer[Hunk, Hunk]) error
  43. mustEmbedUnimplementedGunServiceServer()
  44. }
  45. // UnimplementedGunServiceServer must be embedded to have
  46. // forward compatible implementations.
  47. //
  48. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  49. // pointer dereference when methods are called.
  50. type UnimplementedGunServiceServer struct{}
  51. func (UnimplementedGunServiceServer) Tun(grpc.BidiStreamingServer[Hunk, Hunk]) error {
  52. return status.Errorf(codes.Unimplemented, "method Tun not implemented")
  53. }
  54. func (UnimplementedGunServiceServer) mustEmbedUnimplementedGunServiceServer() {}
  55. func (UnimplementedGunServiceServer) testEmbeddedByValue() {}
  56. // UnsafeGunServiceServer may be embedded to opt out of forward compatibility for this service.
  57. // Use of this interface is not recommended, as added methods to GunServiceServer will
  58. // result in compilation errors.
  59. type UnsafeGunServiceServer interface {
  60. mustEmbedUnimplementedGunServiceServer()
  61. }
  62. func RegisterGunServiceServer(s grpc.ServiceRegistrar, srv GunServiceServer) {
  63. // If the following call pancis, it indicates UnimplementedGunServiceServer was
  64. // embedded by pointer and is nil. This will cause panics if an
  65. // unimplemented method is ever invoked, so we test this at initialization
  66. // time to prevent it from happening at runtime later due to I/O.
  67. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  68. t.testEmbeddedByValue()
  69. }
  70. s.RegisterService(&GunService_ServiceDesc, srv)
  71. }
  72. func _GunService_Tun_Handler(srv interface{}, stream grpc.ServerStream) error {
  73. return srv.(GunServiceServer).Tun(&grpc.GenericServerStream[Hunk, Hunk]{ServerStream: stream})
  74. }
  75. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  76. type GunService_TunServer = grpc.BidiStreamingServer[Hunk, Hunk]
  77. // GunService_ServiceDesc is the grpc.ServiceDesc for GunService service.
  78. // It's only intended for direct use with grpc.RegisterService,
  79. // and not to be introspected or modified (even as a copy)
  80. var GunService_ServiceDesc = grpc.ServiceDesc{
  81. ServiceName: "transport.v2raygrpc.GunService",
  82. HandlerType: (*GunServiceServer)(nil),
  83. Methods: []grpc.MethodDesc{},
  84. Streams: []grpc.StreamDesc{
  85. {
  86. StreamName: "Tun",
  87. Handler: _GunService_Tun_Handler,
  88. ServerStreams: true,
  89. ClientStreams: true,
  90. },
  91. },
  92. Metadata: "transport/v2raygrpc/stream.proto",
  93. }