Skip to contents

Retrieve lists of IP networks registered to specific countries.

Usage

country_networks(country, ..., collapse = TRUE)

Source

https://www.iwik.org/ipcountry/ (updated daily)

Arguments

country

Character vector of two-letter country codes (ISO 3166-1 alpha-2)

...

These dots are for future extensions and must be empty.

collapse

If TRUE (the default), contiguous networks are collapsed. See collapse_networks().

Value

A data frame with 2 variables:

  • country: A character vector

  • network: A list of ip_network vectors

Each row represents a single country associated with a vector of IP networks.

Details

This function requires an internet connection to download network lists.

Examples

if (FALSE) {
country_networks(c("GB", "US"))

country_networks(c("GB", "US"), collapse = FALSE)

# retrieve networks for a single country
country_networks("TO")$networks[[1]]

# expand networks for multiple countries
tidyr::unchop(country_networks(c("GB", "US")), networks)
}