rpcserver.go 566 B

12345678910111213141516171819202122232425262728
  1. package server
  2. import (
  3. "go-common/app/service/main/upcredit/conf"
  4. "go-common/app/service/main/upcredit/service"
  5. "go-common/library/net/rpc"
  6. "go-common/library/net/rpc/context"
  7. )
  8. //RPC rpc server
  9. type RPC struct {
  10. s *service.Service
  11. }
  12. //New create
  13. func New(c *conf.Config, s *service.Service) (svr *rpc.Server) {
  14. r := &RPC{s: s}
  15. svr = rpc.NewServer(c.RPCServer)
  16. if err := svr.Register(r); err != nil {
  17. panic(err)
  18. }
  19. return
  20. }
  21. // Ping check connection success.
  22. func (r *RPC) Ping(c context.Context, arg *struct{}, res *struct{}) (err error) {
  23. return
  24. }