Categories
How to get ip address?
ip, _, _ := net.SplitHostPort(req.RemoteAddr) I'm trying to get this way, the result is very strange. In the req.RemoteAddr [::1]:55684 itself, it looks like this. I need ipv4
ip, _, _ := net.SplitHostPort(req.RemoteAddr)
Answer the question
In order to leave comments, you need to log in
this is due to localhost and ipv6 enabled in the system, try accessing your server at 127.0.0.1 and everything will be fine
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question