Commit 42f66b11 authored by vicotor's avatar vicotor

add first implement.

parent 3e5a44aa
package crypto
package main
import (
"fmt"
"github.com/cmpchain/metacrypter/service"
"google.golang.org/grpc"
"net"
)
func main() {
lis, err := net.Listen("tcp", ":8970")
if err != nil {
fmt.Printf("failed to listen: %v", err)
return
}
s := grpc.NewServer()
service.RegisterCrypter(s)
err = s.Serve(lis)
if err != nil {
fmt.Printf("failed to serve: %v", err)
return
}
}
package service
import (
"context"
metacrypter "github.com/cmpchain/metacrypter/pb/metacrypter/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// hello server
type CrypterServer struct {
metacrypter.UnimplementedCrypterServiceServer
}
func (*CrypterServer) Sign(ctx context.Context, req *metacrypter.SignRequest) (*metacrypter.SignResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sign not implemented")
}
func (*CrypterServer) Verify(ctx context.Context, req *metacrypter.VerifyRequest) (*metacrypter.VerifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Verify not implemented")
}
func (*CrypterServer) Recover(ctx context.Context, req *metacrypter.RecoverRequest) (*metacrypter.RecoverResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Recover not implemented")
}
func (*CrypterServer) BatchSign(ctx context.Context, req *metacrypter.BatchSignRequest) (*metacrypter.BatchSignResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchSign not implemented")
}
func (*CrypterServer) BatchVerify(ctx context.Context, req *metacrypter.BatchVerifyRequest) (*metacrypter.BatchVerifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchVerify not implemented")
}
func (*CrypterServer) BatchRecover(ctx context.Context, req *metacrypter.BatchRecoverRequest) (*metacrypter.BatchRecoverResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchRecover not implemented")
}
func RegisterCrypter(server *grpc.Server) {
metacrypter.RegisterCrypterServiceServer(server, &CrypterServer{})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment