extra multicast/unicast predicates#114
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 * `#global_unicast?`: whetther the ip address is a global unicast 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).
|
@HoneyryderChuck What use cases do you have in mind for In particular, I'm not sure about the behavior of According to RFC 4291, all IPv6 addresses except Unspecified ( However, there is no corresponding definition of "Global Unicast" for IPv4, so In the current implementation of this pull request, IPv4 addresses that are not globally reachable, such as Private addresses (e.g. IPAddr.new("10.0.0.1").global_unicast?
# => trueIs this behavior intentional? If so, could you explain the rationale behind it? |
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#global_unicast?: whetther the ip address is a global unicastit also alias
IPAddr#link_local?asIPAddr#link_local_unicast?, which is more accurate (whether the original should be deprecated is probably a separate discussion).The motivation for adding these methods was to upstream these predicates from cel which have a broader meaning in the context of IP addressing, and maybe be applied in other contexts.