使用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.

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.