duankuang1046 2019-09-08 17:29
浏览 212

使用Go标准库查找IP地址的位置和时区[关闭]

I am trying to find the location and timezone for any IP address using the Go standard library, but could not find any solution yet.

I was experimenting to find the IP address of any client sending a request, figured one way by using go methods as below and cleaning their responses.

req.Header.Get("x-forwarded-for")
req.RemoteAddr

But once I get the IP. Is there any method in Go using the standard library to get the location and timezone of that IP, I can't make use of any third party API Calls or third party libraries. Any pointers will be helpful.

  • 写回答

1条回答 默认 最新

  • dtry54612 2019-09-08 17:39
    关注

    In general, no. You have to use an IP-based geolocation service, or one of the freely available geolocation libraries. The accuracy may depend on the library or service you use, and the IP address. There is also the problem of IP addresses assigned to mobile phones, etc. that move.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料