mirror of
https://github.com/golang/go
synced 2024-11-17 02:24:42 -07:00
net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more
Clarify the form of its IPv4 addresses when listening on an unspecified address. (found while testing/reviewing CL 399454) Change-Id: I62b367f5a4e6d340eb72dd7ec342080f1821e63e Reviewed-on: https://go-review.googlesource.com/c/go/+/419614 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
faf4e97200
commit
4248146154
@ -164,6 +164,10 @@ func (c *UDPConn) ReadFrom(b []byte) (int, Addr, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromUDPAddrPort acts like ReadFrom but returns a netip.AddrPort.
|
// 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) {
|
func (c *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
||||||
if !c.ok() {
|
if !c.ok() {
|
||||||
return 0, netip.AddrPort{}, syscall.EINVAL
|
return 0, netip.AddrPort{}, syscall.EINVAL
|
||||||
|
Loading…
Reference in New Issue
Block a user