Browse Source

removed dplyr, purrr & tibble dependencies

tags/v0.3.1
boB Rudis 2 years ago
parent
commit
ed7c02365a
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
11 changed files with 404 additions and 155 deletions
  1. +12
    -12
      DESCRIPTION
  2. +0
    -9
      NAMESPACE
  3. +4
    -0
      NEWS.md
  4. +0
    -3
      R/gdns-package.r
  5. +6
    -6
      R/spf.r
  6. +132
    -0
      R/utils-mappers.R
  7. +90
    -0
      R/utils-safely.R
  8. +10
    -6
      R/zgdns.r
  9. +148
    -117
      README.md
  10. +1
    -1
      man/bulk_query.Rd
  11. +1
    -1
      man/query.Rd

+ 12
- 12
DESCRIPTION View File

@@ -1,13 +1,16 @@
Package: gdns
Title: Tools to Work with Google DNS Over HTTPS API
Title: Tools to Work with Google's 'DNS-over-HTTPS' ('DoH') 'API'
Version: 0.2.1
Authors@R: c(person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")))
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640"))
)
Maintainer: Bob Rudis <bob@rud.is>
Description: To address the problem of insecurity of UDP-based DNS requests,
Google Public DNS offers DNS resolution over an encrypted HTTPS
connection. DNS-over-HTTPS greatly enhances privacy and security
between a client and a recursive resolver, and complements DNSSEC
to provide end-to-end authenticated DNS lookups. Functions that enable
Description: To address the problem of insecurity of 'UDP'-based 'DNS' requests,
'Google Public DNS' offers 'DNS' resolution over an encrypted 'HTTPS'
connection. 'DNS-over-HTTPS' greatly enhances privacy and security
between a client and a recursive resolver, and complements 'DNSSEC'
to provide end-to-end authenticated 'DNS' lookups. Functions that enable
querying individual requests that bulk requests that return detailed
responses and bulk requests are both provided. Support for reverse
lookups is also provided. See <https://developers.google.com/speed/public-dns/docs/dns-over-https>
@@ -22,8 +25,5 @@ Suggests:
Imports:
httr,
jsonlite,
purrr,
stringi,
tibble,
dplyr
RoxygenNote: 6.0.1
stringi
RoxygenNote: 6.0.1.9000

+ 0
- 9
NAMESPACE View File

@@ -13,19 +13,10 @@ export(spf_ipv6s)
export(spf_ptrs)
export(split_spf)
import(httr)
importFrom(dplyr,as_data_frame)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(jsonlite,fromJSON)
importFrom(purrr,"%>%")
importFrom(purrr,"%||%")
importFrom(purrr,map)
importFrom(purrr,map_df)
importFrom(purrr,safely)
importFrom(stringi,stri_detect_fixed)
importFrom(stringi,stri_enc_toutf8)
importFrom(stringi,stri_replace_all_regex)
importFrom(stringi,stri_split_fixed)
importFrom(stringi,stri_split_regex)
importFrom(stringi,stri_trim)
importFrom(tibble,data_frame)

+ 4
- 0
NEWS.md View File

@@ -1,3 +1,7 @@
# gdns 0.2.2

* removed purrr, dplyr and tibble dependencies

# gdns 0.2.1

* Fix CRAN checks due to purrr insanity


+ 0
- 3
R/gdns-package.r View File

@@ -25,7 +25,4 @@
#' stri_replace_all_regex stri_enc_toutf8
#' stri_detect_fixed
#' @importFrom jsonlite fromJSON
#' @importFrom tibble data_frame
#' @importFrom purrr safely map map_df %||% %>%
#' @importFrom dplyr bind_rows bind_cols as_data_frame
NULL

+ 6
- 6
R/spf.r View File

@@ -8,7 +8,7 @@
#' @param spf_rec a character vector of DNS TXT records
#' @export
split_spf <- function(spf_rec) {
purrr::map(spf_rec, .split_spf)
map(spf_rec, .split_spf)
}

.split_spf <- function(spf_rec) {
@@ -73,7 +73,7 @@ passes_all <- function(spf_rec) {
#' @param spf_rec a character vector of DNS TXT records
#' @export
spf_ipv4s <- function(spf_rec) {
purrr::map(split_spf(spf_rec), function(x) {
map(split_spf(spf_rec), function(x) {
stringi::stri_replace_all_regex(grep("ip4", x, value=TRUE), "^ip4:", "")
})
}
@@ -81,7 +81,7 @@ spf_ipv4s <- function(spf_rec) {
#' @rdname spf_ipv4s
#' @export
spf_ipv6s <- function(spf_rec) {
purrr::map(split_spf(spf_rec), function(x) {
map(split_spf(spf_rec), function(x) {
stringi::stri_replace_all_regex(grep("ip6", x, value=TRUE), "^ip6:", "")
})
}
@@ -89,7 +89,7 @@ spf_ipv6s <- function(spf_rec) {
#' @rdname spf_ipv4s
#' @export
spf_includes <- function(spf_rec) {
purrr::map(split_spf(spf_rec), function(x) {
map(split_spf(spf_rec), function(x) {
stringi::stri_replace_all_regex(grep("include", x, value=TRUE), "^include:", "")
})
}
@@ -97,7 +97,7 @@ spf_includes <- function(spf_rec) {
#' @rdname spf_ipv4s
#' @export
spf_ptrs <- function(spf_rec) {
purrr::map(split_spf(spf_rec), function(x) {
map(split_spf(spf_rec), function(x) {
stringi::stri_replace_all_regex(grep("ptr", x, value=TRUE), "^ptr[:]", "")
})
}
@@ -105,7 +105,7 @@ spf_ptrs <- function(spf_rec) {
#' @rdname spf_ipv4s
#' @export
spf_exists <- function(spf_rec) {
purrr::map(split_spf(spf_rec), function(x) {
map(split_spf(spf_rec), function(x) {
stringi::stri_replace_all_regex(grep("exists", x, value=TRUE), "^exists:", "")
})
}

+ 132
- 0
R/utils-mappers.R View File

@@ -0,0 +1,132 @@
# NOTE these aren't 100% equivalent to the purrr mappers but cover very common use-cases
#
# NOTE formula function (e.g. ~{}) are 100% supported

map <- function(.x, .f, ...) {

if (inherits(.f, "formula")) {
.body <- dimnames(attr(terms(.f), "factors"))[[1]]
.f <- function(.x, . = .x) {}
body(.f) <- as.expression(parse(text=.body))
}

if (inherits(.f, "function")) {
lapply(.x, .f, ...)
} else if (is.numeric(.f)) {
lapply(.x, `[`, .f)
}

}

map2 <- function(.x, .y, .f, ...) {

if (inherits(.f, "formula")) {
.body <- dimnames(attr(terms(.f), "factors"))[[1]]
.f <- function(.x, .y, . = .x) {}
body(.f) <- as.expression(parse(text=.body))
}

if (inherits(.f, "function")) {
mapply(.f, .x, .y, ..., SIMPLIFY=FALSE, USE.NAMES=FALSE)
}

}

map_chr <- function(.x, .f, ...) {
as.character(unlist(map(.x, .f, ...), use.names = FALSE))
}

map2_chr <- function(.x, .y, .f, ...) {
as.character(unlist(map2(.x, .y, .f, ...), use.names = FALSE))
}

map_lgl <- function(.x, .f, ...) {
as.logical(unlist(map(.x, .f, ...), use.names = FALSE))
}

map2_lgl <- function(.x, .y, .f, ...) {
as.logical(unlist(map2(.x, .y, .f, ...), use.names = FALSE))
}

map_dbl <- function(.x, .f, ...) {
as.double(unlist(map(.x, .f, ...), use.names = FALSE))
}

map2_dbl <- function(.x, .y, .f, ...) {
as.double(unlist(map2(.x, .y, .f, ...), use.names = FALSE))
}

map_int <- function(.x, .f, ...) {
as.integer(unlist(map(.x, .f, ...), use.names = FALSE))
}

map2_int <- function(.x, .y, .f, ...) {
as.integer(unlist(map2(.x, .y, .f, ...), use.names = FALSE))
}


map_df <- function(.x, .f, ..., .id=NULL) {

res <- map(.x, .f, ...)
out <- bind_rows(res, .id=.id)
out

}

map2_df <- function(.x, .y, .f, ..., .id=NULL) {

res <- map(.x, .y, .f, ...)
out <- bind_rows(res, .id = .id)
out

}

# this has limitations and is more like 75% of dplyr::bind_rows()
# this is also orders of magnitude slower than dplyr::bind_rows()
bind_rows <- function(..., .id = NULL) {

res <- list(...)

if (length(res) == 1) res <- res[[1]]

cols <- unique(unlist(lapply(res, names), use.names = FALSE))

if (!is.null(.id)) {
inthere <- cols[.id %in% cols]
if (length(inthere) > 0) {
.id <- make.unique(c(inthere, .id))[2]
}
}

id_vals <- if (is.null(names(res))) 1:length(res) else names(res)

saf <- default.stringsAsFactors()
options(stringsAsFactors = FALSE)
on.exit(options(stringsAsFactors = saf))

idx <- 1
do.call(
rbind.data.frame,
lapply(res, function(.x) {
x_names <- names(.x)
moar_names <- setdiff(cols, x_names)
if (length(moar_names) > 0) {
for (i in 1:length(moar_names)) {
.x[[moar_names[i]]] <- rep(NA, length(.x[[1]]))
}
}
if (!is.null(.id)) {
.x[[.id]] <- id_vals[idx]
idx <<- idx + 1
}
.x
})
) -> out

rownames(out) <- NULL

class(out) <- c("tbl_df", "tbl", "data.frame")

out

}

+ 90
- 0
R/utils-safely.R View File

@@ -0,0 +1,90 @@
# Less cool counterparts to purrr's side-effect capture-rs
#
# Most of the helper functions are 100% from output.R in purrr repo
#
# @param quiet Hide errors (`TRUE`, the default), or display them
# as they occur?
# @param otherwise Default value to use when an error occurs.
#
# @return `safely`: wrapped function instead returns a list with
# components `result` and `error`. One value is always `NULL`.
#
# `quietly`: wrapped function instead returns a list with components
# `result`, `output`, `messages` and `warnings`.
#
# `possibly`: wrapped function uses a default value (`otherwise`)
# whenever an error occurs.
safely <- function(.f, otherwise = NULL, quiet = TRUE) {
function(...) capture_error(.f(...), otherwise, quiet)
}

quietly <- function(.f) {
function(...) capture_output(.f(...))
}

possibly <- function(.f, otherwise, quiet = TRUE) {
force(otherwise)
function(...) {
tryCatch(.f(...),
error = function(e) {
if (!quiet)
message("Error: ", e$message)
otherwise
},
interrupt = function(e) {
stop("Terminated by user", call. = FALSE)
}
)
}
}

capture_error <- function(code, otherwise = NULL, quiet = TRUE) {
tryCatch(
list(result = code, error = NULL),
error = function(e) {
if (!quiet)
message("Error: ", e$message)

list(result = otherwise, error = e)
},
interrupt = function(e) {
stop("Terminated by user", call. = FALSE)
}
)
}

capture_output <- function(code) {
warnings <- character()
wHandler <- function(w) {
warnings <<- c(warnings, w$message)
invokeRestart("muffleWarning")
}

messages <- character()
mHandler <- function(m) {
messages <<- c(messages, m$message)
invokeRestart("muffleMessage")
}

temp <- file()
sink(temp)
on.exit({
sink()
close(temp)
})

result <- withCallingHandlers(
code,
warning = wHandler,
message = mHandler
)

output <- paste0(readLines(temp, warn = FALSE), collapse = "\n")

list(
result = result,
output = output,
warnings = warnings,
messages = messages
)
}

R/gdns.r → R/zgdns.r View File

@@ -1,7 +1,7 @@
ipv4_regex <-
"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"

S_GET <- purrr::safely(GET)
S_GET <- safely(httr::GET)

#' Perform DNS over HTTPS queries using Google
#'
@@ -57,10 +57,14 @@ query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
sep="", collapse=".")
}

res <- S_GET("https://dns.google.com/resolve",
query=list(name=name,
type=type,
edns_client_subnet=edns_client_subnet))
res <- S_GET(
url = "https://dns.google.com/resolve",
query = list(
name = name,
type = type,
edns_client_subnet = edns_client_subnet
)
)

if (!is.null(res$result)) {
stop_for_status(res$result)
@@ -100,5 +104,5 @@ query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
#' gdns::bulk_query(hosts)
bulk_query <- function(entities, type=1, edns_client_subnet="0.0.0.0/0") {
results <- map(entities, gdns::query, type=type, edns_client_subnet=edns_client_subnet)
map_df(results, "Answer")
map_df(results, ~.x$Answer)
}

+ 148
- 117
README.md View File

@@ -1,29 +1,41 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/gdns.svg?branch=master)](https://travis-ci.org/hrbrmstr/gdns)

[![Travis-CI Build
Status](https://travis-ci.org/hrbrmstr/gdns.svg?branch=master)](https://travis-ci.org/hrbrmstr/gdns)

`gdns` : Tools to work with the Google DNS over HTTPS API

Traditional DNS queries and responses are sent over UDP or TCP without encryption. This is vulnerable to eavesdropping and spoofing (including DNS-based Internet filtering). Responses from recursive resolvers to clients are the most vulnerable to undesired or malicious changes, while communications between recursive resolvers and authoritative nameservers often incorporate additional protection.
Traditional DNS queries and responses are sent over UDP or TCP without
encryption. This is vulnerable to eavesdropping and spoofing (including
DNS-based Internet filtering). Responses from recursive resolvers to
clients are the most vulnerable to undesired or malicious changes, while
communications between recursive resolvers and authoritative nameservers
often incorporate additional protection.

To address this problem, Google Public DNS offers DNS resolution over an encrypted HTTPS connection. DNS-over-HTTPS greatly enhances privacy and security between a client and a recursive resolver, and complements DNSSEC to provide end-to-end authenticated DNS lookups.
To address this problem, Google Public DNS offers DNS resolution over an
encrypted HTTPS connection. DNS-over-HTTPS greatly enhances privacy and
security between a client and a recursive resolver, and complements
DNSSEC to provide end-to-end authenticated DNS lookups.

More info at <https://developers.google.com/speed/public-dns/docs/dns-over-https>.
More info at
<https://developers.google.com/speed/public-dns/docs/dns-over-https>.

The following functions are implemented:

- `bulk_query`: Vectorized query, returning only answers in a data frame
- `has_spf`: Test for whether a DNS TXT record is an SPF record
- `is_hard_fail`: SPF "all" type test
- `is_soft_fail`: SPF "all" type test
- `passes_all`: SPF "all" type test
- `query`: Perform DNS over HTTPS queries using Google
- `spf_exists`: SPF field extraction functions
- `spf_includes`: SPF field extraction functions
- `spf_ipv4s`: SPF field extraction functions
- `spf_ipv6s`: SPF field extraction functions
- `spf_ptrs`: SPF field extraction functions
- `split_spf`: Split out all SPF records in a domain's TXT record
- `bulk_query`: Vectorized query, returning only answers in a data
frame
- `has_spf`: Test for whether a DNS TXT record is an SPF record
- `is_hard_fail`: SPF “all” type test
- `is_soft_fail`: SPF “all” type test
- `passes_all`: SPF “all” type test
- `query`: Perform DNS over HTTPS queries using Google
- `spf_exists`: SPF field extraction functions
- `spf_includes`: SPF field extraction functions
- `spf_ipv4s`: SPF field extraction functions
- `spf_ipv6s`: SPF field extraction functions
- `spf_ptrs`: SPF field extraction functions
- `split_spf`: Split out all SPF records in a domain’s TXT record

### Installation

@@ -38,7 +50,7 @@ library(gdns)

# current verison
packageVersion("gdns")
#> [1] '0.2.0.9000'
#> [1] '0.2.1'

query("rud.is")
#> $Status
@@ -64,17 +76,14 @@ query("rud.is")
#> 1 rud.is. 1
#>
#> $Answer
#> name type TTL data
#> 1 rud.is. 1 3599 104.236.112.222
#> name type TTL data
#> 1 rud.is. 1 277 104.236.112.222
#>
#> $Additional
#> list()
#>
#> $edns_client_subnet
#> [1] "0.0.0.0/0"
#>
#> $Comment
#> [1] "Response from dns.mwebdns.net.(84.246.124.75)"

query("example.com", "255") # "ANY" query
#> $Status
@@ -101,54 +110,53 @@ query("example.com", "255") # "ANY" query
#>
#> $Answer
#> name type TTL
#> 1 example.com. 6 3599
#> 2 example.com. 46 21599
#> 3 example.com. 46 21599
#> 4 example.com. 46 3599
#> 5 example.com. 46 59
#> 6 example.com. 46 21599
#> 7 example.com. 46 3599
#> 8 example.com. 46 3599
#> 9 example.com. 46 3599
#> 10 example.com. 47 3599
#> 11 example.com. 2 21599
#> 12 example.com. 2 21599
#> 13 example.com. 28 21599
#> 14 example.com. 1 21599
#> 15 example.com. 16 59
#> 16 example.com. 16 59
#> 17 example.com. 48 3599
#> 18 example.com. 48 3599
#> 19 example.com. 48 3599
#> 1 example.com. 46 21548
#> 2 example.com. 46 21548
#> 3 example.com. 46 3548
#> 4 example.com. 46 8
#> 5 example.com. 46 21548
#> 6 example.com. 46 3548
#> 7 example.com. 46 3548
#> 8 example.com. 46 3548
#> 9 example.com. 47 3548
#> 10 example.com. 2 21548
#> 11 example.com. 2 21548
#> 12 example.com. 28 21548
#> 13 example.com. 1 21548
#> 14 example.com. 16 8
#> 15 example.com. 16 8
#> 16 example.com. 48 3548
#> 17 example.com. 48 3548
#> 18 example.com. 48 3548
#> 19 example.com. 48 3548
#> 20 example.com. 6 3548
#> data
#> 1 sns.dns.icann.org. noc.dns.icann.org. 2015082662 7200 3600 1209600 3600
#> 2 a 8 2 86400 1476095331 1474297785 1704 example.com. OnhJa3/aHkvePBvBME3nlZrkU/rdenyaquFgSYI/wKPq2/ZJVZGhv0TVBMJ5l6GZujqnyBfq9cvvb88//koi17oNjR5JEv2cv4rLT5pud3VhQdVrHD7fU8BV/YnCpP3ikXJMgjf6sAhgL7FZKLtpv7cFXnqznfRCTZ3HKkpBtAB0ZZw=
#> 3 ns 8 2 86400 1476218628 1474362585 1704 example.com. dxPw4KtqLRMR/P1MB7umTClO/Tgf5X2ukJApKd133OMPhsy7c2N3QIxW4TLxZnCezUewDE1D86HBnGi1kGw4pN4W83lI37L6pTjIkDUtrc1acISOwg9Q9JM74On9/qKTGpTi7aSGVA5t4biLKqPm00a1Yu/VNPOxeLQPyYNjUYspNZ8=
#> 4 soa 8 2 3600 1476508736 1474722585 1704 example.com. rHojLwiWn5xVU8noy1se7gRjiNI6GJdDcxwO1GU1qUs3Un4y7LyENjrK8qOv2z6EhblBOhPnrgnNMzEPPH3w+5azpU6xAH+jJHO4tExj4Pc3zzQ1sfFx1k8xWPfJjiWnUtUsk19y8vVqHvLXltvVItXlCClzljA0XyNUi1fvYjHbQxI=
#> 5 txt 8 2 60 1476051975 1474218584 1704 example.com. FBZiE56Ux4VY5AMVtgitLIBWi+UteNSFh4BWwJksVRRt/7OoH7iD6h4UDqP8rNbk9qvXmRo4Ce2vROCbNkdTy/IDEoKo+Urfm69TuI2UTbl/nnQ2UtfMIEC83yywYRWdra5BPkt67SQhHSc4N7QHblABFbm2jPuu2+uOqaRCpfeoWYo=
#> 6 aaaa 8 2 86400 1475967038 1474146584 1704 example.com. ZQgPaEBxSxHCPhOES76xksqOVYSRtNIieIwTwIo4Oceq0NGzjOyI+8wrgs79QHqs4e5SRe67hVX2rSaJ9Q167+TuQz57ZtyqeOZ+x+cgULyT1Q+8N0ZJlHpZS4i2VfR1xT+quG+0m9wtye8wA3Hl2mWPyTjtsH7mjoS7/U/ZQMJwi44=
#> 7 nsec 8 2 3600 1475694918 1473887384 1704 example.com. XTCfotH8+cSDgNrFnCNWt4lx64yTnVzwOMZsFgynNSGS5LzY0VfRl7UvTH2WDVzdsIHgKpPBOUwv/DvjNhAMzUgHFlaK/A+U1aFa16/YQkqkIqqfnCA4EgBdhIK4FM3dSIVcpaj3PhGFKvMG4RBvoMAWLRXE3gKf3306CJzX1sfKdsA=
#> 8 dnskey 8 2 3600 1476561735 1474722585 31406 example.com. Oup7snCR/5iUmTuGyHfCfFCisTeqaJ8RHD6aE9wZQR2CCkKZHXO9dzfUL1gA6T35p4T0XeM+TMlv1uZhX157RnanPwyZluancmm5cNz5ub0vG7G/O4DxnSoLmATYoBJ7Ub9Ul4iWFUE7nvyJ23X2MhX6XTiplXYPnztiem6rJLV84JiemoKtvapWchRhFi4w4Y+BdjHfY7IRERjQYNhVuaus5+EeppIoot9srsj2suXePGC7dE0R8z9K/BTYvQi76kBlJzzF9fNNy5JvyZPEUpXATuRD7KfxBsWHaFajOnYOb1eDAL/C0H3hhjVBov2Pexp7YDIsJzIa2g8850LruQ==
#> 9 dnskey 8 2 3600 1476561735 1474722585 45620 example.com. f+aO6V+QKA4XgTC0Vqow59jBP/NlX6f7EEbaoXts0lp7Vaj/DBrhnS/sT4BbJb3VK1MvuPmNre5t0eyOeNCjbjrwIM2uf41GFuBI0AFxQx7o2PIdf1vrXsDnUGsZrMkYMv4gr802S7MXsvMdMN5cM0AA5Zol888sLP1yrHIcfNxG8hoUn3dS0L6nd/OxkL70+NjHBTjBQLqkLsK92ryJ0CWrzcJElszBRqfQfYGV/sJ84Ko4tjnBqRuki/rmTW5KQYdE7NI+MvERtGnep7RHb02Luk7BFPPD3uh353EYSAOVHrMH4fte6mJGcj3vxErfSWakRUXQpovLNcqYZNxoGQ==
#> 10 www.example.com. A NS SOA TXT AAAA RRSIG NSEC DNSKEY
#> 11 a.iana-servers.net.
#> 12 b.iana-servers.net.
#> 13 2606:2800:220:1:248:1893:25c8:1946
#> 14 93.184.216.34
#> 15 "v=spf1 -all"
#> 16 "$Id: example.com 4415 2015-08-24 20:12:23Z davids $"
#> 17 256 3 8 AwEAAa3d68DfyIs03nGYpi3a9YX+f/wln3g6dhWWzjUUqp6CGXuaOdEHfS8zI/5JdGKi8Xoc4YmjPGfiCJIkCiQnMKn/QFygpZs41ANLdPp2jJlJhFA6IHE/xxTCxJfNhsdEAOGlMORN9Zu1XLUBo/IuCDUvUzZPgalivd/m9L+Jr4kxbg3v
#> 1 a 8 2 86400 1530064725 1528271786 4354 example.com. gpgx3XIhF4XZg5Nw0eo7TmCD1zfKX9YtMq9PuSh3eAc4fJrvyS/VWy2bz/KYhgiXQe6PvtOLZbgTT2O9knkHIlAsmnznEowSrgWYaCkkkNnoC8Ii1Ikg87PCZ7FffTposk/4HRG6yXZlo9+++YZAfAC0cc9FFYpQXqxVLf9/aDQ=
#> 2 ns 8 2 86400 1530070167 1528286186 4354 example.com. tVZnWX3VxO+XqrDS76S6RpLYvGluZIQkai0aWx3pzjjhqi+qKO7WtjcIYmOgehBB2t3TVC9cv1rhb21SDBZPNtgtpWAR/W3hPK1FA4AhDW3tDwk0vZ8VnxRS6YZRdubY5xx8f+88auYUZNauK3SsAcKj4k9IaeMLinzpie0ydKk=
#> 3 soa 8 2 3600 1530144931 1528300586 4354 example.com. oDz3EMYugQZ5zJV2Wwr76heKzbOB8cDgol+HD0DTPPNkBHkU33thZI3kwtD/KE7YFbwlD86is5Qgy4sVOToEcxs6Th2+bxkwkSDbnNCfpqXg9FP2nknfsYdN8UHIOcsbjo8pAEQrwbOBnRhkfgh+B2jXCeR8wcYIDtlfyjIG5dw=
#> 4 txt 8 2 60 1530100194 1528250186 4354 example.com. PRVGxCX8Sghw9xQv+ITTpIHbpku543BNEVSA0LZVIZ2p5r3kPb4vlID/jSzFTOhgLhdkB0OAMG3dvWxNXT3fOBiv8c/UZHdwjJdneLeoHILiAa4Y3HSC+t4kcs+9qRFzj4EQgXwr0zWLDoZTa9bkhoVdaC8q+oL+TyjiwgG6RXs=
#> 5 aaaa 8 2 86400 1528834805 1526975786 4354 example.com. lRAUeTu/Wr7mobPHuh29z66cqqnCQXvUcSWYNsrdJvWIUaaGNUtz800bQQuZah3tZbJeSbDV+LivN8pFYrTPR9AVyTi1uD7x8qH+3MckgKezJ199e1twfbpl0O44zSFlrI7SxEaWhTnUGM2xafyH0HZUr1Eg/5nxDFlmaVfxet8=
#> 6 nsec 8 2 3600 1530145868 1528300586 4354 example.com. NV0BbCZT7yXFnrJhEV1atS0QBbkDmojtUw9PIxDOUJzEZtWql5qJ5iMJl2z8ghmRwurnRAskBOZaT1jstyf/X8wBS8T05uc6KgfiFdoeseIWfTd9+9y6E9ESHmsSLDyHlbex6k3XAb5c4GWSyZ058JpSUyQbpnTC0fxEONxiFT4=
#> 7 dnskey 8 2 3600 1530072436 1528278986 31406 example.com. exstuS89vtBrpvN+6XK49NWMrQmUoHJAAMzLMCi5w3xUczvo9hQWi3yfDVk7Rdtv61IFEFRTIVVCoM0kpWmgp1NwOPKNSUxg3OVO5++PGoCE7hI8fhW/xdiOUC1dHHk/zuWRoriERykgNvo6yzegBmXbOyf7WCh1csoGuk+RmIWykngZw9wCX+qjdO1G8y8DMmwzEzDc3fBN9v2at3lo+VK/uhR4Tu6rr4rxkYqqgz02TIkHr14GsCa4hlf8/s2UhaWKil5ja51HgFsR2fLHRwZ1x1toejaxMekJvVcarhNYodU83q8qZ0Yoa8GIKpdS70chj4ZrLiUkBhV2KEtytg==
#> 8 dnskey 8 2 3600 1530072436 1528278986 45620 example.com. Kd2iq2xmcg5GJmNOQiHjZKDKHH+MyDagSjXuTJKiJFXSpgMzZUl9Gnr+LsDTiLaddotsBo3OXQODZDlIB5jlI7/hkt/kYOb8d1ns+hd5jmTyFowhOiQAxpWUlZkvXvVQ5gAnefxGCx78/4JtFnTMGADiAYEIMXZm+qtjn9/YJKtkgmgutxcVjTDAl7zVdvN+uyR5g/f2Rm5x1aWLIfmAtg0Nv5xFKZTduPse8PrKsGHC3uezWRshbOYugOxp/Ui6Ru6PNBaeUBGuKwQw2XcB9H65PE4wj14mcCcQk5wTL8VfeaW6WQ6y+dgtwMGoUCnF2Eaj/5Gnv2mW+1VMv0jIqg==
#> 9 www.example.com. A NS SOA TXT AAAA RRSIG NSEC DNSKEY
#> 10 a.iana-servers.net.
#> 11 b.iana-servers.net.
#> 12 2606:2800:220:1:248:1893:25c8:1946
#> 13 93.184.216.34
#> 14 "v=spf1 -all"
#> 15 "$Id: example.com 4415 2015-08-24 20:12:23Z davids $"
#> 16 256 3 8 AwEAAa1e3aHzKml+EtBvA6ZVztOV+AByi8/9akkbL9COtasbKc1VBbHS6w8uHGqHaEMXzriWtXAwlSzHMgIxJ1y0fXcB/h4Yg8qNnJvgSU1JAKvYLJMkdAk+P5XbdGtpUNCh4d9NEZkY/lFClYo8iyIAVeifDeaeaEQIRKbPZLLwtgr1
#> 17 256 3 8 AwEAAbpTkuNZuxDDAwDW46cAroMR10zm9MsdVnXT+m/4HtbGstC4LIt8WU3CRayoXZyO6zDwxAytkuKxuEWVCAVA7ligFPR8Ta/BoR91H66dj8OPExAq6ugqKsQDKP906j5cF9Rsr9k0rEjvh2MptStkzCSaBB3FulTj14pBX1MZ8x9n
#> 18 257 3 8 AwEAAZ0aqu1rJ6orJynrRfNpPmayJZoAx9Ic2/Rl9VQWLMHyjxxem3VUSoNUIFXERQbj0A9Ogp0zDM9YIccKLRd6LmWiDCt7UJQxVdD+heb5Ec4qlqGmyX9MDabkvX2NvMwsUecbYBq8oXeTT9LRmCUt9KUt/WOi6DKECxoG/bWTykrXyBR8elD+SQY43OAVjlWrVltHxgp4/rhBCvRbmdflunaPIgu27eE2U4myDSLT8a4A0rB5uHG4PkOa9dIRs9y00M2mWf4lyPee7vi5few2dbayHXmieGcaAHrx76NGAABeY393xjlmDNcUkF1gpNWUla4fWZbbaYQzA93mLdrng+M=
#> 19 257 3 8 AwEAAbOFAxl+Lkt0UMglZizKEC1AxUu8zlj65KYatR5wBWMrh18TYzK/ig6Y1t5YTWCO68bynorpNu9fqNFALX7bVl9/gybA0v0EhF+dgXmoUfRX7ksMGgBvtfa2/Y9a3klXNLqkTszIQ4PEMVCjtryl19Be9/PkFeC9ITjgMRQsQhmB39eyMYnal+f3bUxKk4fq7cuEU0dbRpue4H/N6jPucXWOwiMAkTJhghqgy+o9FfIp+tR/emKao94/wpVXDcPf5B18j7xz2SvTTxiuqCzCMtsxnikZHcoh1j4g+Y1B8zIMIvrEM+pZGhh/Yuf4RwCBgaYCi9hpiMWVvS4WBzx0/lU=
#> 20 sns.dns.icann.org. noc.dns.icann.org. 2018050812 7200 3600 1209600 3600
#>
#> $Additional
#> list()
#>
#> $edns_client_subnet
#> [1] "0.0.0.0/0"
#>
#> $Comment
#> [1] "Response from 199.43.135.53"

query("microsoft.com", "MX")
#> $Status
@@ -175,13 +183,16 @@ query("microsoft.com", "MX")
#>
#> $Answer
#> name type TTL data
#> 1 microsoft.com. 15 1509 10 microsoft-com.mail.protection.outlook.com.
#> 1 microsoft.com. 15 3599 10 microsoft-com.mail.protection.outlook.com.
#>
#> $Additional
#> list()
#>
#> $edns_client_subnet
#> [1] "0.0.0.0/0"
#>
#> $Comment
#> [1] "Response from 193.221.113.53."

query("google-public-dns-a.google.com", "TXT")
#> $Status
@@ -217,7 +228,7 @@ query("google-public-dns-a.google.com", "TXT")
#> [1] "0.0.0.0/0"
#>
#> $Comment
#> [1] "Response from 216.239.36.10"
#> [1] "Response from 216.239.32.10."

query("apple.com")
#> $Status
@@ -244,9 +255,9 @@ query("apple.com")
#>
#> $Answer
#> name type TTL data
#> 1 apple.com. 1 3413 17.172.224.47
#> 2 apple.com. 1 3413 17.178.96.59
#> 3 apple.com. 1 3413 17.142.160.59
#> 1 apple.com. 1 3592 17.172.224.47
#> 2 apple.com. 1 3592 17.178.96.59
#> 3 apple.com. 1 3592 17.142.160.59
#>
#> $Additional
#> list()
@@ -278,46 +289,57 @@ query("17.142.160.59", "PTR")
#> 1 59.160.142.17.in-addr.arpa. 12
#>
#> $Answer
#> name type TTL data
#> 1 59.160.142.17.in-addr.arpa. 12 3025 apples-msk.ru.
#> 2 59.160.142.17.in-addr.arpa. 12 3025 icloud.se.
#> 3 59.160.142.17.in-addr.arpa. 12 3025 icloud.es.
#> 4 59.160.142.17.in-addr.arpa. 12 3025 icloud.om.
#> 5 59.160.142.17.in-addr.arpa. 12 3025 icloudo.com.
#> 6 59.160.142.17.in-addr.arpa. 12 3025 icloud.ch.
#> 7 59.160.142.17.in-addr.arpa. 12 3025 icloud.fr.
#> 8 59.160.142.17.in-addr.arpa. 12 3025 icloude.com.
#> 9 59.160.142.17.in-addr.arpa. 12 3025 camelspaceeffect.com.
#> 10 59.160.142.17.in-addr.arpa. 12 3025 camelphat.com.
#> 11 59.160.142.17.in-addr.arpa. 12 3025 alchemysynth.com.
#> 12 59.160.142.17.in-addr.arpa. 12 3025 openni.org.
#> 13 59.160.142.17.in-addr.arpa. 12 3025 swell.am.
#> 14 59.160.142.17.in-addr.arpa. 12 3025 appleweb.net.
#> 15 59.160.142.17.in-addr.arpa. 12 3025 apple.com.
#> 16 59.160.142.17.in-addr.arpa. 12 3025 pv-apple-com.apple.com.
#> 17 59.160.142.17.in-addr.arpa. 12 3025 ripmixburn.com.
#> 18 59.160.142.17.in-addr.arpa. 12 3025 yessql.info.
#> 19 59.160.142.17.in-addr.arpa. 12 3025 webobjects.info.
#> 20 59.160.142.17.in-addr.arpa. 12 3025 ubnw.info.
#> 21 59.160.142.17.in-addr.arpa. 12 3025 skyvines.info.
#> 22 59.160.142.17.in-addr.arpa. 12 3025 shopdifferent.info.
#> 23 59.160.142.17.in-addr.arpa. 12 3025 sherlock.info.
#> 24 59.160.142.17.in-addr.arpa. 12 3025 quicktimetv.info.
#> 25 59.160.142.17.in-addr.arpa. 12 3025 quicktimelive.info.
#> 26 59.160.142.17.in-addr.arpa. 12 3025 powermac.info.
#> 27 59.160.142.17.in-addr.arpa. 12 3025 powerbook.info.
#> 28 59.160.142.17.in-addr.arpa. 12 3025 macosx.info.
#> 29 59.160.142.17.in-addr.arpa. 12 3025 appleshare.info.
#> 30 59.160.142.17.in-addr.arpa. 12 3025 applescript.info.
#> 31 59.160.142.17.in-addr.arpa. 12 3025 applepaysupplies.info.
#> 32 59.160.142.17.in-addr.arpa. 12 3025 applepaymerchantsupplies.info.
#> 33 59.160.142.17.in-addr.arpa. 12 3025 applepay.info.
#> 34 59.160.142.17.in-addr.arpa. 12 3025 applemasters.info.
#> 35 59.160.142.17.in-addr.arpa. 12 3025 appleexpo.info.
#> 36 59.160.142.17.in-addr.arpa. 12 3025 applecomputerinc.info.
#> 37 59.160.142.17.in-addr.arpa. 12 3025 applecentre.info.
#> 38 59.160.142.17.in-addr.arpa. 12 3025 airtunes.info.
#> 39 59.160.142.17.in-addr.arpa. 12 3025 apple.by.
#> name type TTL data
#> 1 59.160.142.17.in-addr.arpa. 12 907 imac.one.
#> 2 59.160.142.17.in-addr.arpa. 12 907 mac.one.
#> 3 59.160.142.17.in-addr.arpa. 12 907 itunes.earth.
#> 4 59.160.142.17.in-addr.arpa. 12 907 chomp.com.
#> 5 59.160.142.17.in-addr.arpa. 12 907 iphone.host.
#> 6 59.160.142.17.in-addr.arpa. 12 907 ripmixburn.com.
#> 7 59.160.142.17.in-addr.arpa. 12 907 yessql.info.
#> 8 59.160.142.17.in-addr.arpa. 12 907 webobjects.info.
#> 9 59.160.142.17.in-addr.arpa. 12 907 ubnw.info.
#> 10 59.160.142.17.in-addr.arpa. 12 907 skyvines.info.
#> 11 59.160.142.17.in-addr.arpa. 12 907 shopdifferent.info.
#> 12 59.160.142.17.in-addr.arpa. 12 907 sherlock.info.
#> 13 59.160.142.17.in-addr.arpa. 12 907 quicktimetv.info.
#> 14 59.160.142.17.in-addr.arpa. 12 907 quicktimelive.info.
#> 15 59.160.142.17.in-addr.arpa. 12 907 powermac.info.
#> 16 59.160.142.17.in-addr.arpa. 12 907 powerbook.info.
#> 17 59.160.142.17.in-addr.arpa. 12 907 macosx.info.
#> 18 59.160.142.17.in-addr.arpa. 12 907 appleshare.info.
#> 19 59.160.142.17.in-addr.arpa. 12 907 applescript.info.
#> 20 59.160.142.17.in-addr.arpa. 12 907 applepaysupplies.info.
#> 21 59.160.142.17.in-addr.arpa. 12 907 applepaymerchantsupplies.info.
#> 22 59.160.142.17.in-addr.arpa. 12 907 applepay.info.
#> 23 59.160.142.17.in-addr.arpa. 12 907 applemasters.info.
#> 24 59.160.142.17.in-addr.arpa. 12 907 appleexpo.info.
#> 25 59.160.142.17.in-addr.arpa. 12 907 applecomputerinc.info.
#> 26 59.160.142.17.in-addr.arpa. 12 907 applecentre.info.
#> 27 59.160.142.17.in-addr.arpa. 12 907 airtunes.info.
#> 28 59.160.142.17.in-addr.arpa. 12 907 apple.by.
#> 29 59.160.142.17.in-addr.arpa. 12 907 apples-msk.ru.
#> 30 59.160.142.17.in-addr.arpa. 12 907 icloud.se.
#> 31 59.160.142.17.in-addr.arpa. 12 907 icloud.es.
#> 32 59.160.142.17.in-addr.arpa. 12 907 icloud.om.
#> 33 59.160.142.17.in-addr.arpa. 12 907 icloudo.com.
#> 34 59.160.142.17.in-addr.arpa. 12 907 icloud.ch.
#> 35 59.160.142.17.in-addr.arpa. 12 907 icloud.fr.
#> 36 59.160.142.17.in-addr.arpa. 12 907 icloude.com.
#> 37 59.160.142.17.in-addr.arpa. 12 907 camelspaceeffect.com.
#> 38 59.160.142.17.in-addr.arpa. 12 907 camelphat.com.
#> 39 59.160.142.17.in-addr.arpa. 12 907 alchemysynth.com.
#> 40 59.160.142.17.in-addr.arpa. 12 907 openni.org.
#> 41 59.160.142.17.in-addr.arpa. 12 907 swell.am.
#> 42 59.160.142.17.in-addr.arpa. 12 907 appleweb.net.
#> 43 59.160.142.17.in-addr.arpa. 12 907 apple.com.
#> 44 59.160.142.17.in-addr.arpa. 12 907 pv-apple-com.apple.com.
#> 45 59.160.142.17.in-addr.arpa. 12 907 ipad.host.
#> 46 59.160.142.17.in-addr.arpa. 12 907 appleid.org.
#> 47 59.160.142.17.in-addr.arpa. 12 907 apple.xyz.
#> 48 59.160.142.17.in-addr.arpa. 12 907 searchads-apple.com.
#> 49 59.160.142.17.in-addr.arpa. 12 907 airport.brussels.
#> 50 59.160.142.17.in-addr.arpa. 12 907 ipadpro.buzz.
#>
#> $Additional
#> list()
@@ -328,13 +350,13 @@ query("17.142.160.59", "PTR")
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts)
#> name type TTL data
#> 1 rud.is. 1 3598 104.236.112.222
#> 2 dds.ec. 1 299 162.243.111.4
#> 3 r-project.org. 1 3072 137.208.57.37
#> 4 rstudio.com. 1 3599 45.79.156.36
#> 5 apple.com. 1 3415 17.172.224.47
#> 6 apple.com. 1 3415 17.178.96.59
#> 7 apple.com. 1 3415 17.142.160.59
#> 1 rud.is. 1 276 104.236.112.222
#> 2 dds.ec. 1 599 185.53.178.9
#> 3 r-project.org. 1 4806 137.208.57.37
#> 4 rstudio.com. 1 3599 104.196.200.5
#> 5 apple.com. 1 3585 17.172.224.47
#> 6 apple.com. 1 3585 17.178.96.59
#> 7 apple.com. 1 3585 17.142.160.59
```

### Test Results
@@ -344,15 +366,24 @@ library(gdns)
library(testthat)

date()
#> [1] "Thu Sep 29 09:44:11 2016"
#> [1] "Wed Jun 6 15:28:43 2018"

test_dir("tests/")
#> testthat results ========================================================================================================
#> ✔ | OK F W S | Context
#> ══ testthat results ════════════════════════════════════════════════════════════
#> OK: 2 SKIPPED: 0 FAILED: 0
#>
#> DONE ===================================================================================================================
#> ══ Results ══════════════════════════════════════════════════════════════════════
#> Duration: 0.3 s
#>
#> OK: 0
#> Failed: 0
#> Warnings: 0
#> Skipped: 0
```

### Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
Please note that this project is released with a [Contributor Code of
Conduct](CONDUCT.md). By participating in this project you agree to
abide by its terms.

+ 1
- 1
man/bulk_query.Rd View File

@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gdns.r
% Please edit documentation in R/zgdns.r
\name{bulk_query}
\alias{bulk_query}
\title{Vectorized query, returning only answers in a data frame}


+ 1
- 1
man/query.Rd View File

@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gdns.r
% Please edit documentation in R/zgdns.r
\name{query}
\alias{query}
\title{Perform DNS over HTTPS queries using Google}


Loading…
Cancel
Save