github.com/sagernet/sing-box@v1.9.0-rc.20/transport/v2raygrpc/stream_grpc.pb.go (about)

     1  package v2raygrpc
     2  
     3  import (
     4  	context "context"
     5  
     6  	grpc "google.golang.org/grpc"
     7  	codes "google.golang.org/grpc/codes"
     8  	status "google.golang.org/grpc/status"
     9  )
    10  
    11  // This is a compile-time assertion to ensure that this generated file
    12  // is compatible with the grpc package it is being compiled against.
    13  // Requires gRPC-Go v1.32.0 or later.
    14  const _ = grpc.SupportPackageIsVersion7
    15  
    16  const (
    17  	GunService_Tun_FullMethodName = "/transport.v2raygrpc.GunService/Tun"
    18  )
    19  
    20  // GunServiceClient is the client API for GunService service.
    21  //
    22  // 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.
    23  type GunServiceClient interface {
    24  	Tun(ctx context.Context, opts ...grpc.CallOption) (GunService_TunClient, error)
    25  }
    26  
    27  type gunServiceClient struct {
    28  	cc grpc.ClientConnInterface
    29  }
    30  
    31  func NewGunServiceClient(cc grpc.ClientConnInterface) GunServiceClient {
    32  	return &gunServiceClient{cc}
    33  }
    34  
    35  func (c *gunServiceClient) Tun(ctx context.Context, opts ...grpc.CallOption) (GunService_TunClient, error) {
    36  	stream, err := c.cc.NewStream(ctx, &GunService_ServiceDesc.Streams[0], GunService_Tun_FullMethodName, opts...)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	x := &gunServiceTunClient{stream}
    41  	return x, nil
    42  }
    43  
    44  type GunService_TunClient interface {
    45  	Send(*Hunk) error
    46  	Recv() (*Hunk, error)
    47  	grpc.ClientStream
    48  }
    49  
    50  type gunServiceTunClient struct {
    51  	grpc.ClientStream
    52  }
    53  
    54  func (x *gunServiceTunClient) Send(m *Hunk) error {
    55  	return x.ClientStream.SendMsg(m)
    56  }
    57  
    58  func (x *gunServiceTunClient) Recv() (*Hunk, error) {
    59  	m := new(Hunk)
    60  	if err := x.ClientStream.RecvMsg(m); err != nil {
    61  		return nil, err
    62  	}
    63  	return m, nil
    64  }
    65  
    66  // GunServiceServer is the server API for GunService service.
    67  // All implementations must embed UnimplementedGunServiceServer
    68  // for forward compatibility
    69  type GunServiceServer interface {
    70  	Tun(GunService_TunServer) error
    71  	mustEmbedUnimplementedGunServiceServer()
    72  }
    73  
    74  // UnimplementedGunServiceServer must be embedded to have forward compatible implementations.
    75  type UnimplementedGunServiceServer struct{}
    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: "transport.v2raygrpc.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/v2raygrpc/stream.proto",
   135  }