diff --git a/src/net/udpsock.go b/src/net/udpsock.go index 6d29a39edf..e30624dea5 100644 --- a/src/net/udpsock.go +++ b/src/net/udpsock.go @@ -164,6 +164,10 @@ func (c *UDPConn) ReadFrom(b []byte) (int, Addr, error) { } // ReadFromUDPAddrPort acts like ReadFrom but returns a netip.AddrPort. +// +// If c is bound to an unspecified address, the returned +// netip.AddrPort's address might be an IPv4-mapped IPv6 address. +// Use netip.Addr.Unmap to get the address without the IPv6 prefix. func (c *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) { if !c.ok() { return 0, netip.AddrPort{}, syscall.EINVAL