func (s *GrpcServer) Stop(context.Context, *pbx.Empty) (*pbx.Empty, error) {
	return nil, nil
}
Stop implements Unitd.Stop
package lineprotocol
import (
	"context"
	"log"
	"net"
	"time"
	"github.com/golang/protobuf/proto"
	plugins "github.com/unit-io/unitd/plugins/grpc"
	pbx "github.com/unit-io/unitd/proto"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
	"google.golang.org/grpc/keepalive"
)
const (
	MaxMessageSize = 1 << 19
)
type GrpcServer server
func NewGrpcServer(opts ...Options) *GrpcServer {
	srv := &GrpcServer{
		opts: new(options),
	}
	WithDefaultOptions().set(srv.opts)
	for _, opt := range opts {
		opt.set(srv.opts)
	}
	return srv
}
func (s *GrpcServer) Start(ctx context.Context, info *pbx.ConnInfo) (*pbx.ConnInfo, error) {
	if info != nil {
		return info, nil
	}
	return nil, nil
}
func StreamConn(
	stream grpc.Stream,
) *plugins.Conn {
	packetFunc := func(msg proto.Message) *[]byte {
		return &msg.(*pbx.Packet).Data
	}
	return &plugins.Conn{
		Stream: stream,
		InMsg:  &pbx.Packet{},
		OutMsg: &pbx.Packet{},
		Encode: plugins.Encode(packetFunc),
		Decode: plugins.Decode(packetFunc),
	}
}
func (s *GrpcServer) Stream(stream pbx.Unitd_StreamServer) error {
	conn := StreamConn(stream)
	defer conn.Close()
	go s.Handler(conn, GRPC)
	<-stream.Context().Done()
	return nil
}