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