server.go 877 B

1234567891011121314151617181920212223242526
  1. package grpc
  2. import (
  3. pb "go-common/app/service/live/resource/api/grpc/v1"
  4. v2pb "go-common/app/service/live/resource/api/grpc/v2"
  5. "go-common/app/service/live/resource/conf"
  6. svc "go-common/app/service/live/resource/service/v1"
  7. v2svc "go-common/app/service/live/resource/service/v2"
  8. "go-common/library/net/rpc/warden"
  9. )
  10. // New
  11. func New(c *conf.Config) *warden.Server {
  12. ws := warden.NewServer(nil)
  13. pb.RegisterResourceServer(ws.Server(), svc.NewResourceService(c))
  14. pb.RegisterSplashServer(ws.Server(), svc.NewSplashService(c))
  15. pb.RegisterBannerServer(ws.Server(), svc.NewBannerService(c))
  16. pb.RegisterLiveCheckServer(ws.Server(), svc.NewLiveCheckService(c))
  17. pb.RegisterTitansServer(ws.Server(), svc.NewTitansService(c))
  18. v2pb.RegisterUserResourceServer(ws.Server(), v2svc.NewUserResourceService(c))
  19. ws, err := ws.Start()
  20. if err != nil {
  21. panic(err)
  22. }
  23. return ws
  24. }