ipaddr
ipaddr copied to clipboard
A class to manipulate an IP address
Implementation for [Feature request #15734](https://bugs.ruby-lang.org/issues/15734) from Ruby bug tracker. --- Many applications (like browsers, `curl`, and `ping`) and even Ruby's own `Net::HTTP` library accepts shorthand IPv4 addresses like `127.1` or...
It fixes comparing '0.0.0.0'/'::' to nil for == method. `IPAddr.new("0.0.0.0") == nil` and `nil == IPAddr.new("0.0.0.0")` will return same result of `false`. ```ruby # IPv4 IPAddr.new("0.0.0.0") == nil => false...
`IPAddr.new("0.0.0.0") == nil` and `nil == IPAddr.new("0.0.0.0")` return different result. ### Steps to reproduce ```ruby # IPv4 IPAddr.new("0.0.0.0") == nil => true # expected false nil == IPAddr.new('0.0.0.0') => false...
Add +/- methods to get an ipaddr instance greater/less than the original address by offset. the current `IPAddr#succ` only return next address, this `IPAddr#+` return any address with offset. ```...
@knu @hsbt Changes in this PR: * isolates the VERSION file * adds iterators: - `.each` : all addresses in a given range - `.each_host` : all usable host addresses...
This library already has `private?`, `link_local?`, `loopback?`, etc. It would be useful to have a `reserved?` method: https://en.wikipedia.org/wiki/Reserved_IP_addresses One of the reasons would be to mitigate SSRF attacks in a...
## Why Address Mask is Essential for IPAddr Equality In networking, an IP address without a prefix/netmask is fundamentally incomplete. Two IP addresses should only be compared using the address,...
Rationale: [This SO question](https://stackoverflow.com/questions/1825928/netmask-to-cidr-in-ruby) demonstrates there is at least some need to manipulate netmasks into CIDR integers. The accepted answer contains a bug which can be easily eliminated by hard...