2021-08-21 01:20:40 -04:00
|
|
|
//go:build !confonly
|
2021-03-11 03:46:17 -05:00
|
|
|
// +build !confonly
|
|
|
|
|
|
|
|
package encoding
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ServerDesc(name string) grpc.ServiceDesc {
|
|
|
|
return grpc.ServiceDesc{
|
|
|
|
ServiceName: name,
|
|
|
|
HandlerType: (*GunServiceServer)(nil),
|
|
|
|
Methods: []grpc.MethodDesc{},
|
|
|
|
Streams: []grpc.StreamDesc{
|
|
|
|
{
|
|
|
|
StreamName: "Tun",
|
|
|
|
Handler: _GunService_Tun_Handler,
|
|
|
|
ServerStreams: true,
|
|
|
|
ClientStreams: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Metadata: "gun.proto",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *gunServiceClient) TunCustomName(ctx context.Context, name string, opts ...grpc.CallOption) (GunService_TunClient, error) {
|
|
|
|
stream, err := c.cc.NewStream(ctx, &ServerDesc(name).Streams[0], "/"+name+"/Tun", opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
x := &gunServiceTunClient{stream}
|
|
|
|
return x, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type GunServiceClientX interface {
|
|
|
|
TunCustomName(ctx context.Context, name string, opts ...grpc.CallOption) (GunService_TunClient, error)
|
|
|
|
Tun(ctx context.Context, opts ...grpc.CallOption) (GunService_TunClient, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterGunServiceServerX(s *grpc.Server, srv GunServiceServer, name string) {
|
|
|
|
desc := ServerDesc(name)
|
|
|
|
s.RegisterService(&desc, srv)
|
|
|
|
}
|