N
N
NubasLol2019-06-21 15:35:13
go
NubasLol, 2019-06-21 15:35:13

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

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2019-06-21
@NubasLol

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 your question

Ask a Question

731 491 924 answers to any question