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