find_ips_in_cidrs: Finds IPs in CIDR blocks

Description Usage Arguments Examples

View source: R/find-ips-in-cidrs.R

Description

After you use create_cidr_lookup_table() and create_ip_source_table() use this function to do the lookup.

Usage

1
find_ips_in_cidrs(pgcon, ip_tbl, cidr_tbl, ip_col = "ip", cidr_col = "cidr")

Arguments

pgcon

a PostgreSQL DBI connection

ip_tbl

name of the IP table (valid PG table name syntax)

cidr_tbl

name of the CIDR table (valid PG table name syntax)

ip_col

Name of the column that holds the IP addresses in ip_tbl

cidr_col

Name of the column that holds the CIDR block in cidr_tbl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
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"
)


## End(Not run)

hrbrmstr/pgcidr documentation built on Jan. 1, 2021, 3:20 a.m.