secure.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package secure
  2. import (
  3. "context"
  4. model "go-common/app/service/main/secure/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _status = "RPC.Status"
  9. _expect = "RPC.ExpectionLoc"
  10. _addFeedback = "RPC.AddFeedBack"
  11. _closeNotify = "RPC.CloseNotify"
  12. )
  13. const (
  14. _appid = "account.service.secure"
  15. )
  16. var (
  17. _noRes = &struct{}{}
  18. )
  19. // Service rpc service.
  20. type Service struct {
  21. client *rpc.Client2
  22. }
  23. // New new rpc service.
  24. func New(c *rpc.ClientConfig) (s *Service) {
  25. s = &Service{}
  26. s.client = rpc.NewDiscoveryCli(_appid, c)
  27. return
  28. }
  29. // Status get the ip info.
  30. func (s *Service) Status(c context.Context, arg *model.ArgSecure) (res *model.Msg, err error) {
  31. res = new(model.Msg)
  32. err = s.client.Call(c, _status, arg, &res)
  33. return
  34. }
  35. // CloseNotify clsoe notify.
  36. func (s *Service) CloseNotify(c context.Context, arg *model.ArgSecure) (err error) {
  37. return s.client.Call(c, _closeNotify, arg, &_noRes)
  38. }
  39. // AddFeedBack add expection feedback.
  40. func (s *Service) AddFeedBack(c context.Context, arg *model.ArgFeedBack) (err error) {
  41. return s.client.Call(c, _addFeedback, arg, &_noRes)
  42. }
  43. // ExpectionLoc get expection loc.
  44. func (s *Service) ExpectionLoc(c context.Context, arg *model.ArgSecure) (res []*model.Expection, err error) {
  45. err = s.client.Call(c, _expect, arg, &res)
  46. return
  47. }