Browse Source

JSON API endpoint

master
boB Rudis 5 years ago
parent
commit
c97226ebc3
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 1
      .Rbuildignore
  2. 7
      DESCRIPTION
  3. 4
      NAMESPACE
  4. 7
      NEWS.md
  5. 35
      R/as-data-frame.R
  6. 89
      R/datasets.R
  7. 11
      R/utils-pipe.R
  8. 26
      R/zbulk-query.R
  9. 42
      R/zgdns.r
  10. 69
      README.Rmd
  11. 288
      README.md
  12. 14
      cran-comments.md
  13. 95
      data-raw/rrtypes.R
  14. BIN
      data/dns_classes.rda
  15. BIN
      data/dns_glob_names.rda
  16. BIN
      data/dns_opcodes.rda
  17. BIN
      data/dns_rcodes.rda
  18. BIN
      data/edns0_option_codes.rda
  19. BIN
      data/resource_record_tbl.rda
  20. BIN
      data/rrtypes.rda
  21. 16
      man/as.data.frame.gdns_response.Rd
  22. 9
      man/bulk_query.Rd
  23. 26
      man/dns_classes.Rd
  24. 24
      man/dns_glob_names.Rd
  25. 24
      man/dns_opcodes.Rd
  26. 24
      man/dns_rcodes.Rd
  27. 26
      man/edns0_option_codes.Rd
  28. 12
      man/pipe.Rd
  29. 28
      man/query.Rd
  30. 24
      man/rrtypes.Rd
  31. 2
      tests/testthat/test-gdns.R

1
.Rbuildignore

@ -7,3 +7,4 @@
^cran-comments\.md$ ^cran-comments\.md$
^docs$ ^docs$
^tools$ ^tools$
^data-raw$

7
DESCRIPTION

@ -1,6 +1,6 @@
Package: gdns Package: gdns
Title: Tools to Work with Google's 'DNS-over-HTTPS' ('DoH') 'API' Title: Tools to Work with Google's 'DNS-over-HTTPS' ('DoH') 'API'
Version: 0.3.1 Version: 0.4.0
Authors@R: c( Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640")) comment = c(ORCID = "0000-0001-5670-2640"))
@ -26,5 +26,6 @@ Imports:
httr, httr,
stats, stats,
jsonlite, jsonlite,
stringi stringi,
RoxygenNote: 6.0.1.9000 magrittr
RoxygenNote: 6.1.1

4
NAMESPACE

@ -1,6 +1,9 @@
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
S3method(as.data.frame,gdns_response)
export("%>%")
export(bulk_query) export(bulk_query)
export(dig)
export(has_spf) export(has_spf)
export(is_hard_fail) export(is_hard_fail)
export(is_soft_fail) export(is_soft_fail)
@ -14,6 +17,7 @@ export(spf_ptrs)
export(split_spf) export(split_spf)
import(httr) import(httr)
importFrom(jsonlite,fromJSON) importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%>%")
importFrom(stats,terms) importFrom(stats,terms)
importFrom(stringi,stri_detect_fixed) importFrom(stringi,stri_detect_fixed)
importFrom(stringi,stri_enc_toutf8) importFrom(stringi,stri_enc_toutf8)

7
NEWS.md

@ -1,3 +1,10 @@
# gdns 0.4.0
* Updated the JSON API endpoint per Google notification
* Added `dig()` alias for `query()`
* Added an `as.data.frame()` coercer for query results
* Added IANA DNS-related datasets
# gdns 0.3.1 # gdns 0.3.1
* fixed bug in `bulk_query()` * fixed bug in `bulk_query()`

35
R/as-data-frame.R

@ -0,0 +1,35 @@
#' Coerce a gdns query response answer to a data frame
#'
#' Helper function to get to the `Answer` quickly
#' @param x a `gdns_response` object
#' @param ... unused
#' @export
as.data.frame.gdns_response <- function(x, ...) {
if (length(x[["Answer"]]) == 0) {
data.frame(
name = NA_character_,
type = NA_character_,
ttl = NA_character_,
data = NA_character_,
stringsAsFactors = FALSE
) -> out
} else {
out <- x[["Answer"]]
}
if (length(x[["Question"]][["name"]])) {
out[["query"]] <- x[["Question"]][["name"]][[1]]
out[["qtype"]] <- x[["Question"]][["type"]][[1]]
} else {
out[["query"]] <- NA_character_
out[["qtype"]] <- NA_character_
}
colnames(out) <- tolower(colnames(out))
out <- out[,c("query", "qtype", "name", "type", "ttl", "data")]
class(out) <- c("tbl_df", "tbl", "data.frame")
out
}

89
R/datasets.R

@ -0,0 +1,89 @@
# This file is autogenerated. Do not edit by hand.
# Last refresh: 2019-06-27 11:16:48
#' @md
#' @title DNS CLASSes (dataset)
#' @description DNS CLASSes
#' @format data frame with columns: `decimal`, `hexadecimal`, `name`, `reference`
#' @docType data
#' @keywords datasets
#' @name dns_classes
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc6895
#' @note As noted in , Multicast DNS can only carry DNS records with classes in the range 0-32767. Classes in the range 32768 to 65535 are incompatible with Multicast DNS.
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('dns_classes')
NULL
#' @md
#' @title Resource Record (RR) TYPEs (dataset)
#' @description Resource Record (RR) TYPEs
#' @format data frame with columns: `type`, `value`, `meaning`, `reference`, `template`, `registration_date`
#' @docType data
#' @keywords datasets
#' @name rrtypes
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc6895, rfc1035
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('rrtypes')
NULL
#' @md
#' @title DNS OpCodes (dataset)
#' @description DNS OpCodes
#' @format data frame with columns: `op_code`, `name`, `reference`
#' @docType data
#' @keywords datasets
#' @name dns_opcodes
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc6895, rfc1035
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('dns_opcodes')
NULL
#' @md
#' @title DNS RCODEs (dataset)
#' @description DNS RCODEs
#' @format data frame with columns: `rcode`, `name`, `description`, `reference`
#' @docType data
#' @keywords datasets
#' @name dns_rcodes
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc6895, rfc1035
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('dns_rcodes')
NULL
#' @md
#' @title DNS EDNS0 Option Codes (OPT) (dataset)
#' @description DNS EDNS0 Option Codes (OPT)
#' @format data frame with columns: `value`, `name`, `status`, `reference`
#' @docType data
#' @keywords datasets
#' @name edns0_option_codes
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc6891, 3604
#' @note Registrations made by standards-track documents are listed as "Standard," and by non-standards-track documents as "Optional." Registrations for which there are no final specifications are listed as "On-Hold."
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('edns0_option_codes')
NULL
#' @md
#' @title Underscored and Globally Scoped DNS Node Names (dataset)
#' @description Underscored and Globally Scoped DNS Node Names
#' @format data frame with columns: `rr_type`, `node_name`, `reference`
#' @docType data
#' @keywords datasets
#' @name dns_glob_names
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#underscored-globally-scoped-dns-node-names>
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @references rfc8552
#' @note Last updated 2019-06-27 11:16:48
#' @usage data('dns_glob_names')
NULL

11
R/utils-pipe.R

@ -0,0 +1,11 @@
#' Pipe operator
#'
#' See \code{magrittr::\link[magrittr]{\%>\%}} for details.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
NULL

26
R/zbulk-query.R

@ -4,6 +4,10 @@
#' @param type RR type can be represented as a number in [1, 65535] or canonical #' @param type RR type can be represented as a number in [1, 65535] or canonical
#' string (A, aaaa, etc). More information on RR types can be #' string (A, aaaa, etc). More information on RR types can be
#' found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}. #' found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.
#' @param cd (Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
#' Default: `FALSE`.
#' @param do (DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
#' Default: `FALSE`.
#' @param edns_client_subnet The edns0-client-subnet option. Format is an IP #' @param edns_client_subnet The edns0-client-subnet option. Format is an IP
#' address with a subnet mask. Examples: \code{1.2.3.4/24}, #' address with a subnet mask. Examples: \code{1.2.3.4/24},
#' \code{2001:700:300::/48}.\cr #' \code{2001:700:300::/48}.\cr
@ -22,27 +26,19 @@
#' @examples #' @examples
#' hosts <- c("rud.is", "r-project.org", "rstudio.com", "apple.com") #' hosts <- c("rud.is", "r-project.org", "rstudio.com", "apple.com")
#' gdns::bulk_query(hosts) #' gdns::bulk_query(hosts)
bulk_query <- function(entities, type = 1, edns_client_subnet = "0.0.0.0/0") { bulk_query <- function(entities, type = 1, cd = FALSE, do = FALSE,
edns_client_subnet = "0.0.0.0/0") {
lapply( lapply(
entities, entities,
query, type = type, edns_client_subnet = edns_client_subnet query, type = type, cd = cd,
edns_client_subnet = edns_client_subnet
) -> results ) -> results
lapply(seq_along(results), function(idx) { lapply(seq_along(results), function(idx) {
if (length(results[[idx]]$Answer) == 0) { res <- as.data.frame(results[[idx]])
data.frame( res$entity <- entities[[idx]]
entity = entities[idx], res
name = NA_character_,
type = NA_character_,
TTL = NA_character_,
data = NA_character_,
stringsAsFactors = FALSE
)
} else {
results[[idx]]$Answer$entity <- entities[[idx]]
results[[idx]]$Answer
}
}) -> xlst }) -> xlst
xdf <- do.call(rbind.data.frame, xlst) xdf <- do.call(rbind.data.frame, xlst)

42
R/zgdns.r

@ -30,6 +30,16 @@ S_GET <- safely(httr::GET)
#' string (A, aaaa, etc). More information on RR types can be #' string (A, aaaa, etc). More information on RR types can be
#' found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}. #' found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.
#' You can use \code{255} for an \code{ANY} query. #' You can use \code{255} for an \code{ANY} query.
#' @param cd (Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
#' Default: `FALSE`.
#' @param do (DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
#' Default: `FALSE`.
#' @param random_padding clients concerned about possible side-channel privacy
#' attacks using the packet sizes of HTTPS GET requests can use this to
#' make all requests exactly the same size by padding requests with random data.
#' To prevent misinterpretation of the URL, restrict the padding characters to
#' the unreserved URL characters: upper- and lower-case letters, digits,
#' hyphen, period, underscore and tilde.
#' @param edns_client_subnet The edns0-client-subnet option. Format is an IP #' @param edns_client_subnet The edns0-client-subnet option. Format is an IP
#' address with a subnet mask. Examples: \code{1.2.3.4/24}, #' address with a subnet mask. Examples: \code{1.2.3.4/24},
#' \code{2001:700:300::/48}.\cr #' \code{2001:700:300::/48}.\cr
@ -40,16 +50,22 @@ S_GET <- safely(httr::GET)
#' approximate network information (usually replacing the last part of #' approximate network information (usually replacing the last part of
#' your IPv4 address with zeroes). \code{0.0.0.0/0} is the default. #' your IPv4 address with zeroes). \code{0.0.0.0/0} is the default.
#' @return a \code{list} with the query result or \code{NULL} if an error occurred #' @return a \code{list} with the query result or \code{NULL} if an error occurred
#' @references \url{https://developers.google.com/speed/public-dns/docs/dns-over-https} #' @references <https://developers.google.com/speed/public-dns/docs/doh/json>
#' @export #' @export
#' @examples #' @examples
#' query("rud.is") #' query("rud.is")
#' query("example.com", "255") # ANY query #' dig("example.com", "255") # ANY query
#' query("microsoft.com", "MX") #' query("microsoft.com", "MX")
#' query("google-public-dns-a.google.com", "TXT") #' dig("google-public-dns-a.google.com", "TXT")
#' query("apple.com") #' query("apple.com")
#' query("17.142.160.59", "PTR") #' dig("17.142.160.59", "PTR")
query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") { query <- function(name, type = "1", cd = FALSE, do = FALSE,
edns_client_subnet = "0.0.0.0/0",
random_padding = NULL) {
name <- name[1]
# helper to turn IPv4 addresses in to in-addr.arpa.
if (grepl(ipv4_regex, name)) { if (grepl(ipv4_regex, name)) {
name <- paste0(c(rev(unlist(stringi::stri_split_fixed(name, ".", 4))), name <- paste0(c(rev(unlist(stringi::stri_split_fixed(name, ".", 4))),
@ -58,11 +74,15 @@ query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
} }
res <- S_GET( res <- S_GET(
url = "https://dns.google.com/resolve", url = "https://dns.google/resolve",
query = list( query = list(
name = name, name = name,
type = type, type = type,
edns_client_subnet = edns_client_subnet cd = if (cd) 1 else 0,
do = if (do) 1 else 0,
ct = "application/x-javascript",
edns_client_subnet = edns_client_subnet,
random_padding = random_padding
) )
) )
@ -71,9 +91,15 @@ query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
txt <- httr::content(res$result, as="text") txt <- httr::content(res$result, as="text")
txt <- stringi::stri_enc_toascii(txt) txt <- stringi::stri_enc_toascii(txt)
txt <- stringi::stri_replace_all_regex(txt, "[[:cntrl:][:blank:]\\n ]+", " ") txt <- stringi::stri_replace_all_regex(txt, "[[:cntrl:][:blank:]\\n ]+", " ")
jsonlite::fromJSON(txt) out <- jsonlite::fromJSON(txt)
class(out) <- c("gdns_response", "list")
out
} else { } else {
NULL NULL
} }
} }
#' @rdname query
#' @export
dig <- query

69
README.Rmd

@ -1,34 +1,48 @@
--- ---
output: rmarkdown::github_document output: rmarkdown::github_document
editor_options:
chunk_output_type: console
--- ---
<!-- README.md is generated from README.Rmd. Please edit that file --> <!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE} ```{r include=FALSE}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, message = FALSE,
comment = "#>", warning = FALSE,
fig.path = "README-" fig.retina = 2
) )
options(width=120)
``` ```
[![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 # gdns
Tools to work with the Google DNS over HTTPS (DoH) API
## Description
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/doh/>.
The following functions are implemented: The following functions are implemented:
Core:
- `query` / `dig`: Perform DNS over HTTPS queries using Google
- `bulk_query`: Vectorized query, returning only answers in a data frame - `bulk_query`: Vectorized query, returning only answers in a data frame
- `as.data.frame`: Coerce a gdns query response answer to a data frame
Helpers:
- `has_spf`: Test for whether a DNS TXT record is an SPF record - `has_spf`: Test for whether a DNS TXT record is an SPF record
- `is_hard_fail`: SPF "all" type test - `is_hard_fail`: SPF "all" type test
- `is_soft_fail`: SPF "all" type test - `is_soft_fail`: SPF "all" type test
- `passes_all`: 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_exists`: SPF field extraction functions
- `spf_includes`: SPF field extraction functions - `spf_includes`: SPF field extraction functions
- `spf_ipv4s`: SPF field extraction functions - `spf_ipv4s`: SPF field extraction functions
@ -36,9 +50,24 @@ The following functions are implemented:
- `spf_ptrs`: SPF field extraction functions - `spf_ptrs`: SPF field extraction functions
- `split_spf`: Split out all SPF records in a domain's TXT record - `split_spf`: Split out all SPF records in a domain's TXT record
IANA Datasets:
- `dns_classes`: DNS CLASSes (dataset)
- `dns_glob_names`: Underscored and Globally Scoped DNS Node Names (dataset)
- `dns_opcodes`: DNS OpCodes (dataset)
- `dns_rcodes`: DNS RCODEs (dataset)
- `edns0_option_codes`: DNS EDNS0 Option Codes (OPT) (dataset)
- `rrtypes`: Resource Record (RR) TYPEs (dataset)
### Installation ### Installation
Any of the following:
```{r eval=FALSE} ```{r eval=FALSE}
install("gdns", repos = "https://cinc.rud.is")
devtools::install_git("https://git.rud.is/hrbrmstr/gdns")
devtools::install_bitbucket("hrbrmstr/gdns")
devtools::install_gitlab("hrbrmstr/gdns")
devtools::install_github("hrbrmstr/gdns") devtools::install_github("hrbrmstr/gdns")
``` ```
@ -50,39 +79,37 @@ options(width=120)
```{r} ```{r}
library(gdns) library(gdns)
library(tibble) # for printing
# current verison # current verison
packageVersion("gdns") packageVersion("gdns")
str(query("rud.is")) str(query("rud.is"))
str(query("example.com", "255")) # "ANY" query query("rud.is") %>%
as.data.frame()
str(query("microsoft.com", "MX")) str(dig("example.com", "255")) # "ANY" query
str(query("google-public-dns-a.google.com", "TXT")) query("microsoft.com", "MX") %>%
as.data.frame()
str(query("apple.com")) as.data.frame(query("apple.com"))
str(query("17.142.160.59", "PTR")) as.data.frame(dig("17.142.160.59", "PTR"))
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com") hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts) gdns::bulk_query(hosts)
``` ```
### Test Results ## gdns Metrics
```{r}
library(gdns)
library(testthat)
date()
test_dir("tests/") ```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
``` ```
### Code of Conduct ## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). 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. By participating in this project you agree to abide by its terms.

288
README.md

@ -4,7 +4,11 @@
[![Travis-CI Build [![Travis-CI Build
Status](https://travis-ci.org/hrbrmstr/gdns.svg?branch=master)](https://travis-ci.org/hrbrmstr/gdns) 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 # gdns
Tools to work with the Google DNS over HTTPS (DoH) API
## Description
Traditional DNS queries and responses are sent over UDP or TCP without Traditional DNS queries and responses are sent over UDP or TCP without
encryption. This is vulnerable to eavesdropping and spoofing (including encryption. This is vulnerable to eavesdropping and spoofing (including
@ -18,18 +22,23 @@ encrypted HTTPS connection. DNS-over-HTTPS greatly enhances privacy and
security between a client and a recursive resolver, and complements security between a client and a recursive resolver, and complements
DNSSEC to provide end-to-end authenticated DNS lookups. DNSSEC to provide end-to-end authenticated DNS lookups.
More info at More info at <https://developers.google.com/speed/public-dns/docs/doh/>.
<https://developers.google.com/speed/public-dns/docs/dns-over-https>.
The following functions are implemented: The following functions are implemented:
Core:
- `query` / `dig`: Perform DNS over HTTPS queries using Google
- `bulk_query`: Vectorized query, returning only answers in a data - `bulk_query`: Vectorized query, returning only answers in a data
frame frame
- `as.data.frame`: Coerce a gdns query response answer to a data frame
Helpers:
- `has_spf`: Test for whether a DNS TXT record is an SPF record - `has_spf`: Test for whether a DNS TXT record is an SPF record
- `is_hard_fail`: SPF “all” type test - `is_hard_fail`: SPF “all” type test
- `is_soft_fail`: SPF “all” type test - `is_soft_fail`: SPF “all” type test
- `passes_all`: 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_exists`: SPF field extraction functions
- `spf_includes`: SPF field extraction functions - `spf_includes`: SPF field extraction functions
- `spf_ipv4s`: SPF field extraction functions - `spf_ipv4s`: SPF field extraction functions
@ -37,9 +46,25 @@ The following functions are implemented:
- `spf_ptrs`: SPF field extraction functions - `spf_ptrs`: SPF field extraction functions
- `split_spf`: Split out all SPF records in a domain’s TXT record - `split_spf`: Split out all SPF records in a domain’s TXT record
IANA Datasets:
- `dns_classes`: DNS CLASSes (dataset)
- `dns_glob_names`: Underscored and Globally Scoped DNS Node Names
(dataset)
- `dns_opcodes`: DNS OpCodes (dataset)
- `dns_rcodes`: DNS RCODEs (dataset)
- `edns0_option_codes`: DNS EDNS0 Option Codes (OPT) (dataset)
- `rrtypes`: Resource Record (RR) TYPEs (dataset)
### Installation ### Installation
Any of the following:
``` r ``` r
install("gdns", repos = "https://cinc.rud.is")
devtools::install_git("https://git.rud.is/hrbrmstr/gdns")
devtools::install_bitbucket("hrbrmstr/gdns")
devtools::install_gitlab("hrbrmstr/gdns")
devtools::install_github("hrbrmstr/gdns") devtools::install_github("hrbrmstr/gdns")
``` ```
@ -47,163 +72,130 @@ devtools::install_github("hrbrmstr/gdns")
``` r ``` r
library(gdns) library(gdns)
library(tibble) # for printing
# current verison # current verison
packageVersion("gdns") packageVersion("gdns")
#> [1] '0.3.1' ```
## [1] '0.4.0'
``` r
str(query("rud.is")) str(query("rud.is"))
#> List of 10 ```
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi FALSE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "rud.is."
#> ..$ type: int 1
#> $ Answer :'data.frame': 1 obs. of 4 variables:
#> ..$ name: chr "rud.is."
#> ..$ type: int 1
#> ..$ TTL : int 1152
#> ..$ data: chr "104.236.112.222"
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
str(query("example.com", "255")) # "ANY" query
#> List of 10
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi TRUE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "example.com."
#> ..$ type: int 255
#> $ Answer :'data.frame': 20 obs. of 4 variables:
#> ..$ name: chr [1:20] "example.com." "example.com." "example.com." "example.com." ...
#> ..$ type: int [1:20] 6 46 47 46 2 2 46 28 46 1 ...
#> ..$ TTL : int [1:20] 3562 3562 3562 21562 21562 21562 21562 21562 21562 21562 ...
#> ..$ data: chr [1:20] "sns.dns.icann.org. noc.dns.icann.org. 2018080125 7200 3600 1209600 3600" "nsec 8 2 3600 1538855995 1537006806 63855 example.com. pFyGCdsJ2uw2FcRlszW1VuM6FRV1rHbBfeBmp/Jaecdth8njienGYt2k"| __truncated__ "www.example.com. A NS SOA TXT AAAA RRSIG NSEC DNSKEY" "ns 8 2 86400 1538826642 1537014006 63855 example.com. U7KJg6I3XylL5aT10B3tHw9MIV8QoHBlmzO3CwghRh4I00ZzF2IgjakMp"| __truncated__ ...
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
str(query("microsoft.com", "MX"))
#> List of 11
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi FALSE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "microsoft.com."
#> ..$ type: int 15
#> $ Answer :'data.frame': 1 obs. of 4 variables:
#> ..$ name: chr "microsoft.com."
#> ..$ type: int 15
#> ..$ TTL : int 3599
#> ..$ data: chr "10 microsoft-com.mail.protection.outlook.com."
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
#> $ Comment : chr "Response from 208.76.45.53."
str(query("google-public-dns-a.google.com", "TXT"))
#> List of 10
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi FALSE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "google-public-dns-a.google.com."
#> ..$ type: int 16
#> $ Answer :'data.frame': 1 obs. of 4 variables:
#> ..$ name: chr "google-public-dns-a.google.com."
#> ..$ type: int 16
#> ..$ TTL : int 21432
#> ..$ data: chr "\"http://xkcd.com/1361/\""
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
str(query("apple.com"))
#> List of 10
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi FALSE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "apple.com."
#> ..$ type: int 1
#> $ Answer :'data.frame': 3 obs. of 4 variables:
#> ..$ name: chr [1:3] "apple.com." "apple.com." "apple.com."
#> ..$ type: int [1:3] 1 1 1
#> ..$ TTL : int [1:3] 2635 2635 2635
#> ..$ data: chr [1:3] "17.172.224.47" "17.178.96.59" "17.142.160.59"
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
str(query("17.142.160.59", "PTR"))
#> List of 10
#> $ Status : int 0
#> $ TC : logi FALSE
#> $ RD : logi TRUE
#> $ RA : logi TRUE
#> $ AD : logi FALSE
#> $ CD : logi FALSE
#> $ Question :'data.frame': 1 obs. of 2 variables:
#> ..$ name: chr "59.160.142.17.in-addr.arpa."
#> ..$ type: int 12
#> $ Answer :'data.frame': 5 obs. of 4 variables:
#> ..$ name: chr [1:5] "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." "59.160.142.17.in-addr.arpa." ...
#> ..$ type: int [1:5] 12 12 12 12 12
#> ..$ TTL : int [1:5] 3588 3588 3588 3588 3588
#> ..$ data: chr [1:5] "apple.by." "apple.com." "pv-apple-com.apple.com." "ipad.host." ...
#> $ Additional : list()
#> $ edns_client_subnet: chr "0.0.0.0/0"
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com") ## List of 11
## $ Status : int 0
## $ TC : logi FALSE
## $ RD : logi TRUE
## $ RA : logi TRUE
## $ AD : logi FALSE
## $ CD : logi FALSE
## $ Question :'data.frame': 1 obs. of 2 variables:
## ..$ name: chr "rud.is."
## ..$ type: int 1
## $ Answer :'data.frame': 1 obs. of 4 variables:
## ..$ name: chr "rud.is."
## ..$ type: int 1
## ..$ TTL : int 3599
## ..$ data: chr "172.93.49.183"
## $ Additional : list()
## $ edns_client_subnet: chr "0.0.0.0/0"
## $ Comment : chr "Response from 84.246.124.75."
## - attr(*, "class")= chr [1:2] "gdns_response" "list"
gdns::bulk_query(hosts) ``` r
#> name type TTL data entity query("rud.is") %>%
#> 1 rud.is. 1 1151 104.236.112.222 rud.is as.data.frame()
#> 2 dds.ec. 1 599 185.53.178.9 dds.ec
#> 3 r-project.org. 1 7031 137.208.57.37 r-project.org
#> 4 rstudio.com. 1 3431 104.196.200.5 rstudio.com
#> 5 apple.com. 1 2718 17.178.96.59 apple.com
#> 6 apple.com. 1 2718 17.142.160.59 apple.com
#> 7 apple.com. 1 2718 17.172.224.47 apple.com
``` ```
### Test Results ## # A tibble: 1 x 6
## query qtype name type ttl data
## * <chr> <int> <chr> <int> <int> <chr>
## 1 rud.is. 1 rud.is. 1 3599 172.93.49.183
``` r ``` r
library(gdns) str(dig("example.com", "255")) # "ANY" query
library(testthat) ```
date() ## List of 10
#> [1] "Sun Sep 16 13:23:55 2018" ## $ Status : int 0
## $ TC : logi FALSE
test_dir("tests/") ## $ RD : logi TRUE
#> ✔ | OK F W S | Context ## $ RA : logi TRUE
#> ══ testthat results ═════════════════════════════════════════════════════════════════════════════════════════ ## $ AD : logi TRUE
#> OK: 2 SKIPPED: 0 FAILED: 0 ## $ CD : logi FALSE
#> ## $ Question :'data.frame': 1 obs. of 2 variables:
#> ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════ ## ..$ name: chr "example.com."
#> Duration: 0.4 s ## ..$ type: int 255
#> ## $ Answer :'data.frame': 18 obs. of 4 variables:
#> OK: 0 ## ..$ name: chr [1:18] "example.com." "example.com." "example.com." "example.com." ...
#> Failed: 0 ## ..$ type: int [1:18] 6 46 46 46 46 46 46 46 46 47 ...
#> Warnings: 0 ## ..$ TTL : int [1:18] 1533 19533 19533 1533 19533 19533 1533 1533 1533 1533 ...
#> Skipped: 0 ## ..$ data: chr [1:18] "sns.dns.icann.org. noc.dns.icann.org. 2019041044 7200 3600 1209600 3600" "a 8 2 86400 1562528621 1560723663 23689 example.com. fdyvf2c+HYL8Qt9UXB+KLdnvuWyeE9U2i7pR9vnb59L6E7eBCxeGGZAVBf"| __truncated__ "ns 8 2 86400 1562498297 1560694863 23689 example.com. c2wn0Bz2Yb6T545v7f3O7XH8/gwRqPDlho6jtVNC9f7qL8lidsfTTpOPl"| __truncated__ "soa 8 2 3600 1562561021 1560759663 23689 example.com. icHLconr6/MiDdoLcVEFXErYXJ6XgZK+r/Q25Xu4sKKaKQhIgkDzeX+Fn"| __truncated__ ...
## $ Additional : list()
## $ edns_client_subnet: chr "0.0.0.0/0"
## - attr(*, "class")= chr [1:2] "gdns_response" "list"
``` r
query("microsoft.com", "MX") %>%
as.data.frame()
```
## # A tibble: 1 x 6
## query qtype name type ttl data
## * <chr> <int> <chr> <int> <int> <chr>
## 1 microsoft.com. 15 microsoft.com. 15 2904 10 microsoft-com.mail.protection.outlook.com.
``` r
as.data.frame(query("apple.com"))
```
## # A tibble: 3 x 6
## query qtype name type ttl data
## * <chr> <int> <chr> <int> <int> <chr>
## 1 apple.com. 1 apple.com. 1 3274 17.172.224.47
## 2 apple.com. 1 apple.com. 1 3274 17.178.96.59
## 3 apple.com. 1 apple.com. 1 3274 17.142.160.59
``` r
as.data.frame(dig("17.142.160.59", "PTR"))
```
## # A tibble: 5 x 6
## query qtype name type ttl data
## * <chr> <int> <chr> <int> <int> <chr>
## 1 59.160.142.17.in-addr.arpa. 12 59.160.142.17.in-addr.arpa. 12 102 appleid.org.
## 2 59.160.142.17.in-addr.arpa. 12 59.160.142.17.in-addr.arpa. 12 102 apple.by.
## 3 59.160.142.17.in-addr.arpa. 12 59.160.142.17.in-addr.arpa. 12 102 apple.com.
## 4 59.160.142.17.in-addr.arpa. 12 59.160.142.17.in-addr.arpa. 12 102 ipad.host.
## 5 59.160.142.17.in-addr.arpa. 12 59.160.142.17.in-addr.arpa. 12 102 pv-apple-com.apple.com.
``` r
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts)
``` ```
### Code of Conduct ## # A tibble: 7 x 7
## query qtype name type ttl data entity
## <chr> <int> <chr> <int> <int> <chr> <chr>
## 1 rud.is. 1 rud.is. 1 3598 172.93.49.183 rud.is
## 2 dds.ec. 1 dds.ec. 1 599 185.53.178.9 dds.ec
## 3 r-project.org. 1 r-project.org. 1 4469 137.208.57.37 r-project.org
## 4 rstudio.com. 1 rstudio.com. 1 3599 104.196.200.5 rstudio.com
## 5 apple.com. 1 apple.com. 1 2137 17.172.224.47 apple.com
## 6 apple.com. 1 apple.com. 1 2137 17.178.96.59 apple.com
## 7 apple.com. 1 apple.com. 1 2137 17.142.160.59 apple.com
## gdns Metrics
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 14 | 0.93 | 384 | 0.94 | 118 | 0.77 | 314 | 0.85 |
| Rmd | 1 | 0.07 | 26 | 0.06 | 35 | 0.23 | 54 | 0.15 |
## Code of Conduct
Please note that this project is released with a [Contributor Code of Please note that this project is released with a [Contributor Code of
Conduct](CONDUCT.md). By participating in this project you agree to Conduct](CONDUCT.md). By participating in this project you agree to

14
cran-comments.md

@ -1,18 +1,16 @@
## Test environments ## Test environments
* local OS X install, R 3.5.1 * local OS X install, R 3.6.0
* ubuntu 12.04 (on travis-ci), R 3.5.1 * ubuntu 14.04 (on travis-ci), R 3.6.0
* win-builder (devel and release) * win-builder (devel and release)
## R CMD check results ## R CMD check results
0 errors | 0 warnings | 1 note (maintainer/license) 0 errors | 0 warnings | 0 note
* This is a maintenance release. * This is a maintenance release.
--- ---
Thinned out dependencies and modified the code to account Google is changing the endpoint for the JSON REST API so
for chances in the Google DoH API + fixed a bug in bulk_query() this updates accounts for that change. New datasets and
response helpers have also been added.
Re-submitting as per email thread re: license (can't believe I
forgot that. sigh & apologies to the CRAN team.)

95
data-raw/rrtypes.R

@ -0,0 +1,95 @@
## code to prepare `rrtypes` dataset goes here
library(tidyverse)
library(xml2)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-2.csv")
dns_classes <- janitor::clean_names(xdf)
usethis::use_data(dns_classes, overwrite = TRUE)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-4.csv")
rrtypes <- janitor::clean_names(xdf)
usethis::use_data(rrtypes, overwrite = TRUE)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-5.csv")
dns_opcodes <- janitor::clean_names(xdf)
usethis::use_data(dns_opcodes, overwrite = TRUE)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-6.csv")
dns_rcodes <- janitor::clean_names(xdf)
usethis::use_data(dns_rcodes, overwrite = TRUE)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-11.csv")
edns0_option_codes <- janitor::clean_names(xdf)
usethis::use_data(edns0_option_codes, overwrite = TRUE)
xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/underscored-globally-scoped-dns-node-names.csv")
dns_glob_names <- janitor::clean_names(xdf)
usethis::use_data(dns_glob_names, overwrite = TRUE)
# https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
doc <- read_xml("https://www.iana.org/assignments/dns-parameters/dns-parameters.xml")
doc <- xml_ns_strip(doc)
fil <- here::here("R/datasets.R")
upd <- as.character(Sys.time())
c(
"dns_classes" = "dns-parameters-2",
"rrtypes" = "dns-parameters-4",
"dns_opcodes" = "dns-parameters-5",
"dns_rcodes" = "dns-parameters-6",
"edns0_option_codes" = "dns-parameters-11",
"dns_glob_names" = "underscored-globally-scoped-dns-node-names"
) -> ids
cat(
"# This file is autogenerated. Do not edit by hand.\n",
"# Last refresh: ", upd, "\n\n", sep = "",
file = fil
)
for (i in seq_along(ids)) {
dat <- names(ids)[i]
id <- unname(ids)[i]
id <- glue::glue(".//registry[@id = '{id}']")
node <- xml_find_first(doc, id)
note <- ""
if (!is.na(xml_text(xml_find_first(node, "note"))[[1]])) {
note <- sprintf("#' @note %s\n", gsub("\n", "", paste0(xml_text(xml_find_first(node, "note")), collapse = " ")))
}
cat(
"#' @md\n",
"#' @title ", xml_text(xml_find_first(node, "title")), " (dataset)\n",
"#' @description ", xml_text(xml_find_first(node, "title")), "\n",
"#' @format data frame with columns: ", paste0(sprintf("`%s`", colnames(get(names(ids)[i]))), collapse = ", "), "\n",
"#' @docType data\n",
"#' @keywords datasets\n",
"#' @name ", dat, "\n",
"#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#", unname(ids)[i], ">\n",
"#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>\n",
"#' @references ", paste0(xml_attr(xml_find_all(node, "xref"), "data"), collapse = ", "), "\n",
note,
"#' @note Last updated ", upd, "\n",
"#' @usage data('", dat, "')\n",
"NULL\n\n",
sep = "", file = fil, append = TRUE
)
}

BIN
data/dns_classes.rda

Binary file not shown.

BIN
data/dns_glob_names.rda

Binary file not shown.

BIN
data/dns_opcodes.rda

Binary file not shown.

BIN
data/dns_rcodes.rda

Binary file not shown.

BIN
data/edns0_option_codes.rda

Binary file not shown.

BIN
data/resource_record_tbl.rda

Binary file not shown.

BIN
data/rrtypes.rda

Binary file not shown.

16
man/as.data.frame.gdns_response.Rd

@ -0,0 +1,16 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as-data-frame.R
\name{as.data.frame.gdns_response}
\alias{as.data.frame.gdns_response}
\title{Coerce a gdns query response answer to a data frame}
\usage{
\method{as.data.frame}{gdns_response}(x, ...)
}
\arguments{
\item{x}{a `gdns_response` object}
\item{...}{unused}
}
\description{
Helper function to get to the `Answer` quickly
}

9
man/bulk_query.Rd

@ -4,7 +4,8 @@
\alias{bulk_query} \alias{bulk_query}
\title{Vectorized query, returning only answers in a data frame} \title{Vectorized query, returning only answers in a data frame}
\usage{ \usage{
bulk_query(entities, type = 1, edns_client_subnet = "0.0.0.0/0") bulk_query(entities, type = 1, cd = FALSE, do = FALSE,
edns_client_subnet = "0.0.0.0/0")
} }
\arguments{ \arguments{
\item{entities}{character vector of entities to query} \item{entities}{character vector of entities to query}
@ -13,6 +14,12 @@ bulk_query(entities, type = 1, edns_client_subnet = "0.0.0.0/0")
string (A, aaaa, etc). More information on RR types can be string (A, aaaa, etc). More information on RR types can be
found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.} found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.}
\item{cd}{(Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
Default: `FALSE`.}
\item{do}{(DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
Default: `FALSE`.}
\item{edns_client_subnet}{The edns0-client-subnet option. Format is an IP \item{edns_client_subnet}{The edns0-client-subnet option. Format is an IP
address with a subnet mask. Examples: \code{1.2.3.4/24}, address with a subnet mask. Examples: \code{1.2.3.4/24},
\code{2001:700:300::/48}.\cr \code{2001:700:300::/48}.\cr

26
man/dns_classes.Rd

@ -0,0 +1,26 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{dns_classes}
\alias{dns_classes}
\title{DNS CLASSes (dataset)}
\format{data frame with columns: \code{decimal}, \code{hexadecimal}, \code{name}, \code{reference}}
\usage{
data('dns_classes')
}
\description{
DNS CLASSes
}
\note{
As noted in , Multicast DNS can only carry DNS records with classes in the range 0-32767. Classes in the range 32768 to 65535 are incompatible with Multicast DNS.
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc6895
}
\keyword{datasets}

24
man/dns_glob_names.Rd

@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{dns_glob_names}
\alias{dns_glob_names}
\title{Underscored and Globally Scoped DNS Node Names (dataset)}
\format{data frame with columns: \code{rr_type}, \code{node_name}, \code{reference}}
\usage{
data('dns_glob_names')
}
\description{
Underscored and Globally Scoped DNS Node Names
}
\note{
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#underscored-globally-scoped-dns-node-names}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc8552
}
\keyword{datasets}

24
man/dns_opcodes.Rd

@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{dns_opcodes}
\alias{dns_opcodes}
\title{DNS OpCodes (dataset)}
\format{data frame with columns: \code{op_code}, \code{name}, \code{reference}}
\usage{
data('dns_opcodes')
}
\description{
DNS OpCodes
}
\note{
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc6895, rfc1035
}
\keyword{datasets}

24
man/dns_rcodes.Rd

@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{dns_rcodes}
\alias{dns_rcodes}
\title{DNS RCODEs (dataset)}
\format{data frame with columns: \code{rcode}, \code{name}, \code{description}, \code{reference}}
\usage{
data('dns_rcodes')
}
\description{
DNS RCODEs
}
\note{
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc6895, rfc1035
}
\keyword{datasets}

26
man/edns0_option_codes.Rd

@ -0,0 +1,26 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{edns0_option_codes}
\alias{edns0_option_codes}
\title{DNS EDNS0 Option Codes (OPT) (dataset)}
\format{data frame with columns: \code{value}, \code{name}, \code{status}, \code{reference}}
\usage{
data('edns0_option_codes')
}
\description{
DNS EDNS0 Option Codes (OPT)
}
\note{
Registrations made by standards-track documents are listed as "Standard," and by non-standards-track documents as "Optional." Registrations for which there are no final specifications are listed as "On-Hold."
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc6891, 3604
}
\keyword{datasets}

12
man/pipe.Rd

@ -0,0 +1,12 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils-pipe.R
\name{\%>\%}
\alias{\%>\%}
\title{Pipe operator}
\usage{
lhs \%>\% rhs
}
\description{
See \code{magrittr::\link[magrittr]{\%>\%}} for details.
}
\keyword{internal}

28
man/query.Rd

@ -2,9 +2,14 @@
% Please edit documentation in R/zgdns.r % Please edit documentation in R/zgdns.r
\name{query} \name{query}
\alias{query} \alias{query}
\alias{dig}
\title{Perform DNS over HTTPS queries using Google} \title{Perform DNS over HTTPS queries using Google}
\usage{ \usage{
query(name, type = "1", edns_client_subnet = "0.0.0.0/0") query(name, type = "1", cd = FALSE, do = FALSE,
edns_client_subnet = "0.0.0.0/0", random_padding = NULL)
dig(name, type = "1", cd = FALSE, do = FALSE,
edns_client_subnet = "0.0.0.0/0", random_padding = NULL)
} }
\arguments{ \arguments{
\item{name}{item to lookup. Valid characters are numbers, letters, hyphen, and dot. Length \item{name}{item to lookup. Valid characters are numbers, letters, hyphen, and dot. Length
@ -19,6 +24,12 @@ string (A, aaaa, etc). More information on RR types can be
found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}. found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.
You can use \code{255} for an \code{ANY} query.} You can use \code{255} for an \code{ANY} query.}
\item{cd}{(Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
Default: `FALSE`.}
\item{do}{(DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
Default: `FALSE`.}
\item{edns_client_subnet}{The edns0-client-subnet option. Format is an IP \item{edns_client_subnet}{The edns0-client-subnet option. Format is an IP
address with a subnet mask. Examples: \code{1.2.3.4/24}, address with a subnet mask. Examples: \code{1.2.3.4/24},
\code{2001:700:300::/48}.\cr \code{2001:700:300::/48}.\cr
@ -28,6 +39,13 @@ nameservers for geographic location accuracy, use
\code{edns_client_subnet=0.0.0.0/0}. Google Public DNS normally sends \code{edns_client_subnet=0.0.0.0/0}. Google Public DNS normally sends
approximate network information (usually replacing the last part of approximate network information (usually replacing the last part of
your IPv4 address with zeroes). \code{0.0.0.0/0} is the default.} your IPv4 address with zeroes). \code{0.0.0.0/0} is the default.}
\item{random_padding}{clients concerned about possible side-channel privacy
attacks using the packet sizes of HTTPS GET requests can use this to
make all requests exactly the same size by padding requests with random data.
To prevent misinterpretation of the URL, restrict the padding characters to
the unreserved URL characters: upper- and lower-case letters, digits,
hyphen, period, underscore and tilde.}
} }
\value{ \value{
a \code{list} with the query result or \code{NULL} if an error occurred a \code{list} with the query result or \code{NULL} if an error occurred
@ -51,12 +69,12 @@ To perform vectorized queries with only answers (and no metadata) use
} }
\examples{ \examples{
query("rud.is") query("rud.is")
query("example.com", "255") # ANY query dig("example.com", "255") # ANY query
query("microsoft.com", "MX") query("microsoft.com", "MX")
query("google-public-dns-a.google.com", "TXT") dig("google-public-dns-a.google.com", "TXT")
query("apple.com") query("apple.com")
query("17.142.160.59", "PTR") dig("17.142.160.59", "PTR")
} }
\references{ \references{
\url{https://developers.google.com/speed/public-dns/docs/dns-over-https} <https://developers.google.com/speed/public-dns/docs/doh/json>
} }

24
man/rrtypes.Rd

@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/datasets.R
\docType{data}
\name{rrtypes}
\alias{rrtypes}
\title{Resource Record (RR) TYPEs (dataset)}
\format{data frame with columns: \code{type}, \code{value}, \code{meaning}, \code{reference}, \code{template}, \code{registration_date}}
\usage{
data('rrtypes')
}
\description{
Resource Record (RR) TYPEs
}
\note{
Last updated 2019-06-27 11:16:48
}
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
rfc6895, rfc1035
}
\keyword{datasets}

2
tests/testthat/test-gdns.R

@ -6,6 +6,6 @@ test_that("we can do something", {
doms <- c("example.com", "example.org", "example.net") doms <- c("example.com", "example.org", "example.net")
qry <- gdns::bulk_query(doms) qry <- gdns::bulk_query(doms)
expect_that(dim(qry), equals(c(3, 5))) expect_that(dim(qry), equals(c(3, 7)))
}) })

Loading…
Cancel
Save