Browse Source

initial commit

master
boB Rudis 4 years ago
parent
commit
b2d2f05114
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 1
      .Rbuildignore
  2. 22
      DESCRIPTION
  3. 2
      LICENSE
  4. 21
      LICENSE.md
  5. 7
      NAMESPACE
  6. 2
      R/aaa.R
  7. 83
      R/create-cidr-tbl.R
  8. 78
      R/create-ip-tbl.R
  9. 64
      R/find-ips-in-cidrs.R
  10. 42
      R/macos-setup.R
  11. 14
      R/pgcidr-package.R
  12. 42
      README.Rmd
  13. 117
      README.md
  14. 1791
      inst/extdat/amzn-cidrs.csv
  15. 661
      inst/extdat/weblog.csv
  16. 66
      man/create_cidr_lookup_table.Rd
  17. 52
      man/create_ip_source_table.Rd
  18. 52
      man/find_ips_in_cidrs.Rd
  19. 48
      man/macos_postgresql_setup_with_ip4r.Rd
  20. 8
      man/pgcidr.Rd

1
.Rbuildignore

@ -19,3 +19,4 @@
^CRAN-RELEASE$
^appveyor\.yml$
^tools$
^LICENSE\.md$

22
DESCRIPTION

@ -1,6 +1,6 @@
Package: pgcidr
Type: Package
Title: pgcidr title goes here otherwise CRAN checks fail
Title: Perform IP Address in CIDR Lookups with PostgreSQL and ip4r
Version: 0.1.0
Date: 2020-05-13
Authors@R: c(
@ -8,17 +8,23 @@ Authors@R: c(
comment = c(ORCID = "0000-0001-5670-2640"))
)
Maintainer: Bob Rudis <bob@rud.is>
Description: A good description goes here otherwise CRAN checks fail.
Description: PostgreSQL has built-in support for IP address and CIDR types
but the ip4r <https://github.com/RhodiumToad/ip4r> extension is much faster.
Tools are provided to create CIDR lookup and IP address source tables and
perform IP address in CIDR queries. Documentation on how to setup macOS
with PostgreSQL and ip4r is also provided.
URL: https://git.rud.is/hrbrmstr/pgcidr
BugReports: https://gitlab.com/hrbrmstr/pgcidr/issues
Encoding: UTF-8
License: AGPL
License: MIT + file LICENSE
Suggests:
covr, tinytest
covr, tinytest, tibble
Depends:
R (>= 3.2.0)
Imports:
httr,
jsonlite
R (>= 3.5.0),
DBI,
odbc
Imports:
glue,
readr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0

2
LICENSE

@ -0,0 +1,2 @@
YEAR: 2020
COPYRIGHT HOLDER: Bob Rudis

21
LICENSE.md

@ -0,0 +1,21 @@
# MIT License
Copyright (c) 2020 Bob Rudis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

7
NAMESPACE

@ -1,4 +1,7 @@
# Generated by roxygen2: do not edit by hand
import(httr)
importFrom(jsonlite,fromJSON)
export(create_cidr_lookup_table)
export(create_ip_source_table)
export(find_ips_in_cidrs)
importFrom(glue,glue)
importFrom(readr,write_csv)

2
R/aaa.R

@ -0,0 +1,2 @@
ac <- as.character
gg <- glue::glue

83
R/create-cidr-tbl.R

@ -0,0 +1,83 @@
#' Creates a CIDR lookup table
#'
#' The columns named in `entity_col` and `cidr_col` *must exist* in the
#' data frame or CSV file. All `_name`s must be valid PostgreSQL syntax for
#' said names. Setting `drop=TRUE` is _destructive_.\cr
#' \cr
#' NOTE that `cidr_col` is a primary key. Thus duplicate CIDRs are not allowed
#' and it's up to you to ensure that.
#'
#' @param pgcon a PostgreSQL DBI connection
#' @param tbl_name name of the CIDR table (valid PG table name syntax)
#' @param drop drop existing CIDR table if it has the same name? Defaults to `FALSE`.
#' @param xdf Data frame to use to populate the table or a path to a CSV file.
#' If a path it will be [path.expand()]ed.
#' @param entity_col Name of the column that holds the entity reference name for the CIDR
#' @param cidr_col Name of the column that holds the CIDR block
#' @export
#' @examples \dontrun{
#' DBI::dbConnect(
#' odbc::odbc(),
#' driver = "/usr/local/lib/psqlodbca.so",
#' Database = "working",
#' Host = "localhost"
#' ) -> con
#'
#' create_cidr_lookup_table(
#' pgcon = con,
#' tbl_name = "amazon_cidrs",
#' drop = TRUE,
#' xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
#' )
#'
#' create_ip_source_table(
#' pgcon = con,
#' tbl_name = "weblog",
#' drop = TRUE,
#' xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
#' )
#'
#' find_ips_in_cidrs(
#' con, "weblog", "amazon_cidrs"
#' )
#'
#' }
create_cidr_lookup_table <- function(pgcon, tbl_name, drop=FALSE, xdf,
entity_col="entity", cidr_col="cidr") {
stopifnot(inherits(con, "PostgreSQL"))
tbl_name <- tbl_name[1]
idx_name <- ac(gg("{tbl_name}_idx"))
entity_col <- entity_col[1]
cidr_col <- cidr_col[1]
if (inherits(xdf, "character")) {
tf <- path.expand(xdf[1])
stopifnot(file.exists(tf))
} else {
tf <- tempfile(fileext = ".csv")
on.exit(unlink(tf))
xdf <- xdf[,c(entity_col, cidr_col)]
readr::write_csv(xdf, tf)
}
if (drop) {
dbExecute(con, ac(gg("DROP TABLE IF EXISTS {tbl_name}")))
dbExecute(con, ac(gg("DROP INDEX IF EXISTS {idx_name}")))
}
dbExecute(con, ac(gg("CREATE TABLE {tbl_name}({entity_col} text not null, {cidr_col} ip4r primary key)")))
dbExecute(con, ac(gg("COPY {tbl_name} FROM '{tf}' WITH (format csv, header)")))
dbExecute(con, ac(gg("CREATE INDEX {idx_name} ON {tbl_name} USING gist({cidr_col})")))
invisible(NULL)
}

78
R/create-ip-tbl.R

@ -0,0 +1,78 @@
#' Creates a IP address table
#'
#' The column named in `ip_col` ` *must exist* in the
#' data frame or CSV file. All `_name`s must be valid PostgreSQL syntax for
#' said names. Setting `drop=TRUE` is _destructive_.
#'
#' @param pgcon a PostgreSQL DBI connection
#' @param tbl_name name of the IP table (valid PG table name syntax)
#' @param drop drop existing IP table if it has the same name? Defaults to `FALSE`.
#' @param xdf Data frame to use to populate the table or a path to a CSV file.
#' If a path it will be [path.expand()]ed.
#' @param ip_col Name of the column that holds the IP addresses
#' @export
#' @examples \dontrun{
#' DBI::dbConnect(
#' odbc::odbc(),
#' driver = "/usr/local/lib/psqlodbca.so",
#' Database = "working",
#' Host = "localhost"
#' ) -> con
#'
#' create_cidr_lookup_table(
#' pgcon = con,
#' tbl_name = "amazon_cidrs",
#' drop = TRUE,
#' xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
#' )
#'
#' create_ip_source_table(
#' pgcon = con,
#' tbl_name = "weblog",
#' drop = TRUE,
#' xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
#' )
#'
#' find_ips_in_cidrs(
#' con, "weblog", "amazon_cidrs"
#' )
#'
#' }
create_ip_source_table <- function(pgcon, tbl_name, drop=FALSE, xdf, ip_col = "ip") {
stopifnot(inherits(con, "PostgreSQL"))
tbl_name <- tbl_name[1]
idx_name <- ac(gg("{tbl_name}_idx"))
ip_col <- ip_col[1]
if (inherits(xdf, "character")) {
tf <- path.expand(xdf[1])
stopifnot(file.exists(tf))
} else {
tf <- tempfile(fileext = ".csv")
on.exit(unlink(tf))
xdf <- xdf[,c(ip_col)]
readr::write_csv(xdf, tf)
}
if (drop) {
dbExecute(con, ac(gg("DROP TABLE IF EXISTS {tbl_name}")))
dbExecute(con, ac(gg("DROP INDEX IF EXISTS {idx_name}")))
}
dbExecute(con, ac(gg("CREATE TABLE {tbl_name}({ip_col} ip4 not null)")))
dbExecute(con, ac(gg("COPY {tbl_name} FROM '{tf}' WITH (format csv, header)")))
dbExecute(con, ac(gg("CREATE INDEX {idx_name} ON {tbl_name}({ip_col})")))
invisible(NULL)
}

64
R/find-ips-in-cidrs.R

@ -0,0 +1,64 @@
#' Finds IPs in CIDR blocks
#'
#' After you use [create_cidr_lookup_table()] and [create_ip_source_table()]
#' use this function to do the lookup.
#'
#' @param pgcon a PostgreSQL DBI connection
#' @param ip_tbl name of the IP table (valid PG table name syntax)
#' @param cidr_tbl name of the CIDR table (valid PG table name syntax)
#' @param ip_col Name of the column that holds the IP addresses in `ip_tbl`
#' @param cidr_col Name of the column that holds the CIDR block in `cidr_tbl`
#' @export
#' @examples \dontrun{
#' DBI::dbConnect(
#' odbc::odbc(),
#' driver = "/usr/local/lib/psqlodbca.so",
#' Database = "working",
#' Host = "localhost"
#' ) -> con
#'
#' create_cidr_lookup_table(
#' pgcon = con,
#' tbl_name = "amazon_cidrs",
#' drop = TRUE,
#' xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
#' )
#'
#' create_ip_source_table(
#' pgcon = con,
#' tbl_name = "weblog",
#' drop = TRUE,
#' xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
#' )
#'
#' find_ips_in_cidrs(
#' con, "weblog", "amazon_cidrs"
#' )
#'
#' }
find_ips_in_cidrs <- function(pgcon, ip_tbl, cidr_tbl,
ip_col = "ip", cidr_col = "cidr") {
stopifnot(inherits(con, "PostgreSQL"))
ip_tbl <- ip_tbl[1]
cidr_tbl <- cidr_tbl[1]
ip_col <- ip_col[1]
cidr_col <- cidr_col[1]
DBI::dbGetQuery(
con,
ac(gg("
SELECT
*
FROM {ip_tbl}, {cidr_tbl} WHERE {ip_col} <<= {cidr_col}
"))
) -> res
if (inherits(res, "data.frame")) {
class(res) <- c("tbl_df", "tbl", "data.frame")
}
res
}

42
R/macos-setup.R

@ -0,0 +1,42 @@
#' @name macos_postgresql_setup_with_ip4r
#' @title Setting up macOS PostgreSQL 12 with ip4r extension
#' @section Setup:
#' ```
#' $ brew uninstall postgresql
#' $ rm -rf /usr/local/var/postgres
#'
#' $ brew tap petere/postgresql
#' $ brew install petere/postgresql/postgresql@12
#' $ brew install petere/postgresql/postgresql-common
#' $ initdb DATA_PATH -E utf8
#' $ pg_ctl -D /Volumes/otg/postgres -l logfile start
#'
#' $ ps -ef | grep postgr
#'
#' $ pg_config
#'
#' $ createdb ${USER}
#'
#' $ psql
#' username=# \q
#'
#' $ cd /place/where/you/clone/stuff
#' $ git clone git@@github.com:RhodiumToad/ip4r.git
#' $ cd ip4r
#' $ make
#' $ sudo make install
#'
#' $ cd /place/where/you/clone/stuff
#' $ wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-12.01.0000.tar.gz
#' $ tar -xvzf psqlodbc-12.01.0000.tar.gz
#' $ cd psqlodbc-12.01.0000
#' $ ./configure
#' $ make -j 8
#' $ sudo make install
#' $ ls -l /usr/local/lib/psqlodbca.so
#'
#' $ createdb working
#' $ psql --command="CREATE EXTENSION ip4r;" working
#' $ psql --command="CREATE EXTENSION ip4r;" ${USER}
#' ```
NULL

14
R/pgcidr-package.R

@ -1,9 +1,15 @@
#' ...
#'
#' Perform IP Address in CIDR Lookups with PostgreSQL
#'
#' PostgreSQL has built-in support for IP address and CIDR types
#' but the ip4r <https://github.com/RhodiumToad/ip4r> extension is much faster.
#' Tools are provided to create CIDR lookup and IP address source tables and
#' perform IP address in CIDR queries. Documentation on how to setup macOS
#' with PostgreSQL and ip4r is also provided.
#'
#' @md
#' @name pgcidr
#' @keywords internal
#' @author Bob Rudis (bob@@rud.is)
#' @import httr
#' @importFrom jsonlite fromJSON
#' @importFrom glue glue
#' @importFrom readr write_csv
"_PACKAGE"

42
README.Rmd

@ -39,6 +39,48 @@ packageVersion("pgcidr")
```
```{r ex-01, eval=FALSE}
DBI::dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/psqlodbca.so",
Database = "working",
Host = "localhost"
) -> con
create_cidr_lookup_table(
pgcon = con,
tbl_name = "amazon_cidrs",
drop = TRUE,
xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)
create_ip_source_table(
pgcon = con,
tbl_name = "weblog",
drop = TRUE,
xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)
find_ips_in_cidrs(
con, "weblog", "amazon_cidrs"
)
## # A tibble: 83 x 3
## ip entity cidr
## <chr> <chr> <chr>
## 1 54.235.230.238 us-east-1 54.234.0.0/15
## 2 54.227.107.78 us-east-1 54.226.0.0/15
## 3 96.127.69.213 us-gov-west-1 96.127.0.0/17
## 4 3.82.223.254 us-east-1 3.80.0.0/12
## 5 3.83.153.45 us-east-1 3.80.0.0/12
## 6 54.160.105.136 us-east-1 54.160.0.0/13
## 7 54.225.41.245 us-east-1 54.224.0.0/15
## 8 3.87.18.119 us-east-1 3.80.0.0/12
## 9 54.91.31.71 us-east-1 54.88.0.0/14
## 10 54.90.66.13 us-east-1 54.88.0.0/14
## # … with 73 more rows
```
## pgcidr Metrics
```{r cloc, echo=FALSE}

117
README.md

@ -0,0 +1,117 @@
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Signed
by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr)
![Signed commit
%](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg)
[![Linux build
Status](https://travis-ci.org/hrbrmstr/pgcidr.svg?branch=master)](https://travis-ci.org/hrbrmstr/pgcidr)
![Minimal R
Version](https://img.shields.io/badge/R%3E%3D-3.5.0-blue.svg)
![License](https://img.shields.io/badge/License-MIT-blue.svg)
# pgcidr
Perform IP Address in CIDR Lookups with PostgreSQL and ip4r
## Description
PostgreSQL has built-in support for IP address and CIDR types but the
ip4r <https://github.com/RhodiumToad/ip4r> extension is much faster.
Tools are provided to create CIDR lookup and IP address source tables
and perform IP address in CIDR queries. Documentation on how to setup
macOS with PostgreSQL and ip4r is also provided.
## What’s Inside The Tin
The following functions are implemented:
- `create_cidr_lookup_table`: Creates a CIDR lookup table
- `create_ip_source_table`: Creates a IP address table
- `find_ips_in_cidrs`: Finds IPs in CIDR blocks
- `macos_postgresql_setup_with_ip4r`: Setting up macOS PostgreSQL 12
with ip4r extension
## Installation
``` r
remotes::install_git("https://git.rud.is/hrbrmstr/pgcidr.git")
# or
remotes::install_git("https://git.sr.ht/~hrbrmstr/pgcidr")
# or
remotes::install_gitlab("hrbrmstr/pgcidr")
# or
remotes::install_bitbucket("hrbrmstr/pgcidr")
# or
remotes::install_github("hrbrmstr/pgcidr")
```
NOTE: To use the ‘remotes’ install options you will need to have the
[{remotes} package](https://github.com/r-lib/remotes) installed.
## Usage
``` r
library(pgcidr)
# current version
packageVersion("pgcidr")
## [1] '0.1.0'
```
``` r
DBI::dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/psqlodbca.so",
Database = "working",
Host = "localhost"
) -> con
create_cidr_lookup_table(
pgcon = con,
tbl_name = "amazon_cidrs",
drop = TRUE,
xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)
create_ip_source_table(
pgcon = con,
tbl_name = "weblog",
drop = TRUE,
xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)
find_ips_in_cidrs(
con, "weblog", "amazon_cidrs"
)
## # A tibble: 83 x 3
## ip entity cidr
## <chr> <chr> <chr>
## 1 54.235.230.238 us-east-1 54.234.0.0/15
## 2 54.227.107.78 us-east-1 54.226.0.0/15
## 3 96.127.69.213 us-gov-west-1 96.127.0.0/17
## 4 3.82.223.254 us-east-1 3.80.0.0/12
## 5 3.83.153.45 us-east-1 3.80.0.0/12
## 6 54.160.105.136 us-east-1 54.160.0.0/13
## 7 54.225.41.245 us-east-1 54.224.0.0/15
## 8 3.87.18.119 us-east-1 3.80.0.0/12
## 9 54.91.31.71 us-east-1 54.88.0.0/14
## 10 54.90.66.13 us-east-1 54.88.0.0/14
## # … with 73 more rows
```
## pgcidr Metrics
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | --: |
| R | 7 | 0.88 | 75 | 0.72 | 37 | 0.65 | 177 | 0.8 |
| Rmd | 1 | 0.12 | 29 | 0.28 | 20 | 0.35 | 44 | 0.2 |
## Code of Conduct
Please note that this project is released with a Contributor Code of
Conduct. By participating in this project you agree to abide by its
terms.

1791
inst/extdat/amzn-cidrs.csv

File diff suppressed because it is too large

661
inst/extdat/weblog.csv

@ -0,0 +1,661 @@
ip_address
157.55.39.226
199.16.157.183
93.57.53.214
91.157.69.185
93.57.53.195
116.202.112.5
92.247.181.12
172.93.49.183
76.102.45.61
104.131.85.78
8.29.198.25
178.154.200.168
46.229.168.143
167.172.211.255
204.52.106.187
176.22.109.26
93.57.53.205
8.29.198.27
77.75.76.172
93.57.53.199
93.57.53.210
99.199.88.83
93.57.53.207
40.77.167.17
93.57.53.198
54.235.230.238
66.249.66.146
93.57.53.194
54.227.107.78
54.36.148.246
54.36.149.28
149.148.26.22
193.104.223.151
5.188.84.149
136.206.93.196
217.31.54.202
178.21.118.154
96.127.69.213
60.205.180.56
3.82.223.254
93.57.53.202
93.57.53.211
192.0.102.40
93.57.53.200
168.90.199.178
84.57.49.15
114.119.162.4
119.253.35.74
192.188.252.112
108.28.35.201
93.57.53.216
93.57.53.209
93.57.53.212
8.29.198.26
195.234.109.66
54.36.149.225
92.247.181.17
54.36.148.211
95.143.172.187
66.249.66.138
46.229.168.142
1.121.129.132
93.57.53.208
3.83.153.45
104.222.174.176
121.127.199.109
93.57.53.213
93.57.53.196
167.172.219.142
93.57.53.215
54.160.105.136
198.58.103.92
149.56.124.180
92.247.181.33
54.225.41.245
174.52.191.137
159.65.77.58
90.185.124.69
103.85.124.177
178.63.18.151
45.55.138.108
198.144.154.11
54.36.148.164
66.249.66.140
174.194.193.230
93.57.53.218
93.57.53.217
93.57.53.201
45.133.154.3
93.57.53.204
66.102.9.161
66.249.66.142
104.222.165.219
3.87.18.119
93.57.53.206
17.58.96.228
54.91.31.71
54.90.66.13
140.82.115.243
54.36.148.195
41.222.208.233
54.208.176.63
159.69.109.52
3.80.81.121
46.229.168.163
46.229.168.151
93.57.53.203
66.96.183.62
54.36.148.82
46.229.168.135
46.229.168.137
66.249.66.148
62.210.215.110
104.222.174.106
66.249.66.156
46.229.168.140
157.55.39.12
198.58.103.115
54.36.149.53
71.19.255.12
173.212.225.148
192.0.112.177
192.0.114.18
192.0.116.177
192.0.113.113
45.79.166.92
34.230.40.148
54.36.148.222
49.235.133.148
167.172.118.185
104.129.192.50
93.100.28.196
54.36.150.166
204.52.106.72
107.77.222.181
116.202.105.93
192.0.102.138
54.162.180.93
92.247.181.10
165.22.180.224
92.196.204.91
3.81.200.105
201.179.172.160
18.212.87.72
46.229.168.150
159.89.183.157
54.156.251.192
54.82.154.95
185.25.35.9
185.25.35.13
185.25.35.12
210.170.108.196
92.247.181.29
1.49.44.217
54.36.148.243
54.175.137.62
95.163.255.41
84.211.244.249
54.167.28.190
114.119.167.21
104.224.65.216
46.229.168.154
14.169.220.243
198.58.103.91
192.0.113.82
104.192.169.246
93.57.53.197
35.185.75.107
59.175.187.2
140.119.120.6
24.18.202.110
140.82.115.241
167.99.96.232
195.201.119.154
54.36.148.156
66.249.92.75
204.52.106.116
54.36.148.1
47.93.50.126
37.46.163.47
185.59.3.8
159.226.117.9
95.163.255.170
84.103.149.51
77.75.76.162
18.212.169.157
54.36.148.107
193.189.143.54
54.175.78.152
216.244.66.235
78.47.253.95
54.36.149.45
198.58.103.28
104.222.174.77
54.208.174.156
213.180.203.158
46.229.168.147
178.154.200.11
178.154.200.26
178.154.200.8
213.180.203.97
213.180.203.95
178.154.200.157
178.154.200.36
178.154.200.171
178.154.200.200
213.180.203.21
178.154.200.32
51.89.175.187
46.229.168.132
196.247.235.164
192.0.116.50
192.0.116.146
192.0.114.113
54.36.148.28
45.56.88.161
160.20.147.243
192.0.112.212
193.0.161.22
40.77.189.111
40.77.188.102
104.222.164.251
34.229.185.62
5.188.210.79
106.11.158.103
42.156.139.34
42.156.136.29
106.11.155.43
106.11.158.49
106.11.155.42
106.11.159.60
106.11.157.121
106.11.155.49
106.11.152.47
106.11.157.46
42.156.136.97
106.11.154.33
42.120.160.72
42.156.137.34
42.156.137.11
106.11.157.101
42.156.138.106
42.156.138.105
42.156.137.22
42.156.137.107
42.156.136.113
42.120.160.56
42.156.136.7
42.156.254.20
42.120.160.119
42.120.160.49
42.156.136.103
42.120.161.82
106.11.153.51
106.11.158.100
54.175.233.243
34.200.232.20
46.229.168.144
54.36.148.215
72.21.217.71
109.163.234.140
54.36.148.213
113.118.32.217
50.116.30.23
198.58.102.96
174.74.208.33
192.0.113.20
46.229.168.139
104.224.66.163
3.88.228.126
35.175.198.99
157.37.240.102
66.249.93.207
83.39.184.200
185.244.214.41
34.207.84.229
46.229.168.145
54.36.148.238
54.36.148.22
18.212.59.142
18.234.197.181
54.210.105.172
54.84.192.51
34.235.48.77
27.34.26.1
3.86.97.14
40.74.12.43
167.99.111.28
140.82.115.250
185.26.156.85
104.222.165.110
188.22.151.184
124.155.104.172
85.14.15.70
64.233.172.193
94.21.31.135
167.172.219.252
45.79.149.61
109.136.170.26
114.119.160.158
82.3.76.108
104.224.66.56
134.245.84.145
116.202.106.128
107.199.163.17
54.166.155.222
54.148.105.114
192.0.118.81
122.109.91.50
185.202.1.6
39.108.164.108
165.225.24.58
54.186.248.49
52.91.110.175
194.30.75.249
159.89.225.193
3.91.241.10
104.224.66.204
119.18.0.225
1.42.226.38
203.244.221.2
54.36.150.20
80.240.228.91
158.177.164.24
54.36.148.176
42.236.10.117
157.55.39.84
204.52.106.114
190.245.106.236
46.229.168.146
213.233.215.8
54.36.148.149
192.0.116.212
46.229.168.153
62.20.92.117
35.194.254.7
140.82.115.247
54.36.150.106
46.229.168.131
46.229.168.130
54.36.150.44
204.52.106.8
5.188.210.8
147.32.141.206
125.238.133.248
84.196.81.204
54.198.75.40
46.229.168.162
92.188.90.252
54.159.11.202
114.45.93.212
54.226.31.55
198.58.102.156
198.144.149.254
37.190.10.186
77.75.76.164
148.64.28.93
199.16.157.181
192.0.88.51
66.102.8.4
66.102.8.30
66.102.8.2
104.224.65.192
46.229.168.141
159.65.67.69
165.225.27.84
40.77.190.134
54.175.224.6
54.36.149.8
199.119.124.44
79.146.233.133
112.97.54.233
46.229.168.134
222.85.161.131
104.222.167.73
140.82.115.248
212.41.135.50
80.146.228.78
46.229.168.161
86.1.7.197
54.36.150.5
136.243.2.135
148.251.192.31
54.36.148.202
185.43.163.1
54.36.148.52
77.20.40.111
34.224.27.34
192.0.103.56
3.89.72.1
204.52.106.178
49.145.203.82
192.0.99.19
3.82.172.103
46.229.168.148
192.0.99.163
2.36.129.236
192.0.100.67
192.0.96.194
192.0.98.140
194.0.59.52
192.0.99.91
192.0.99.235
192.0.103.54
192.0.100.91
37.49.155.98
192.0.98.152
192.0.96.210
174.138.49.150
54.36.148.64
3.80.252.111
192.0.98.142
192.0.100.139
192.0.103.52
66.249.80.129
192.0.101.43
54.36.148.169
54.205.192.100
192.0.96.208
104.224.67.128
192.0.98.154
192.0.101.244
192.0.100.211
46.229.168.138
192.0.102.57
45.33.74.110
192.0.98.150
54.36.148.244
192.0.96.206
192.0.101.172
104.41.139.251
192.0.98.130
192.0.99.75
114.119.161.60
54.36.148.132
89.217.136.59
195.234.109.192
110.170.223.180
195.234.109.10
82.67.236.34
140.119.121.6
46.229.168.136
95.145.235.97
104.222.168.133
94.137.115.163
54.36.148.159
195.234.109.78
199.119.124.39
159.65.237.231
185.86.78.38
88.98.183.93
54.174.192.196
68.183.151.227
77.144.212.87
213.180.203.102
178.154.200.215
54.36.149.6
78.30.2.97
5.188.84.130
3.21.170.251
159.65.67.230
104.224.66.133
54.36.148.9
89.35.39.180
92.247.181.9
3.89.44.237
52.73.62.168
82.200.115.210
66.249.93.206
198.58.103.36
104.222.174.60
54.36.150.141
185.239.226.194
195.234.109.194
80.60.115.115
104.222.168.155
100.24.70.72
77.75.79.119
195.234.109.130
18.232.117.215
49.65.244.125
46.229.168.149
184.172.56.242
152.78.0.68
198.199.104.179
192.0.101.28
66.249.92.77
130.102.10.5
3.90.7.233
94.130.183.62
104.222.174.141
86.34.199.122
72.21.217.84
54.36.148.203
185.179.142.71
81.135.228.59
54.36.148.171
34.229.242.2
193.148.16.200
51.175.97.212
103.107.196.156
54.36.148.168
104.222.164.41
157.55.39.108
91.236.116.14
50.19.173.99
46.229.161.131
40.65.107.249
34.207.76.16
159.69.183.149
109.242.130.85
157.55.39.180
54.36.150.95
74.6.168.165
104.222.174.104
132.148.105.5
54.236.1.18
174.57.119.28
18.233.165.203
45.33.91.108
54.36.150.0
5.57.21.49
167.181.12.167
192.0.91.153
192.0.91.97
202.166.80.193
54.89.93.21
159.69.184.221
104.222.167.82
83.193.223.252
54.36.150.74
35.227.134.163
35.233.152.44
52.204.27.85
159.89.235.212
36.152.18.82
54.36.150.93
198.58.103.114
3.89.228.35
54.36.148.55
113.199.248.45
134.202.2.157
86.91.109.22
207.148.92.118
195.234.109.18
98.128.226.141
34.192.118.171
34.194.221.107
24.61.107.123
66.249.92.79
211.94.252.5
39.106.8.162
41.13.20.13
104.222.164.239
77.185.145.118
54.36.150.127
54.36.148.39
40.77.167.85
103.131.71.54
54.36.150.84
144.76.32.137
178.154.200.181
178.154.200.223
178.154.200.245
178.154.200.49
46.229.168.152
192.0.99.107
46.101.24.100
204.52.104.10
52.87.180.40
175.176.31.59
151.40.86.3
54.36.150.96
114.119.163.77
54.36.150.91
54.36.148.142
54.36.149.22
77.75.76.161
85.204.246.240
54.36.150.89
140.82.115.246
104.222.164.10
199.16.157.182
34.250.9.32
54.235.237.215
34.229.112.125
42.113.119.160
54.36.150.14
204.52.98.163
2.110.3.172
73.233.60.239
54.36.148.235
3.90.30.37
37.187.162.187
137.208.57.142
54.211.145.207
195.234.109.80
195.234.109.186
195.234.109.122
195.234.109.136
195.234.109.134
195.234.109.62
204.52.104.234
183.103.107.191
54.36.149.105
198.58.102.117
54.36.150.152
37.6.235.27
89.64.21.110
192.0.86.129
104.237.144.121
195.234.109.16
195.234.109.22
195.234.109.14
83.255.9.25
159.65.96.54
46.51.216.186
110.54.129.68
3.94.93.94
104.222.174.238
54.208.102.37
130.208.98.62
192.0.114.49
54.145.79.13
109.162.43.92
195.234.109.178
104.224.67.104
195.234.109.118
94.238.124.252
62.65.57.159
54.36.148.183
82.5.191.82
123.57.38.96
54.36.148.131
206.189.181.227
154.73.194.215
54.36.148.35
204.52.98.154
183.245.118.180
54.149.98.146
111.250.138.195
37.57.218.243
54.88.25.125
219.88.182.57
89.39.107.199
104.222.168.59
66.249.93.205
54.208.246.184
3.83.144.224
54.36.149.14
93.165.156.37
110.77.148.10
54.36.148.11
54.36.148.103
141.20.225.146
216.161.238.233
140.82.115.240
210.210.12.2
54.198.55.229
64.233.172.196
1 ip_address
2 157.55.39.226
3 199.16.157.183
4 93.57.53.214
5 91.157.69.185
6 93.57.53.195
7 116.202.112.5
8 92.247.181.12
9 172.93.49.183
10 76.102.45.61
11 104.131.85.78
12 8.29.198.25
13 178.154.200.168
14 46.229.168.143
15 167.172.211.255
16 204.52.106.187
17 176.22.109.26
18 93.57.53.205
19 8.29.198.27
20 77.75.76.172
21 93.57.53.199
22 93.57.53.210
23 99.199.88.83
24 93.57.53.207
25 40.77.167.17
26 93.57.53.198
27 54.235.230.238
28 66.249.66.146
29 93.57.53.194
30 54.227.107.78
31 54.36.148.246
32 54.36.149.28
33 149.148.26.22
34 193.104.223.151
35 5.188.84.149
36 136.206.93.196
37 217.31.54.202
38 178.21.118.154
39 96.127.69.213
40 60.205.180.56
41 3.82.223.254
42 93.57.53.202
43 93.57.53.211
44 192.0.102.40
45 93.57.53.200
46 168.90.199.178
47 84.57.49.15
48 114.119.162.4
49 119.253.35.74
50 192.188.252.112
51 108.28.35.201
52 93.57.53.216
53 93.57.53.209
54 93.57.53.212
55 8.29.198.26
56 195.234.109.66
57 54.36.149.225
58 92.247.181.17
59 54.36.148.211
60 95.143.172.187
61 66.249.66.138
62 46.229.168.142
63 1.121.129.132
64 93.57.53.208
65 3.83.153.45
66 104.222.174.176
67 121.127.199.109
68 93.57.53.213
69 93.57.53.196
70 167.172.219.142
71 93.57.53.215
72 54.160.105.136
73 198.58.103.92
74 149.56.124.180
75 92.247.181.33
76 54.225.41.245
77 174.52.191.137
78 159.65.77.58
79 90.185.124.69
80 103.85.124.177
81 178.63.18.151
82 45.55.138.108
83 198.144.154.11
84 54.36.148.164
85 66.249.66.140
86 174.194.193.230
87 93.57.53.218
88 93.57.53.217
89 93.57.53.201
90 45.133.154.3
91 93.57.53.204
92 66.102.9.161
93 66.249.66.142
94 104.222.165.219
95 3.87.18.119
96 93.57.53.206
97 17.58.96.228
98 54.91.31.71
99 54.90.66.13
100 140.82.115.243
101 54.36.148.195
102 41.222.208.233
103 54.208.176.63
104 159.69.109.52
105 3.80.81.121
106 46.229.168.163
107 46.229.168.151
108 93.57.53.203
109 66.96.183.62
110 54.36.148.82
111 46.229.168.135
112 46.229.168.137
113 66.249.66.148
114 62.210.215.110
115 104.222.174.106
116 66.249.66.156
117 46.229.168.140
118 157.55.39.12
119 198.58.103.115
120 54.36.149.53
121 71.19.255.12
122 173.212.225.148
123 192.0.112.177
124 192.0.114.18
125 192.0.116.177
126 192.0.113.113
127 45.79.166.92
128 34.230.40.148
129 54.36.148.222
130 49.235.133.148
131 167.172.118.185
132 104.129.192.50
133 93.100.28.196
134 54.36.150.166
135 204.52.106.72
136 107.77.222.181
137 116.202.105.93
138 192.0.102.138
139 54.162.180.93
140 92.247.181.10
141 165.22.180.224
142 92.196.204.91
143 3.81.200.105
144 201.179.172.160
145 18.212.87.72
146 46.229.168.150
147 159.89.183.157
148 54.156.251.192
149 54.82.154.95
150 185.25.35.9
151 185.25.35.13
152 185.25.35.12
153 210.170.108.196
154 92.247.181.29
155 1.49.44.217
156 54.36.148.243
157 54.175.137.62
158 95.163.255.41
159 84.211.244.249
160 54.167.28.190
161 114.119.167.21
162 104.224.65.216
163 46.229.168.154
164 14.169.220.243
165 198.58.103.91
166 192.0.113.82
167 104.192.169.246
168 93.57.53.197
169 35.185.75.107
170 59.175.187.2
171 140.119.120.6
172 24.18.202.110
173 140.82.115.241
174 167.99.96.232
175 195.201.119.154
176 54.36.148.156
177 66.249.92.75
178 204.52.106.116
179 54.36.148.1
180 47.93.50.126
181 37.46.163.47
182 185.59.3.8
183 159.226.117.9
184 95.163.255.170
185 84.103.149.51
186 77.75.76.162
187 18.212.169.157
188 54.36.148.107
189 193.189.143.54
190 54.175.78.152
191 216.244.66.235
192 78.47.253.95
193 54.36.149.45
194 198.58.103.28
195 104.222.174.77
196 54.208.174.156
197 213.180.203.158
198 46.229.168.147
199 178.154.200.11
200 178.154.200.26
201 178.154.200.8
202 213.180.203.97
203 213.180.203.95
204 178.154.200.157
205 178.154.200.36
206 178.154.200.171
207 178.154.200.200
208 213.180.203.21
209 178.154.200.32
210 51.89.175.187
211 46.229.168.132
212 196.247.235.164
213 192.0.116.50
214 192.0.116.146
215 192.0.114.113
216 54.36.148.28
217 45.56.88.161
218 160.20.147.243
219 192.0.112.212
220 193.0.161.22
221 40.77.189.111
222 40.77.188.102
223 104.222.164.251
224 34.229.185.62
225 5.188.210.79
226 106.11.158.103
227 42.156.139.34
228 42.156.136.29
229 106.11.155.43
230 106.11.158.49
231 106.11.155.42
232 106.11.159.60
233 106.11.157.121
234 106.11.155.49
235 106.11.152.47
236 106.11.157.46
237 42.156.136.97
238 106.11.154.33
239 42.120.160.72
240 42.156.137.34
241 42.156.137.11
242 106.11.157.101
243 42.156.138.106
244 42.156.138.105
245 42.156.137.22
246 42.156.137.107
247 42.156.136.113
248 42.120.160.56
249 42.156.136.7
250 42.156.254.20
251 42.120.160.119
252 42.120.160.49
253 42.156.136.103
254 42.120.161.82
255 106.11.153.51
256 106.11.158.100
257 54.175.233.243
258 34.200.232.20
259 46.229.168.144
260 54.36.148.215
261 72.21.217.71
262 109.163.234.140
263 54.36.148.213
264 113.118.32.217
265 50.116.30.23
266 198.58.102.96
267 174.74.208.33
268 192.0.113.20
269 46.229.168.139
270 104.224.66.163
271 3.88.228.126
272 35.175.198.99
273 157.37.240.102
274 66.249.93.207
275 83.39.184.200
276 185.244.214.41
277 34.207.84.229
278 46.229.168.145
279 54.36.148.238
280 54.36.148.22
281 18.212.59.142
282 18.234.197.181
283 54.210.105.172
284 54.84.192.51
285 34.235.48.77
286 27.34.26.1
287 3.86.97.14
288 40.74.12.43
289 167.99.111.28
290 140.82.115.250
291 185.26.156.85
292 104.222.165.110
293 188.22.151.184
294 124.155.104.172
295 85.14.15.70
296 64.233.172.193
297 94.21.31.135
298 167.172.219.252
299 45.79.149.61
300 109.136.170.26
301 114.119.160.158
302 82.3.76.108
303 104.224.66.56
304 134.245.84.145
305 116.202.106.128
306 107.199.163.17
307 54.166.155.222
308 54.148.105.114
309 192.0.118.81
310 122.109.91.50
311 185.202.1.6
312 39.108.164.108
313 165.225.24.58
314 54.186.248.49
315 52.91.110.175
316 194.30.75.249
317 159.89.225.193
318 3.91.241.10
319 104.224.66.204
320 119.18.0.225
321 1.42.226.38
322 203.244.221.2
323 54.36.150.20
324 80.240.228.91
325 158.177.164.24
326 54.36.148.176
327 42.236.10.117
328 157.55.39.84
329 204.52.106.114
330 190.245.106.236
331 46.229.168.146
332 213.233.215.8
333 54.36.148.149
334 192.0.116.212
335 46.229.168.153
336 62.20.92.117
337 35.194.254.7
338 140.82.115.247
339 54.36.150.106
340 46.229.168.131
341 46.229.168.130
342 54.36.150.44
343 204.52.106.8
344 5.188.210.8
345 147.32.141.206
346 125.238.133.248
347 84.196.81.204
348 54.198.75.40
349 46.229.168.162
350 92.188.90.252
351 54.159.11.202
352 114.45.93.212
353 54.226.31.55
354 198.58.102.156
355 198.144.149.254
356 37.190.10.186
357 77.75.76.164
358 148.64.28.93
359 199.16.157.181
360 192.0.88.51
361 66.102.8.4
362 66.102.8.30
363 66.102.8.2
364 104.224.65.192
365 46.229.168.141
366 159.65.67.69
367 165.225.27.84
368 40.77.190.134
369 54.175.224.6
370 54.36.149.8
371 199.119.124.44
372 79.146.233.133
373 112.97.54.233
374 46.229.168.134
375 222.85.161.131
376 104.222.167.73
377 140.82.115.248
378 212.41.135.50
379 80.146.228.78
380 46.229.168.161
381 86.1.7.197
382 54.36.150.5
383 136.243.2.135
384 148.251.192.31
385 54.36.148.202
386 185.43.163.1
387 54.36.148.52
388 77.20.40.111
389 34.224.27.34
390 192.0.103.56
391 3.89.72.1
392 204.52.106.178
393 49.145.203.82
394 192.0.99.19
395 3.82.172.103
396 46.229.168.148
397 192.0.99.163
398 2.36.129.236
399 192.0.100.67
400 192.0.96.194
401 192.0.98.140
402 194.0.59.52
403 192.0.99.91
404 192.0.99.235
405 192.0.103.54
406 192.0.100.91
407 37.49.155.98
408 192.0.98.152
409 192.0.96.210
410 174.138.49.150
411 54.36.148.64
412 3.80.252.111
413 192.0.98.142
414 192.0.100.139
415 192.0.103.52
416 66.249.80.129
417 192.0.101.43
418 54.36.148.169
419 54.205.192.100
420 192.0.96.208
421 104.224.67.128
422 192.0.98.154
423 192.0.101.244
424 192.0.100.211
425 46.229.168.138
426 192.0.102.57
427 45.33.74.110
428 192.0.98.150
429 54.36.148.244
430 192.0.96.206
431 192.0.101.172
432 104.41.139.251
433 192.0.98.130
434 192.0.99.75
435 114.119.161.60
436 54.36.148.132
437 89.217.136.59
438 195.234.109.192
439 110.170.223.180
440 195.234.109.10
441 82.67.236.34
442 140.119.121.6
443 46.229.168.136
444 95.145.235.97
445 104.222.168.133
446 94.137.115.163
447 54.36.148.159
448 195.234.109.78
449 199.119.124.39
450 159.65.237.231
451 185.86.78.38
452 88.98.183.93
453 54.174.192.196
454 68.183.151.227
455 77.144.212.87
456 213.180.203.102
457 178.154.200.215
458 54.36.149.6
459 78.30.2.97
460 5.188.84.130
461 3.21.170.251
462 159.65.67.230
463 104.224.66.133
464 54.36.148.9
465 89.35.39.180
466 92.247.181.9
467 3.89.44.237
468 52.73.62.168
469 82.200.115.210
470 66.249.93.206
471 198.58.103.36
472 104.222.174.60
473 54.36.150.141
474 185.239.226.194
475 195.234.109.194
476 80.60.115.115
477 104.222.168.155
478 100.24.70.72
479 77.75.79.119
480 195.234.109.130
481 18.232.117.215
482 49.65.244.125
483 46.229.168.149
484 184.172.56.242
485 152.78.0.68
486 198.199.104.179
487 192.0.101.28
488 66.249.92.77
489 130.102.10.5
490 3.90.7.233
491 94.130.183.62
492 104.222.174.141
493 86.34.199.122
494 72.21.217.84
495 54.36.148.203
496 185.179.142.71
497 81.135.228.59
498 54.36.148.171
499 34.229.242.2
500 193.148.16.200
501 51.175.97.212
502 103.107.196.156
503 54.36.148.168
504 104.222.164.41
505 157.55.39.108
506 91.236.116.14
507 50.19.173.99
508 46.229.161.131
509 40.65.107.249
510 34.207.76.16
511 159.69.183.149
512 109.242.130.85
513 157.55.39.180
514 54.36.150.95
515 74.6.168.165
516 104.222.174.104
517 132.148.105.5
518 54.236.1.18
519 174.57.119.28
520 18.233.165.203
521 45.33.91.108
522 54.36.150.0
523 5.57.21.49
524 167.181.12.167
525 192.0.91.153
526 192.0.91.97
527 202.166.80.193
528 54.89.93.21
529 159.69.184.221
530 104.222.167.82
531 83.193.223.252
532 54.36.150.74
533 35.227.134.163
534 35.233.152.44
535 52.204.27.85
536 159.89.235.212
537 36.152.18.82
538 54.36.150.93
539 198.58.103.114
540 3.89.228.35
541 54.36.148.55
542 113.199.248.45
543 134.202.2.157
544 86.91.109.22
545 207.148.92.118
546 195.234.109.18
547 98.128.226.141
548 34.192.118.171
549 34.194.221.107
550 24.61.107.123
551 66.249.92.79
552 211.94.252.5
553 39.106.8.162
554 41.13.20.13
555 104.222.164.239
556 77.185.145.118
557 54.36.150.127
558 54.36.148.39
559 40.77.167.85
560 103.131.71.54
561 54.36.150.84
562 144.76.32.137
563 178.154.200.181
564 178.154.200.223
565 178.154.200.245
566 178.154.200.49
567 46.229.168.152
568 192.0.99.107
569 46.101.24.100
570 204.52.104.10
571 52.87.180.40
572 175.176.31.59
573 151.40.86.3
574 54.36.150.96
575 114.119.163.77
576 54.36.150.91
577 54.36.148.142
578 54.36.149.22
579 77.75.76.161
580 85.204.246.240
581 54.36.150.89
582 140.82.115.246
583 104.222.164.10
584 199.16.157.182
585 34.250.9.32
586 54.235.237.215
587 34.229.112.125
588 42.113.119.160
589 54.36.150.14
590 204.52.98.163
591 2.110.3.172
592 73.233.60.239
593 54.36.148.235
594 3.90.30.37
595 37.187.162.187
596 137.208.57.142
597 54.211.145.207
598 195.234.109.80
599 195.234.109.186
600 195.234.109.122
601 195.234.109.136
602 195.234.109.134
603 195.234.109.62
604 204.52.104.234
605 183.103.107.191
606 54.36.149.105
607 198.58.102.117
608 54.36.150.152
609 37.6.235.27
610 89.64.21.110
611 192.0.86.129
612 104.237.144.121
613 195.234.109.16
614 195.234.109.22
615 195.234.109.14
616 83.255.9.25
617 159.65.96.54
618 46.51.216.186
619 110.54.129.68
620 3.94.93.94
621 104.222.174.238
622 54.208.102.37
623 130.208.98.62
624 192.0.114.49
625 54.145.79.13
626 109.162.43.92
627 195.234.109.178
628 104.224.67.104
629 195.234.109.118
630 94.238.124.252
631 62.65.57.159
632 54.36.148.183
633 82.5.191.82
634 123.57.38.96
635 54.36.148.131
636 206.189.181.227
637 154.73.194.215
638 54.36.148.35
639 204.52.98.154
640 183.245.118.180
641 54.149.98.146
642 111.250.138.195
643 37.57.218.243
644 54.88.25.125
645 219.88.182.57
646 89.39.107.199
647 104.222.168.59
648 66.249.93.205
649 54.208.246.184
650 3.83.144.224
651 54.36.149.14
652 93.165.156.37
653 110.77.148.10
654 54.36.148.11
655 54.36.148.103
656 141.20.225.146
657 216.161.238.233
658 140.82.115.240
659 210.210.12.2
660 54.198.55.229
661 64.233.172.196

66
man/create_cidr_lookup_table.Rd

@ -0,0 +1,66 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/create-cidr-tbl.R
\name{create_cidr_lookup_table}
\alias{create_cidr_lookup_table}
\title{Creates a CIDR lookup table}
\usage{
create_cidr_lookup_table(
pgcon,
tbl_name,
drop = FALSE,
xdf,
entity_col = "entity",
cidr_col = "cidr"
)
}
\arguments{
\item{pgcon}{a PostgreSQL DBI connection}
\item{tbl_name}{name of the CIDR table (valid PG table name syntax)}
\item{drop}{drop existing CIDR table if it has the same name? Defaults to \code{FALSE}.}
\item{xdf}{Data frame to use to populate the table or a path to a CSV file.
If a path it will be \code{\link[=path.expand]{path.expand()}}ed.}
\item{entity_col}{Name of the column that holds the entity reference name for the CIDR}
\item{cidr_col}{Name of the column that holds the CIDR block}
}
\description{
The columns named in \code{entity_col} and \code{cidr_col} \emph{must exist} in the
data frame or CSV file. All \verb{_name}s must be valid PostgreSQL syntax for
said names. Setting \code{drop=TRUE} is \emph{destructive}.\cr
\cr
NOTE that \code{cidr_col} is a primary key. Thus duplicate CIDRs are not allowed
and it's up to you to ensure that.
}
\examples{
\dontrun{
DBI::dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/psqlodbca.so",
Database = "working",
Host = "localhost"
) -> con
create_cidr_lookup_table(
pgcon = con,
tbl_name = "amazon_cidrs",
drop = TRUE,
xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)
create_ip_source_table(
pgcon = con,
tbl_name = "weblog",
drop = TRUE,
xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)
find_ips_in_cidrs(
con, "weblog", "amazon_cidrs"
)
}
}

52
man/create_ip_source_table.Rd

@ -0,0 +1,52 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/create-ip-tbl.R
\name{create_ip_source_table}
\alias{create_ip_source_table}
\title{Creates a IP address table}
\usage{
create_ip_source_table(pgcon, tbl_name, drop = FALSE, xdf, ip_col = "ip")
}
\arguments{
\item{pgcon}{a PostgreSQL DBI connection}
\item{tbl_name}{name of the IP table (valid PG table name syntax)}
\item{drop}{drop existing IP table if it has the same name? Defaults to \code{FALSE}.}
\item{xdf}{Data frame to use to populate the table or a path to a CSV file.
If a path it will be \code{\link[=path.expand]{path.expand()}}ed.}
\item{ip_col}{Name of the column that holds the IP addresses}
}
\description{
The column named in \code{ip_col} \verb{*must exist* in the data frame or CSV file. All}_name\verb{s must be valid PostgreSQL syntax for said names. Setting }drop=TRUE` is \emph{destructive}.
}
\examples{
\dontrun{
DBI::dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/psqlodbca.so",
Database = "working",
Host = "localhost"
) -> con
create_cidr_lookup_table(
pgcon = con,
tbl_name = "amazon_cidrs",
drop = TRUE,
xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)
create_ip_source_table(
pgcon = con,
tbl_name = "weblog",
drop = TRUE,
xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)
find_ips_in_cidrs(
con, "weblog", "amazon_cidrs"
)
}
}

52
man/find_ips_in_cidrs.Rd

@ -0,0 +1,52 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/find-ips-in-cidrs.R
\name{find_ips_in_cidrs}
\alias{find_ips_in_cidrs}
\title{Finds IPs in CIDR blocks}
\usage{
find_ips_in_cidrs(pgcon, ip_tbl, cidr_tbl, ip_col = "ip", cidr_col = "cidr")
}
\arguments{
\item{pgcon}{a PostgreSQL DBI connection}
\item{ip_tbl}{name of the IP table (valid PG table name syntax)}
\item{cidr_tbl}{name of the CIDR table (valid PG table name syntax)}
\item{ip_col}{Name of the column that holds the IP addresses in \code{ip_tbl}}
\item{cidr_col}{Name of the column that holds the CIDR block in \code{cidr_tbl}}
}
\description{
After you use \code{\link[=create_cidr_lookup_table]{create_cidr_lookup_table()}} and \code{\link[=create_ip_source_table]{create_ip_source_table()}}
use this function to do the lookup.
}
\examples{
\dontrun{
DBI::dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/psqlodbca.so",
Database = "working",
Host = "localhost"
) -> con
create_cidr_lookup_table(
pgcon = con,
tbl_name = "amazon_cidrs",
drop = TRUE,
xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)
create_ip_source_table(
pgcon = con,
tbl_name = "weblog",
drop = TRUE,
xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)
find_ips_in_cidrs(
con, "weblog", "amazon_cidrs"
)
}
}

48
man/macos_postgresql_setup_with_ip4r.Rd

@ -0,0 +1,48 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/macos-setup.R
\name{macos_postgresql_setup_with_ip4r}
\alias{macos_postgresql_setup_with_ip4r}
\title{Setting up macOS PostgreSQL 12 with ip4r extension}
\description{
Setting up macOS PostgreSQL 12 with ip4r extension
}
\section{Setup}{
\preformatted{$ brew uninstall postgresql
$ rm -rf /usr/local/var/postgres
$ brew tap petere/postgresql
$ brew install petere/postgresql/postgresql@12
$ brew install petere/postgresql/postgresql-common
$ initdb DATA_PATH -E utf8
$ pg_ctl -D /Volumes/otg/postgres -l logfile start
$ ps -ef | grep postgr
$ pg_config
$ createdb $\{USER\}
$ psql
username=# \\q
$ cd /place/where/you/clone/stuff
$ git clone git@github.com:RhodiumToad/ip4r.git
$ cd ip4r
$ make
$ sudo make install
$ cd /place/where/you/clone/stuff
$ wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-12.01.0000.tar.gz
$ tar -xvzf psqlodbc-12.01.0000.tar.gz
$ cd psqlodbc-12.01.0000
$ ./configure
$ make -j 8
$ sudo make install
$ ls -l /usr/local/lib/psqlodbca.so
$ createdb working
$ psql --command="CREATE EXTENSION ip4r;" working
$ psql --command="CREATE EXTENSION ip4r;" $\{USER\}
}
}

8
man/pgcidr.Rd

@ -4,9 +4,13 @@
\name{pgcidr}
\alias{pgcidr}
\alias{pgcidr-package}
\title{...}
\title{Perform IP Address in CIDR Lookups with PostgreSQL}
\description{
A good description goes here otherwise CRAN checks fail.
PostgreSQL has built-in support for IP address and CIDR types
but the ip4r \url{https://github.com/RhodiumToad/ip4r} extension is much faster.
Tools are provided to create CIDR lookup and IP address source tables and
perform IP address in CIDR queries. Documentation on how to setup macOS
with PostgreSQL and ip4r is also provided.
}
\seealso{
Useful links:

Loading…
Cancel
Save