iptools 0.4.0 released into the wild (i.e. is hitting the CRAN mirrors today)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The iptools
package—a toolkit for manipulating, validating and testing IP addresses and ranges, along with datasets relating to IP addresses—is flying through the internets and hitting a CRAN mirror near you, soon.
What’s fixed?
Tim Smith fixed a bug in ip_in_range()
that occurred when the netmask was /32
(thanks, Tim!).
What’s new?
The range_boundaries()
function now returns the three new fields that are pretty obvious once you see it in action:
range_boundaries("172.18.0.0/28") ## minimum_ip maximum_ip min_numeric max_numeric range ## 1 172.18.0.0 172.18.0.15 2886860800 2886860815 172.18.0.0/28 |
They are tacked on the end, so if you were using positional or named columns previously, you’re still good to go.
We’ve added a new country_ranges()
function to return all “assigned” CIDR blocks in a country. You just give it character vector of one or more ISO 3166-1 alpha-2 codes and you get back the CIDRs:
country_ranges("TO") ## $TO ## [1] "43.255.148.0/22" "103.239.160.0/22" "103.242.126.0/23" "103.245.160.0/22" "175.176.144.0/21" "202.43.8.0/21" ## [7] "202.134.24.0/21" |
This data is updated daily and there’s some session caching built-into the function to speed up subsequent calls if you forgot to save the output. You can flush the session cache with flush_country_cidrs()
and query it with cached_country_cidrs()
.
What’s next?
We’re waiting until the R 3.3.0 Windows toolchain is stable to add in MaxMind ASN lookups. If there are any IP-related functions you need added, drop us an issue. We’re at nearly 1,700 downloads from the RStudio mirror, which (IMO) is kinda cool for such a niche package. Many thanks to all our users and one more thank you to Dirk for the AsioHeaders
package.
Fin
If you want some “bad” IP addresses to play around with in iptools
, check out the blocklist
package, which provides an interface to a subset of the blocklist.de API.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.