server.go 395 B

123456789101112131415161718
  1. package grpc
  2. import (
  3. uprpc "go-common/app/service/main/up/api/v1"
  4. "go-common/app/service/main/up/service"
  5. "go-common/library/net/rpc/warden"
  6. )
  7. // New new a grpc server.
  8. func New(cfg *warden.ServerConfig, s *service.Service) *warden.Server {
  9. grpc := warden.NewServer(cfg)
  10. uprpc.RegisterUpServer(grpc.Server(), s)
  11. grpc, err := grpc.Start()
  12. if err != nil {
  13. panic(err)
  14. }
  15. return grpc
  16. }