I propose a new feature: IPAddr#private?.
IPAddr.new("192.168.1.1").private? #=> true.
Updated by naruse (Yui NARUSE) over 5 years ago
- Status changed from Open to Assigned
- Assignee changed from Glass_saga (Masaki Matsushita) to knu (Akinori MUSHA)
The maintainer is knu.
- feature issues
- conflict with private visibility
- “private?” is different from visivility
- Behavior when address family is IPv6
- nil? false?
- or treat link-local, site-local (deprecated), unique-local as true?
- Naming differencies with Addrinfo
- The name “ipv4_private?” is clear that the method returns false on IPv6 addresses.
Updated by herwin (Herwin W) over 5 years ago
IPv6 has a private range too: d00::/8 (RFC 4193)
Also, there are more IP ranges that have been reserved for special use (there's an overview on https://en.wikipedia.org/wiki/Reserved_IP_addresses). I think it would be better to make 1 method that can return a pre-defined symbol of that range if the IP address is in that range. Otherwise, there would be an explosion in the number of IP addresses.
Updated by shyouhei (Shyouhei Urabe) over 5 years ago
As far as I understand RFC4193 never defines its range being "private". There also are other private-ish address ranges e.g. fd00::/8. And what about v4-mapped v6 addresses? IPv6's situation is complicated (at least to me). I'd suggest OP to leave IPv6 situations untouched.
Updated by knu (Akinori MUSHA) almost 4 years ago
- Status changed from Assigned to Closed