IPAddr#global_unicast?#116
Open
HoneyryderChuck wants to merge 2 commits into
Open
Conversation
This adds the following predicate methods to IPAddr objects: * `#multicast?`: whether the ip address is multicast * `#link_local_multicast?`: whether the ip address is a link-local multicast it also alias `IPAddr#link_local?` as `IPAddr#link_local_unicast?`, which is more accurate (whether the original should be deprecated is probably a separate discussion).
the added method follows the same semantics as defined in go's IsGlobalUnicast: https://github.com/golang/go/blob/master/src/net/ip.go#L188-L203 . The RFCs are explicit about what a global unicast IPv6 address is, less so for IPv4, so this impl just implements the same approach as implemented in go, where any non-broadcast IPv4 address is considered global unicast (and that includes private addresses).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the added method follows the same semantics as defined in go's IsGlobalUnicast:
https://github.com/golang/go/blob/master/src/net/ip.go#L188-L203 .
The RFCs are explicit about what a global unicast IPv6 address is, less so for IPv4, so this impl just implements the same approach as implemented in go, where any non-broadcast IPv4 address is considered global unicast (and that includes private addresses).