github.com/xmplusdev/xray-core@v1.8.10/transport/internet/grpc/encoding/stream_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.3.0 4 // - protoc v4.23.1 5 // source: transport/internet/grpc/encoding/stream.proto 6 7 package encoding 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 const ( 22 GRPCService_Tun_FullMethodName = "/xray.transport.internet.grpc.encoding.GRPCService/Tun" 23 GRPCService_TunMulti_FullMethodName = "/xray.transport.internet.grpc.encoding.GRPCService/TunMulti" 24 ) 25 26 // GRPCServiceClient is the client API for GRPCService service. 27 // 28 // 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. 29 type GRPCServiceClient interface { 30 Tun(ctx context.Context, opts ...grpc.CallOption) (GRPCService_TunClient, error) 31 TunMulti(ctx context.Context, opts ...grpc.CallOption) (GRPCService_TunMultiClient, error) 32 } 33 34 type gRPCServiceClient struct { 35 cc grpc.ClientConnInterface 36 } 37 38 func NewGRPCServiceClient(cc grpc.ClientConnInterface) GRPCServiceClient { 39 return &gRPCServiceClient{cc} 40 } 41 42 func (c *gRPCServiceClient) Tun(ctx context.Context, opts ...grpc.CallOption) (GRPCService_TunClient, error) { 43 stream, err := c.cc.NewStream(ctx, &GRPCService_ServiceDesc.Streams[0], GRPCService_Tun_FullMethodName, opts...) 44 if err != nil { 45 return nil, err 46 } 47 x := &gRPCServiceTunClient{stream} 48 return x, nil 49 } 50 51 type GRPCService_TunClient interface { 52 Send(*Hunk) error 53 Recv() (*Hunk, error) 54 grpc.ClientStream 55 } 56 57 type gRPCServiceTunClient struct { 58 grpc.ClientStream 59 } 60 61 func (x *gRPCServiceTunClient) Send(m *Hunk) error { 62 return x.ClientStream.SendMsg(m) 63 } 64 65 func (x *gRPCServiceTunClient) Recv() (*Hunk, error) { 66 m := new(Hunk) 67 if err := x.ClientStream.RecvMsg(m); err != nil { 68 return nil, err 69 } 70 return m, nil 71 } 72 73 func (c *gRPCServiceClient) TunMulti(ctx context.Context, opts ...grpc.CallOption) (GRPCService_TunMultiClient, error) { 74 stream, err := c.cc.NewStream(ctx, &GRPCService_ServiceDesc.Streams[1], GRPCService_TunMulti_FullMethodName, opts...) 75 if err != nil { 76 return nil, err 77 } 78 x := &gRPCServiceTunMultiClient{stream} 79 return x, nil 80 } 81 82 type GRPCService_TunMultiClient interface { 83 Send(*MultiHunk) error 84 Recv() (*MultiHunk, error) 85 grpc.ClientStream 86 } 87 88 type gRPCServiceTunMultiClient struct { 89 grpc.ClientStream 90 } 91 92 func (x *gRPCServiceTunMultiClient) Send(m *MultiHunk) error { 93 return x.ClientStream.SendMsg(m) 94 } 95 96 func (x *gRPCServiceTunMultiClient) Recv() (*MultiHunk, error) { 97 m := new(MultiHunk) 98 if err := x.ClientStream.RecvMsg(m); err != nil { 99 return nil, err 100 } 101 return m, nil 102 } 103 104 // GRPCServiceServer is the server API for GRPCService service. 105 // All implementations must embed UnimplementedGRPCServiceServer 106 // for forward compatibility 107 type GRPCServiceServer interface { 108 Tun(GRPCService_TunServer) error 109 TunMulti(GRPCService_TunMultiServer) error 110 mustEmbedUnimplementedGRPCServiceServer() 111 } 112 113 // UnimplementedGRPCServiceServer must be embedded to have forward compatible implementations. 114 type UnimplementedGRPCServiceServer struct { 115 } 116 117 func (UnimplementedGRPCServiceServer) Tun(GRPCService_TunServer) error { 118 return status.Errorf(codes.Unimplemented, "method Tun not implemented") 119 } 120 func (UnimplementedGRPCServiceServer) TunMulti(GRPCService_TunMultiServer) error { 121 return status.Errorf(codes.Unimplemented, "method TunMulti not implemented") 122 } 123 func (UnimplementedGRPCServiceServer) mustEmbedUnimplementedGRPCServiceServer() {} 124 125 // UnsafeGRPCServiceServer may be embedded to opt out of forward compatibility for this service. 126 // Use of this interface is not recommended, as added methods to GRPCServiceServer will 127 // result in compilation errors. 128 type UnsafeGRPCServiceServer interface { 129 mustEmbedUnimplementedGRPCServiceServer() 130 } 131 132 func RegisterGRPCServiceServer(s grpc.ServiceRegistrar, srv GRPCServiceServer) { 133 s.RegisterService(&GRPCService_ServiceDesc, srv) 134 } 135 136 func _GRPCService_Tun_Handler(srv interface{}, stream grpc.ServerStream) error { 137 return srv.(GRPCServiceServer).Tun(&gRPCServiceTunServer{stream}) 138 } 139 140 type GRPCService_TunServer interface { 141 Send(*Hunk) error 142 Recv() (*Hunk, error) 143 grpc.ServerStream 144 } 145 146 type gRPCServiceTunServer struct { 147 grpc.ServerStream 148 } 149 150 func (x *gRPCServiceTunServer) Send(m *Hunk) error { 151 return x.ServerStream.SendMsg(m) 152 } 153 154 func (x *gRPCServiceTunServer) Recv() (*Hunk, error) { 155 m := new(Hunk) 156 if err := x.ServerStream.RecvMsg(m); err != nil { 157 return nil, err 158 } 159 return m, nil 160 } 161 162 func _GRPCService_TunMulti_Handler(srv interface{}, stream grpc.ServerStream) error { 163 return srv.(GRPCServiceServer).TunMulti(&gRPCServiceTunMultiServer{stream}) 164 } 165 166 type GRPCService_TunMultiServer interface { 167 Send(*MultiHunk) error 168 Recv() (*MultiHunk, error) 169 grpc.ServerStream 170 } 171 172 type gRPCServiceTunMultiServer struct { 173 grpc.ServerStream 174 } 175 176 func (x *gRPCServiceTunMultiServer) Send(m *MultiHunk) error { 177 return x.ServerStream.SendMsg(m) 178 } 179 180 func (x *gRPCServiceTunMultiServer) Recv() (*MultiHunk, error) { 181 m := new(MultiHunk) 182 if err := x.ServerStream.RecvMsg(m); err != nil { 183 return nil, err 184 } 185 return m, nil 186 } 187 188 // GRPCService_ServiceDesc is the grpc.ServiceDesc for GRPCService service. 189 // It's only intended for direct use with grpc.RegisterService, 190 // and not to be introspected or modified (even as a copy) 191 var GRPCService_ServiceDesc = grpc.ServiceDesc{ 192 ServiceName: "xray.transport.internet.grpc.encoding.GRPCService", 193 HandlerType: (*GRPCServiceServer)(nil), 194 Methods: []grpc.MethodDesc{}, 195 Streams: []grpc.StreamDesc{ 196 { 197 StreamName: "Tun", 198 Handler: _GRPCService_Tun_Handler, 199 ServerStreams: true, 200 ClientStreams: true, 201 }, 202 { 203 StreamName: "TunMulti", 204 Handler: _GRPCService_TunMulti_Handler, 205 ServerStreams: true, 206 ClientStreams: true, 207 }, 208 }, 209 Metadata: "transport/internet/grpc/encoding/stream.proto", 210 }