In Go one can send UDP packets using net.Addr
interface to specify the target endpoint. Some special addresses, e.g. :8080
and 0.0.0.0
, sends packets using local loopback interface. When received, still on the same host, the message's net.Addr
shows [::1]:8080
as source. What is the the easiest way to determine that the packet was sent and received by the same host?
Here's an example in the Go Playground. It shows 0.0.0.0:8080
(ipv4) instead of [::1]:8080
.