]> Cypherpunks repositories - gostls13.git/commitdiff
net: clarify IP.IsGlobalUnicast docs
authorMikio Hara <mikioh.mikioh@gmail.com>
Fri, 16 Dec 2016 09:45:55 +0000 (18:45 +0900)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 16 Dec 2016 15:35:55 +0000 (15:35 +0000)
Fixes #18181.

Change-Id: I5eed99dfb7b013aa4d4e668e95a97f5bb643d307
Reviewed-on: https://go-review.googlesource.com/34531
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/ip.go

index 4a7774ab38a334247d392c1764fe62118c57a863..db3364c1b317e18f7ff9b6c59820d0d1a0675149 100644 (file)
@@ -153,6 +153,12 @@ func (ip IP) IsLinkLocalUnicast() bool {
 
 // IsGlobalUnicast reports whether ip is a global unicast
 // address.
+//
+// The identification of global unicast addresses uses address type
+// identification as defined in RFC 1122, RFC 4632 and RFC 4291 with
+// the exception of IPv4 directed broadcast addresses.
+// It returns true even if ip is in IPv4 private address space or
+// local IPv6 unicast address space.
 func (ip IP) IsGlobalUnicast() bool {
        return (len(ip) == IPv4len || len(ip) == IPv6len) &&
                !ip.Equal(IPv4bcast) &&