diff options
author | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-12-16 18:45:55 +0900 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-12-16 15:35:55 +0000 |
commit | 7799022cddf440f79463afdad969360a2ca86a9e (patch) | |
tree | f514626c4c5b1207901a7d9f68ac79f008848c72 | |
parent | ecc4474341504f5893c8333dbb68c520dbe93ca5 (diff) | |
download | go-7799022cddf440f79463afdad969360a2ca86a9e.tar.gz go-7799022cddf440f79463afdad969360a2ca86a9e.zip |
net: clarify IP.IsGlobalUnicast docs
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>
-rw-r--r-- | src/net/ip.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/net/ip.go b/src/net/ip.go index 4a7774ab38..db3364c1b3 100644 --- a/src/net/ip.go +++ b/src/net/ip.go @@ -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) && |