github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/transport/internet/grpc/encoding/stream_grpc.pb.go (about) 1 package encoding 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 GunService_Tun_FullMethodName = "/v2ray.core.transport.internet.grpc.encoding.GunService/Tun" 17 ) 18 19 // GunServiceClient is the client API for GunService service. 20 // 21 // 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. 22 type GunServiceClient interface { 23 Tun(ctx context.Context, opts ...grpc.CallOption) (GunService_TunClient, error) 24 } 25 26 type gunServiceClient struct { 27 cc grpc.ClientConnInterface 28 } 29 30 func NewGunServiceClient(cc grpc.ClientConnInterface) GunServiceClient { 31 return &gunServiceClient{cc} 32 } 33 34 func (c *gunServiceClient) Tun(ctx context.Context, opts ...grpc.CallOption) (GunService_TunClient, error) { 35 stream, err := c.cc.NewStream(ctx, &GunService_ServiceDesc.Streams[0], GunService_Tun_FullMethodName, opts...) 36 if err != nil { 37 return nil, err 38 } 39 x := &gunServiceTunClient{stream} 40 return x, nil 41 } 42 43 type GunService_TunClient interface { 44 Send(*Hunk) error 45 Recv() (*Hunk, error) 46 grpc.ClientStream 47 } 48 49 type gunServiceTunClient struct { 50 grpc.ClientStream 51 } 52 53 func (x *gunServiceTunClient) Send(m *Hunk) error { 54 return x.ClientStream.SendMsg(m) 55 } 56 57 func (x *gunServiceTunClient) Recv() (*Hunk, error) { 58 m := new(Hunk) 59 if err := x.ClientStream.RecvMsg(m); err != nil { 60 return nil, err 61 } 62 return m, nil 63 } 64 65 // GunServiceServer is the server API for GunService service. 66 // All implementations must embed UnimplementedGunServiceServer 67 // for forward compatibility 68 type GunServiceServer interface { 69 Tun(GunService_TunServer) error 70 mustEmbedUnimplementedGunServiceServer() 71 } 72 73 // UnimplementedGunServiceServer must be embedded to have forward compatible implementations. 74 type UnimplementedGunServiceServer struct { 75 } 76 77 func (UnimplementedGunServiceServer) Tun(GunService_TunServer) error { 78 return status.Errorf(codes.Unimplemented, "method Tun not implemented") 79 } 80 func (UnimplementedGunServiceServer) mustEmbedUnimplementedGunServiceServer() {} 81 82 // UnsafeGunServiceServer may be embedded to opt out of forward compatibility for this service. 83 // Use of this interface is not recommended, as added methods to GunServiceServer will 84 // result in compilation errors. 85 type UnsafeGunServiceServer interface { 86 mustEmbedUnimplementedGunServiceServer() 87 } 88 89 func RegisterGunServiceServer(s grpc.ServiceRegistrar, srv GunServiceServer) { 90 s.RegisterService(&GunService_ServiceDesc, srv) 91 } 92 93 func _GunService_Tun_Handler(srv interface{}, stream grpc.ServerStream) error { 94 return srv.(GunServiceServer).Tun(&gunServiceTunServer{stream}) 95 } 96 97 type GunService_TunServer interface { 98 Send(*Hunk) error 99 Recv() (*Hunk, error) 100 grpc.ServerStream 101 } 102 103 type gunServiceTunServer struct { 104 grpc.ServerStream 105 } 106 107 func (x *gunServiceTunServer) Send(m *Hunk) error { 108 return x.ServerStream.SendMsg(m) 109 } 110 111 func (x *gunServiceTunServer) Recv() (*Hunk, error) { 112 m := new(Hunk) 113 if err := x.ServerStream.RecvMsg(m); err != nil { 114 return nil, err 115 } 116 return m, nil 117 } 118 119 // GunService_ServiceDesc is the grpc.ServiceDesc for GunService service. 120 // It's only intended for direct use with grpc.RegisterService, 121 // and not to be introspected or modified (even as a copy) 122 var GunService_ServiceDesc = grpc.ServiceDesc{ 123 ServiceName: "v2ray.core.transport.internet.grpc.encoding.GunService", 124 HandlerType: (*GunServiceServer)(nil), 125 Methods: []grpc.MethodDesc{}, 126 Streams: []grpc.StreamDesc{ 127 { 128 StreamName: "Tun", 129 Handler: _GunService_Tun_Handler, 130 ServerStreams: true, 131 ClientStreams: true, 132 }, 133 }, 134 Metadata: "transport/internet/grpc/encoding/stream.proto", 135 }