ip.go 425 B

123456789101112131415161718
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/service/main/location/model"
  5. "go-common/library/log"
  6. "go-common/library/net/metadata"
  7. )
  8. // IPZone get ip zone info by ip
  9. func (s *Service) IPZone(c context.Context) (res *model.Info, err error) {
  10. ip := metadata.String(c, metadata.RemoteIP)
  11. if res, err = s.loc.Info(c, &model.ArgIP{IP: ip}); err != nil {
  12. log.Error("s.loc.Info(%s) error(%v)", ip, err)
  13. }
  14. return
  15. }