package server import ( "fmt" "google.golang.org/grpc/keepalive" "log" "net" "time" "git.icechen.cn/monorepo/backend/pkg/proto/zeus/lark" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) func RpcServer() { lis, err := net.Listen("tcp", ":3000") if err != nil { log.Fatalf("failed to listen: %v", err) } s := grpc.NewServer(grpc.KeepaliveParams(keepalive.ServerParameters{ MaxConnectionIdle: 5 * time.Minute, })) lark.RegisterUserServer(s, &UserServer{}) reflection.Register(s) fmt.Println("lark server run in :3000") if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) } }