R
R
Roman Rakzin2016-01-25 13:31:33
go
Roman Rakzin, 2016-01-25 13:31:33

How to find out in golang what ip/country/city the user came from?

How to find out in golang what ip/country/city the user came from?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2016-01-25
@dimonchik2013

Golang has nothing to do with
getting IP - you go to the databases
https://sypexgeo.net/
tabgeo.com/en/index

U
uvelichitel, 2016-01-25
@uvelichitel

IP is in http.Request.RemoteAddrwhich is transmitted to anyonehttp.Handler

http.HandleFunc("/something", func(w http.ResponseWriter, r *http.Request) {
  IP := r.RemoteAddr()
        ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question