i have this code where i try to get the localhost ip 127.0.0.1
func (m *Repostory) HomeHandeler(w http.ResponseWriter, r *http.Request) {
// Loop over header names
for name, values := range r.Header {
// Loop over all values for the name.
for _, value := range values {
fmt.Println(name, value)
}
}
remoteIP := utils.ReadUserIP(r)
}
the result of the loop :
Sec-Ch-Ua " Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"
Sec-Ch-Ua-Mobile ?0
Cookie csrf_token=4f7iGnCzBTPXwP6snm6Gxxxc3Qe6P9GwVcaR7F3vUtmRuE=; session=yA0nwu4wWMH up79U9ERfzuWg
Accept-Language en,en-US;q=0.9,he;q=0.8
Connection keep-alive
Cache-Control max-age=0
Sec-Ch-Ua-Platform "Windows"
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Mode navigate
Sec-Fetch-User ?1
Accept-Encoding gzip, deflate, br
Sec-Fetch-Site none
Sec-Fetch-Dest document
but the result of remoteIP :
[::1]:55310