Browse Source

JSON API endpoint

boB Rudis 4 months ago
parent
commit
c97226ebc3
No known key found for this signature in database

+ 1
- 0
.Rbuildignore View File

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

+ 4
- 3
DESCRIPTION View File

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

+ 4
- 0
NAMESPACE View File

@@ -1,6 +1,9 @@
1 1
 # Generated by roxygen2: do not edit by hand
2 2
 
3
+S3method(as.data.frame,gdns_response)
4
+export("%>%")
3 5
 export(bulk_query)
6
+export(dig)
4 7
 export(has_spf)
5 8
 export(is_hard_fail)
6 9
 export(is_soft_fail)
@@ -14,6 +17,7 @@ export(spf_ptrs)
14 17
 export(split_spf)
15 18
 import(httr)
16 19
 importFrom(jsonlite,fromJSON)
20
+importFrom(magrittr,"%>%")
17 21
 importFrom(stats,terms)
18 22
 importFrom(stringi,stri_detect_fixed)
19 23
 importFrom(stringi,stri_enc_toutf8)

+ 7
- 0
NEWS.md View File

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

+ 35
- 0
R/as-data-frame.R View File

@@ -0,0 +1,35 @@
1
+#' Coerce a gdns query response answer to a data frame
2
+#'
3
+#' Helper function to get to the `Answer` quickly
4
+#' @param x a `gdns_response` object
5
+#' @param ... unused
6
+#' @export
7
+as.data.frame.gdns_response <- function(x, ...) {
8
+
9
+  if (length(x[["Answer"]]) == 0) {
10
+    data.frame(
11
+      name = NA_character_,
12
+      type = NA_character_,
13
+      ttl = NA_character_,
14
+      data = NA_character_,
15
+      stringsAsFactors = FALSE
16
+    ) -> out
17
+  } else {
18
+    out <- x[["Answer"]]
19
+  }
20
+
21
+  if (length(x[["Question"]][["name"]])) {
22
+    out[["query"]] <- x[["Question"]][["name"]][[1]]
23
+    out[["qtype"]] <- x[["Question"]][["type"]][[1]]
24
+  } else {
25
+    out[["query"]] <- NA_character_
26
+    out[["qtype"]] <- NA_character_
27
+  }
28
+
29
+  colnames(out) <- tolower(colnames(out))
30
+  out <- out[,c("query", "qtype", "name", "type", "ttl", "data")]
31
+
32
+  class(out) <- c("tbl_df", "tbl", "data.frame")
33
+  out
34
+
35
+}

+ 89
- 0
R/datasets.R View File

@@ -0,0 +1,89 @@
1
+# This file is autogenerated. Do not edit by hand.
2
+# Last refresh: 2019-06-27 11:16:48
3
+
4
+#' @md
5
+#' @title DNS CLASSes (dataset)
6
+#' @description DNS CLASSes
7
+#' @format data frame with columns: `decimal`, `hexadecimal`, `name`, `reference`
8
+#' @docType data
9
+#' @keywords datasets
10
+#' @name dns_classes
11
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2>
12
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
13
+#' @references rfc6895
14
+#' @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.
15
+#' @note Last updated 2019-06-27 11:16:48
16
+#' @usage data('dns_classes')
17
+NULL
18
+
19
+#' @md
20
+#' @title Resource Record (RR) TYPEs (dataset)
21
+#' @description Resource Record (RR) TYPEs
22
+#' @format data frame with columns: `type`, `value`, `meaning`, `reference`, `template`, `registration_date`
23
+#' @docType data
24
+#' @keywords datasets
25
+#' @name rrtypes
26
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4>
27
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
28
+#' @references rfc6895, rfc1035
29
+#' @note Last updated 2019-06-27 11:16:48
30
+#' @usage data('rrtypes')
31
+NULL
32
+
33
+#' @md
34
+#' @title DNS OpCodes (dataset)
35
+#' @description DNS OpCodes
36
+#' @format data frame with columns: `op_code`, `name`, `reference`
37
+#' @docType data
38
+#' @keywords datasets
39
+#' @name dns_opcodes
40
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5>
41
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
42
+#' @references rfc6895, rfc1035
43
+#' @note Last updated 2019-06-27 11:16:48
44
+#' @usage data('dns_opcodes')
45
+NULL
46
+
47
+#' @md
48
+#' @title DNS RCODEs (dataset)
49
+#' @description DNS RCODEs
50
+#' @format data frame with columns: `rcode`, `name`, `description`, `reference`
51
+#' @docType data
52
+#' @keywords datasets
53
+#' @name dns_rcodes
54
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6>
55
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
56
+#' @references rfc6895, rfc1035
57
+#' @note Last updated 2019-06-27 11:16:48
58
+#' @usage data('dns_rcodes')
59
+NULL
60
+
61
+#' @md
62
+#' @title DNS EDNS0 Option Codes (OPT) (dataset)
63
+#' @description DNS EDNS0 Option Codes (OPT)
64
+#' @format data frame with columns: `value`, `name`, `status`, `reference`
65
+#' @docType data
66
+#' @keywords datasets
67
+#' @name edns0_option_codes
68
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11>
69
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
70
+#' @references rfc6891, 3604
71
+#' @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."    
72
+#' @note Last updated 2019-06-27 11:16:48
73
+#' @usage data('edns0_option_codes')
74
+NULL
75
+
76
+#' @md
77
+#' @title Underscored and Globally Scoped DNS Node Names (dataset)
78
+#' @description Underscored and Globally Scoped DNS Node Names
79
+#' @format data frame with columns: `rr_type`, `node_name`, `reference`
80
+#' @docType data
81
+#' @keywords datasets
82
+#' @name dns_glob_names
83
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#underscored-globally-scoped-dns-node-names>
84
+#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
85
+#' @references rfc8552
86
+#' @note Last updated 2019-06-27 11:16:48
87
+#' @usage data('dns_glob_names')
88
+NULL
89
+

+ 11
- 0
R/utils-pipe.R View File

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

+ 11
- 15
R/zbulk-query.R View File

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

+ 34
- 8
R/zgdns.r View File

@@ -30,6 +30,16 @@ S_GET <- safely(httr::GET)
30 30
 #'        string (A, aaaa, etc). More information on RR types can be
31 31
 #'        found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.
32 32
 #'        You can use \code{255} for an \code{ANY} query.
33
+#' @param cd (Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
34
+#'        Default: `FALSE`.
35
+#' @param do (DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
36
+#'        Default: `FALSE`.
37
+#' @param random_padding clients concerned about possible side-channel privacy
38
+#'        attacks using the packet sizes of HTTPS GET requests can use this to
39
+#'        make all requests exactly the same size by padding requests with random data.
40
+#'        To prevent misinterpretation of the URL, restrict the padding characters to
41
+#'        the unreserved URL characters: upper- and lower-case letters, digits,
42
+#'        hyphen, period, underscore and tilde.
33 43
 #' @param edns_client_subnet The edns0-client-subnet option. Format is an IP
34 44
 #'        address with a subnet mask. Examples: \code{1.2.3.4/24},
35 45
 #'        \code{2001:700:300::/48}.\cr
@@ -40,16 +50,22 @@ S_GET <- safely(httr::GET)
40 50
 #'        approximate network information (usually replacing the last part of
41 51
 #'        your IPv4 address with zeroes). \code{0.0.0.0/0} is the default.
42 52
 #' @return a \code{list} with the query result or \code{NULL} if an error occurred
43
-#' @references \url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
53
+#' @references <https://developers.google.com/speed/public-dns/docs/doh/json>
44 54
 #' @export
45 55
 #' @examples
46 56
 #' query("rud.is")
47
-#' query("example.com", "255") # ANY query
57
+#' dig("example.com", "255") # ANY query
48 58
 #' query("microsoft.com", "MX")
49
-#' query("google-public-dns-a.google.com", "TXT")
59
+#' dig("google-public-dns-a.google.com", "TXT")
50 60
 #' query("apple.com")
51
-#' query("17.142.160.59", "PTR")
52
-query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
61
+#' dig("17.142.160.59", "PTR")
62
+query <- function(name, type = "1", cd = FALSE, do = FALSE,
63
+                  edns_client_subnet = "0.0.0.0/0",
64
+                  random_padding = NULL) {
65
+
66
+  name <- name[1]
67
+
68
+  # helper to turn IPv4 addresses in to in-addr.arpa.
53 69
 
54 70
   if (grepl(ipv4_regex, name)) {
55 71
     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") {
58 74
   }
59 75
 
60 76
   res <- S_GET(
61
-    url = "https://dns.google.com/resolve",
77
+    url = "https://dns.google/resolve",
62 78
     query = list(
63 79
       name = name,
64 80
       type = type,
65
-      edns_client_subnet = edns_client_subnet
81
+      cd = if (cd) 1 else 0,
82
+      do = if (do) 1 else 0,
83
+      ct = "application/x-javascript",
84
+      edns_client_subnet = edns_client_subnet,
85
+      random_padding = random_padding
66 86
     )
67 87
   )
68 88
 
@@ -71,9 +91,15 @@ query <- function(name, type="1", edns_client_subnet="0.0.0.0/0") {
71 91
     txt <- httr::content(res$result, as="text")
72 92
     txt <- stringi::stri_enc_toascii(txt)
73 93
     txt <- stringi::stri_replace_all_regex(txt, "[[:cntrl:][:blank:]\\n ]+", " ")
74
-    jsonlite::fromJSON(txt)
94
+    out <- jsonlite::fromJSON(txt)
95
+    class(out) <- c("gdns_response", "list")
96
+    out
75 97
   } else {
76 98
     NULL
77 99
   }
78 100
 
79 101
 }
102
+
103
+#' @rdname query
104
+#' @export
105
+dig <- query

+ 48
- 21
README.Rmd View File

@@ -1,34 +1,48 @@
1 1
 ---
2 2
 output: rmarkdown::github_document
3
+editor_options: 
4
+  chunk_output_type: console
3 5
 ---
4 6
 
5 7
 <!-- README.md is generated from README.Rmd. Please edit that file -->
6 8
 
7
-```{r, echo = FALSE}
9
+```{r include=FALSE}
8 10
 knitr::opts_chunk$set(
9
-  collapse = TRUE,
10
-  comment = "#>",
11
-  fig.path = "README-"
11
+  message = FALSE,
12
+  warning = FALSE,
13
+  fig.retina = 2
12 14
 )
15
+options(width=120)
13 16
 ```
17
+
14 18
 [![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/gdns.svg?branch=master)](https://travis-ci.org/hrbrmstr/gdns)
15 19
 
16
-`gdns` : Tools to work with the Google DNS over HTTPS API
20
+# gdns
21
+
22
+Tools to work with the Google DNS over HTTPS (DoH) API
23
+
24
+## Description
17 25
 
18 26
 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.
19 27
 
20 28
 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.
21 29
 
22
-More info at <https://developers.google.com/speed/public-dns/docs/dns-over-https>.
30
+More info at <https://developers.google.com/speed/public-dns/docs/doh/>.
23 31
 
24 32
 The following functions are implemented:
25 33
 
34
+Core: 
35
+
36
+- `query` / `dig`:	Perform DNS over HTTPS queries using Google
26 37
 - `bulk_query`:	Vectorized query, returning only answers in a data frame
38
+- `as.data.frame`: Coerce a gdns query response answer to a data frame
39
+
40
+Helpers:
41
+
27 42
 - `has_spf`:	Test for whether a DNS TXT record is an SPF record
28 43
 - `is_hard_fail`:	SPF "all" type test
29 44
 - `is_soft_fail`:	SPF "all" type test
30 45
 - `passes_all`:	SPF "all" type test
31
-- `query`:	Perform DNS over HTTPS queries using Google
32 46
 - `spf_exists`:	SPF field extraction functions
33 47
 - `spf_includes`:	SPF field extraction functions
34 48
 - `spf_ipv4s`:	SPF field extraction functions
@@ -36,9 +50,24 @@ The following functions are implemented:
36 50
 - `spf_ptrs`:	SPF field extraction functions
37 51
 - `split_spf`:	Split out all SPF records in a domain's TXT record
38 52
 
53
+IANA Datasets:
54
+
55
+- `dns_classes`: DNS CLASSes (dataset)
56
+- `dns_glob_names`:  Underscored and Globally Scoped DNS Node Names (dataset)
57
+- `dns_opcodes`: DNS OpCodes (dataset)
58
+- `dns_rcodes`:  DNS RCODEs (dataset)
59
+- `edns0_option_codes`:  DNS EDNS0 Option Codes (OPT) (dataset)
60
+- `rrtypes`: Resource Record (RR) TYPEs (dataset)
61
+
39 62
 ### Installation
40 63
 
64
+Any of the following:
65
+
41 66
 ```{r eval=FALSE}
67
+install("gdns", repos = "https://cinc.rud.is")
68
+devtools::install_git("https://git.rud.is/hrbrmstr/gdns")
69
+devtools::install_bitbucket("hrbrmstr/gdns")
70
+devtools::install_gitlab("hrbrmstr/gdns")
42 71
 devtools::install_github("hrbrmstr/gdns")
43 72
 ```
44 73
 
@@ -50,39 +79,37 @@ options(width=120)
50 79
 
51 80
 ```{r}
52 81
 library(gdns)
82
+library(tibble) # for printing
53 83
 
54 84
 # current verison
55 85
 packageVersion("gdns")
56 86
 
57 87
 str(query("rud.is"))
58 88
 
59
-str(query("example.com", "255")) # "ANY" query
89
+query("rud.is") %>% 
90
+  as.data.frame()
60 91
 
61
-str(query("microsoft.com", "MX"))
92
+str(dig("example.com", "255")) # "ANY" query
62 93
 
63
-str(query("google-public-dns-a.google.com", "TXT"))
94
+query("microsoft.com", "MX") %>% 
95
+  as.data.frame()
64 96
 
65
-str(query("apple.com"))
97
+as.data.frame(query("apple.com"))
66 98
 
67
-str(query("17.142.160.59", "PTR"))
99
+as.data.frame(dig("17.142.160.59", "PTR"))
68 100
 
69 101
 hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
70 102
 
71 103
 gdns::bulk_query(hosts)
72 104
 ```
73 105
 
74
-### Test Results
75
-
76
-```{r}
77
-library(gdns)
78
-library(testthat)
79
-
80
-date()
106
+## gdns Metrics
81 107
 
82
-test_dir("tests/")
108
+```{r cloc, echo=FALSE}
109
+cloc::cloc_pkg_md()
83 110
 ```
84 111
 
85
-### Code of Conduct
112
+## Code of Conduct
86 113
 
87 114
 Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). 
88 115
 By participating in this project you agree to abide by its terms.

+ 140
- 148
README.md View File

@@ -4,7 +4,11 @@
4 4
 [![Travis-CI Build
5 5
 Status](https://travis-ci.org/hrbrmstr/gdns.svg?branch=master)](https://travis-ci.org/hrbrmstr/gdns)
6 6
 
7
-`gdns` : Tools to work with the Google DNS over HTTPS API
7
+# gdns
8
+
9
+Tools to work with the Google DNS over HTTPS (DoH) API
10
+
11
+## Description
8 12
 
9 13
 Traditional DNS queries and responses are sent over UDP or TCP without
10 14
 encryption. This is vulnerable to eavesdropping and spoofing (including
@@ -18,18 +22,23 @@ encrypted HTTPS connection. DNS-over-HTTPS greatly enhances privacy and
18 22
 security between a client and a recursive resolver, and complements
19 23
 DNSSEC to provide end-to-end authenticated DNS lookups.
20 24
 
21
-More info at
22
-<https://developers.google.com/speed/public-dns/docs/dns-over-https>.
25
+More info at <https://developers.google.com/speed/public-dns/docs/doh/>.
23 26
 
24 27
 The following functions are implemented:
25 28
 
29
+Core:
30
+
31
+  - `query` / `dig`: Perform DNS over HTTPS queries using Google
26 32
   - `bulk_query`: Vectorized query, returning only answers in a data
27 33
     frame
34
+  - `as.data.frame`: Coerce a gdns query response answer to a data frame
35
+
36
+Helpers:
37
+
28 38
   - `has_spf`: Test for whether a DNS TXT record is an SPF record
29 39
   - `is_hard_fail`: SPF “all” type test
30 40
   - `is_soft_fail`: SPF “all” type test
31 41
   - `passes_all`: SPF “all” type test
32
-  - `query`: Perform DNS over HTTPS queries using Google
33 42
   - `spf_exists`: SPF field extraction functions
34 43
   - `spf_includes`: SPF field extraction functions
35 44
   - `spf_ipv4s`: SPF field extraction functions
@@ -37,9 +46,25 @@ The following functions are implemented:
37 46
   - `spf_ptrs`: SPF field extraction functions
38 47
   - `split_spf`: Split out all SPF records in a domain’s TXT record
39 48
 
49
+IANA Datasets:
50
+
51
+  - `dns_classes`: DNS CLASSes (dataset)
52
+  - `dns_glob_names`: Underscored and Globally Scoped DNS Node Names
53
+    (dataset)
54
+  - `dns_opcodes`: DNS OpCodes (dataset)
55
+  - `dns_rcodes`: DNS RCODEs (dataset)
56
+  - `edns0_option_codes`: DNS EDNS0 Option Codes (OPT) (dataset)
57
+  - `rrtypes`: Resource Record (RR) TYPEs (dataset)
58
+
40 59
 ### Installation
41 60
 
61
+Any of the following:
62
+
42 63
 ``` r
64
+install("gdns", repos = "https://cinc.rud.is")
65
+devtools::install_git("https://git.rud.is/hrbrmstr/gdns")
66
+devtools::install_bitbucket("hrbrmstr/gdns")
67
+devtools::install_gitlab("hrbrmstr/gdns")
43 68
 devtools::install_github("hrbrmstr/gdns")
44 69
 ```
45 70
 
@@ -47,163 +72,130 @@ devtools::install_github("hrbrmstr/gdns")
47 72
 
48 73
 ``` r
49 74
 library(gdns)
75
+library(tibble) # for printing
50 76
 
51 77
 # current verison
52 78
 packageVersion("gdns")
53
-#> [1] '0.3.1'
79
+```
54 80
 
81
+    ## [1] '0.4.0'
82
+
83
+``` r
55 84
 str(query("rud.is"))
56
-#> List of 10
57
-#>  $ Status            : int 0
58
-#>  $ TC                : logi FALSE
59
-#>  $ RD                : logi TRUE
60
-#>  $ RA                : logi TRUE
61
-#>  $ AD                : logi FALSE
62
-#>  $ CD                : logi FALSE
63
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
64
-#>   ..$ name: chr "rud.is."
65
-#>   ..$ type: int 1
66
-#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
67
-#>   ..$ name: chr "rud.is."
68
-#>   ..$ type: int 1
69
-#>   ..$ TTL : int 1152
70
-#>   ..$ data: chr "104.236.112.222"
71
-#>  $ Additional        : list()
72
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
73
-
74
-str(query("example.com", "255")) # "ANY" query
75
-#> List of 10
76
-#>  $ Status            : int 0
77
-#>  $ TC                : logi FALSE
78
-#>  $ RD                : logi TRUE
79
-#>  $ RA                : logi TRUE
80
-#>  $ AD                : logi TRUE
81
-#>  $ CD                : logi FALSE
82
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
83
-#>   ..$ name: chr "example.com."
84
-#>   ..$ type: int 255
85
-#>  $ Answer            :'data.frame':  20 obs. of  4 variables:
86
-#>   ..$ name: chr [1:20] "example.com." "example.com." "example.com." "example.com." ...
87
-#>   ..$ type: int [1:20] 6 46 47 46 2 2 46 28 46 1 ...
88
-#>   ..$ TTL : int [1:20] 3562 3562 3562 21562 21562 21562 21562 21562 21562 21562 ...
89
-#>   ..$ 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__ ...
90
-#>  $ Additional        : list()
91
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
92
-
93
-str(query("microsoft.com", "MX"))
94
-#> List of 11
95
-#>  $ Status            : int 0
96
-#>  $ TC                : logi FALSE
97
-#>  $ RD                : logi TRUE
98
-#>  $ RA                : logi TRUE
99
-#>  $ AD                : logi FALSE
100
-#>  $ CD                : logi FALSE
101
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
102
-#>   ..$ name: chr "microsoft.com."
103
-#>   ..$ type: int 15
104
-#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
105
-#>   ..$ name: chr "microsoft.com."
106
-#>   ..$ type: int 15
107
-#>   ..$ TTL : int 3599
108
-#>   ..$ data: chr "10 microsoft-com.mail.protection.outlook.com."
109
-#>  $ Additional        : list()
110
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
111
-#>  $ Comment           : chr "Response from 208.76.45.53."
112
-
113
-str(query("google-public-dns-a.google.com", "TXT"))
114
-#> List of 10
115
-#>  $ Status            : int 0
116
-#>  $ TC                : logi FALSE
117
-#>  $ RD                : logi TRUE
118
-#>  $ RA                : logi TRUE
119
-#>  $ AD                : logi FALSE
120
-#>  $ CD                : logi FALSE
121
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
122
-#>   ..$ name: chr "google-public-dns-a.google.com."
123
-#>   ..$ type: int 16
124
-#>  $ Answer            :'data.frame':  1 obs. of  4 variables:
125
-#>   ..$ name: chr "google-public-dns-a.google.com."
126
-#>   ..$ type: int 16
127
-#>   ..$ TTL : int 21432
128
-#>   ..$ data: chr "\"http://xkcd.com/1361/\""
129
-#>  $ Additional        : list()
130
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
131
-
132
-str(query("apple.com"))
133
-#> List of 10
134
-#>  $ Status            : int 0
135
-#>  $ TC                : logi FALSE
136
-#>  $ RD                : logi TRUE
137
-#>  $ RA                : logi TRUE
138
-#>  $ AD                : logi FALSE
139
-#>  $ CD                : logi FALSE
140
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
141
-#>   ..$ name: chr "apple.com."
142
-#>   ..$ type: int 1
143
-#>  $ Answer            :'data.frame':  3 obs. of  4 variables:
144
-#>   ..$ name: chr [1:3] "apple.com." "apple.com." "apple.com."
145
-#>   ..$ type: int [1:3] 1 1 1
146
-#>   ..$ TTL : int [1:3] 2635 2635 2635
147
-#>   ..$ data: chr [1:3] "17.172.224.47" "17.178.96.59" "17.142.160.59"
148
-#>  $ Additional        : list()
149
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
150
-
151
-str(query("17.142.160.59", "PTR"))
152
-#> List of 10
153
-#>  $ Status            : int 0
154
-#>  $ TC                : logi FALSE
155
-#>  $ RD                : logi TRUE
156
-#>  $ RA                : logi TRUE
157
-#>  $ AD                : logi FALSE
158
-#>  $ CD                : logi FALSE
159
-#>  $ Question          :'data.frame':  1 obs. of  2 variables:
160
-#>   ..$ name: chr "59.160.142.17.in-addr.arpa."
161
-#>   ..$ type: int 12
162
-#>  $ Answer            :'data.frame':  5 obs. of  4 variables:
163
-#>   ..$ 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." ...
164
-#>   ..$ type: int [1:5] 12 12 12 12 12
165
-#>   ..$ TTL : int [1:5] 3588 3588 3588 3588 3588
166
-#>   ..$ data: chr [1:5] "apple.by." "apple.com." "pv-apple-com.apple.com." "ipad.host." ...
167
-#>  $ Additional        : list()
168
-#>  $ edns_client_subnet: chr "0.0.0.0/0"
85
+```
169 86
 
170
-hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
87
+    ## List of 11
88
+    ##  $ Status            : int 0
89
+    ##  $ TC                : logi FALSE
90
+    ##  $ RD                : logi TRUE
91
+    ##  $ RA                : logi TRUE
92
+    ##  $ AD                : logi FALSE
93
+    ##  $ CD                : logi FALSE
94
+    ##  $ Question          :'data.frame':  1 obs. of  2 variables:
95
+    ##   ..$ name: chr "rud.is."
96
+    ##   ..$ type: int 1
97
+    ##  $ Answer            :'data.frame':  1 obs. of  4 variables:
98
+    ##   ..$ name: chr "rud.is."
99
+    ##   ..$ type: int 1
100
+    ##   ..$ TTL : int 3599
101
+    ##   ..$ data: chr "172.93.49.183"
102
+    ##  $ Additional        : list()
103
+    ##  $ edns_client_subnet: chr "0.0.0.0/0"
104
+    ##  $ Comment           : chr "Response from 84.246.124.75."
105
+    ##  - attr(*, "class")= chr [1:2] "gdns_response" "list"
171 106
 
172
-gdns::bulk_query(hosts)
173
-#>             name type  TTL            data        entity
174
-#> 1        rud.is.    1 1151 104.236.112.222        rud.is
175
-#> 2        dds.ec.    1  599    185.53.178.9        dds.ec
176
-#> 3 r-project.org.    1 7031   137.208.57.37 r-project.org
177
-#> 4   rstudio.com.    1 3431   104.196.200.5   rstudio.com
178
-#> 5     apple.com.    1 2718    17.178.96.59     apple.com
179
-#> 6     apple.com.    1 2718   17.142.160.59     apple.com
180
-#> 7     apple.com.    1 2718   17.172.224.47     apple.com
107
+``` r
108
+query("rud.is") %>% 
109
+  as.data.frame()
181 110
 ```
182 111
 
183
-### Test Results
112
+    ## # A tibble: 1 x 6
113
+    ##   query   qtype name     type   ttl data         
114
+    ## * <chr>   <int> <chr>   <int> <int> <chr>        
115
+    ## 1 rud.is.     1 rud.is.     1  3599 172.93.49.183
184 116
 
185 117
 ``` r
186
-library(gdns)
187
-library(testthat)
188
-
189
-date()
190
-#> [1] "Sun Sep 16 13:23:55 2018"
191
-
192
-test_dir("tests/")
193
-#> ✔ | OK F W S | Context
194
-#> ══ testthat results  ═════════════════════════════════════════════════════════════════════════════════════════
195
-#> OK: 2 SKIPPED: 0 FAILED: 0
196
-#> 
197
-#> ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════
198
-#> Duration: 0.4 s
199
-#> 
200
-#> OK:       0
201
-#> Failed:   0
202
-#> Warnings: 0
203
-#> Skipped:  0
118
+str(dig("example.com", "255")) # "ANY" query
119
+```
120
+
121
+    ## List of 10
122
+    ##  $ Status            : int 0
123
+    ##  $ TC                : logi FALSE
124
+    ##  $ RD                : logi TRUE
125
+    ##  $ RA                : logi TRUE
126
+    ##  $ AD                : logi TRUE
127
+    ##  $ CD                : logi FALSE
128
+    ##  $ Question          :'data.frame':  1 obs. of  2 variables:
129
+    ##   ..$ name: chr "example.com."
130
+    ##   ..$ type: int 255
131
+    ##  $ Answer            :'data.frame':  18 obs. of  4 variables:
132
+    ##   ..$ name: chr [1:18] "example.com." "example.com." "example.com." "example.com." ...
133
+    ##   ..$ type: int [1:18] 6 46 46 46 46 46 46 46 46 47 ...
134
+    ##   ..$ TTL : int [1:18] 1533 19533 19533 1533 19533 19533 1533 1533 1533 1533 ...
135
+    ##   ..$ 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__ ...
136
+    ##  $ Additional        : list()
137
+    ##  $ edns_client_subnet: chr "0.0.0.0/0"
138
+    ##  - attr(*, "class")= chr [1:2] "gdns_response" "list"
139
+
140
+``` r
141
+query("microsoft.com", "MX") %>% 
142
+  as.data.frame()
143
+```
144
+
145
+    ## # A tibble: 1 x 6
146
+    ##   query          qtype name            type   ttl data                                         
147
+    ## * <chr>          <int> <chr>          <int> <int> <chr>                                        
148
+    ## 1 microsoft.com.    15 microsoft.com.    15  2904 10 microsoft-com.mail.protection.outlook.com.
149
+
150
+``` r
151
+as.data.frame(query("apple.com"))
152
+```
153
+
154
+    ## # A tibble: 3 x 6
155
+    ##   query      qtype name        type   ttl data         
156
+    ## * <chr>      <int> <chr>      <int> <int> <chr>        
157
+    ## 1 apple.com.     1 apple.com.     1  3274 17.172.224.47
158
+    ## 2 apple.com.     1 apple.com.     1  3274 17.178.96.59 
159
+    ## 3 apple.com.     1 apple.com.     1  3274 17.142.160.59
160
+
161
+``` r
162
+as.data.frame(dig("17.142.160.59", "PTR"))
163
+```
164
+
165
+    ## # A tibble: 5 x 6
166
+    ##   query                       qtype name                         type   ttl data                   
167
+    ## * <chr>                       <int> <chr>                       <int> <int> <chr>                  
168
+    ## 1 59.160.142.17.in-addr.arpa.    12 59.160.142.17.in-addr.arpa.    12   102 appleid.org.           
169
+    ## 2 59.160.142.17.in-addr.arpa.    12 59.160.142.17.in-addr.arpa.    12   102 apple.by.              
170
+    ## 3 59.160.142.17.in-addr.arpa.    12 59.160.142.17.in-addr.arpa.    12   102 apple.com.             
171
+    ## 4 59.160.142.17.in-addr.arpa.    12 59.160.142.17.in-addr.arpa.    12   102 ipad.host.             
172
+    ## 5 59.160.142.17.in-addr.arpa.    12 59.160.142.17.in-addr.arpa.    12   102 pv-apple-com.apple.com.
173
+
174
+``` r
175
+hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
176
+
177
+gdns::bulk_query(hosts)
204 178
 ```
205 179
 
206
-### Code of Conduct
180
+    ## # A tibble: 7 x 7
181
+    ##   query          qtype name            type   ttl data          entity       
182
+    ##   <chr>          <int> <chr>          <int> <int> <chr>         <chr>        
183
+    ## 1 rud.is.            1 rud.is.            1  3598 172.93.49.183 rud.is       
184
+    ## 2 dds.ec.            1 dds.ec.            1   599 185.53.178.9  dds.ec       
185
+    ## 3 r-project.org.     1 r-project.org.     1  4469 137.208.57.37 r-project.org
186
+    ## 4 rstudio.com.       1 rstudio.com.       1  3599 104.196.200.5 rstudio.com  
187
+    ## 5 apple.com.         1 apple.com.         1  2137 17.172.224.47 apple.com    
188
+    ## 6 apple.com.         1 apple.com.         1  2137 17.178.96.59  apple.com    
189
+    ## 7 apple.com.         1 apple.com.         1  2137 17.142.160.59 apple.com
190
+
191
+## gdns Metrics
192
+
193
+| Lang | \# Files |  (%) | LoC |  (%) | Blank lines |  (%) | \# Lines |  (%) |
194
+| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
195
+| R    |       14 | 0.93 | 384 | 0.94 |         118 | 0.77 |      314 | 0.85 |
196
+| Rmd  |        1 | 0.07 |  26 | 0.06 |          35 | 0.23 |       54 | 0.15 |
197
+
198
+## Code of Conduct
207 199
 
208 200
 Please note that this project is released with a [Contributor Code of
209 201
 Conduct](CONDUCT.md). By participating in this project you agree to

+ 6
- 8
cran-comments.md View File

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

+ 95
- 0
data-raw/rrtypes.R View File

@@ -0,0 +1,95 @@
1
+## code to prepare `rrtypes` dataset goes here
2
+
3
+library(tidyverse)
4
+library(xml2)
5
+
6
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-2.csv")
7
+dns_classes <- janitor::clean_names(xdf)
8
+usethis::use_data(dns_classes, overwrite = TRUE)
9
+
10
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-4.csv")
11
+rrtypes <- janitor::clean_names(xdf)
12
+usethis::use_data(rrtypes, overwrite = TRUE)
13
+
14
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-5.csv")
15
+dns_opcodes <- janitor::clean_names(xdf)
16
+usethis::use_data(dns_opcodes, overwrite = TRUE)
17
+
18
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-6.csv")
19
+dns_rcodes <- janitor::clean_names(xdf)
20
+usethis::use_data(dns_rcodes, overwrite = TRUE)
21
+
22
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/dns-parameters-11.csv")
23
+edns0_option_codes <- janitor::clean_names(xdf)
24
+usethis::use_data(edns0_option_codes, overwrite = TRUE)
25
+
26
+xdf <- read_csv("https://www.iana.org/assignments/dns-parameters/underscored-globally-scoped-dns-node-names.csv")
27
+dns_glob_names <- janitor::clean_names(xdf)
28
+usethis::use_data(dns_glob_names, overwrite = TRUE)
29
+
30
+# https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
31
+
32
+doc <- read_xml("https://www.iana.org/assignments/dns-parameters/dns-parameters.xml")
33
+doc <- xml_ns_strip(doc)
34
+
35
+fil <- here::here("R/datasets.R")
36
+
37
+upd <- as.character(Sys.time())
38
+
39
+c(
40
+  "dns_classes" = "dns-parameters-2",
41
+  "rrtypes" = "dns-parameters-4",
42
+  "dns_opcodes" = "dns-parameters-5",
43
+  "dns_rcodes" = "dns-parameters-6",
44
+  "edns0_option_codes" = "dns-parameters-11",
45
+  "dns_glob_names" = "underscored-globally-scoped-dns-node-names"
46
+) -> ids
47
+
48
+cat(
49
+  "# This file is autogenerated. Do not edit by hand.\n",
50
+  "# Last refresh: ", upd, "\n\n", sep = "",
51
+  file = fil
52
+)
53
+
54
+for (i in seq_along(ids)) {
55
+
56
+  dat <- names(ids)[i]
57
+  id <- unname(ids)[i]
58
+  id <- glue::glue(".//registry[@id = '{id}']")
59
+
60
+  node <- xml_find_first(doc, id)
61
+
62
+  note <- ""
63
+  if (!is.na(xml_text(xml_find_first(node, "note"))[[1]])) {
64
+    note <- sprintf("#' @note %s\n", gsub("\n", "", paste0(xml_text(xml_find_first(node, "note")), collapse = " ")))
65
+  }
66
+
67
+  cat(
68
+    "#' @md\n",
69
+    "#' @title ", xml_text(xml_find_first(node, "title")), " (dataset)\n",
70
+    "#' @description ", xml_text(xml_find_first(node, "title")), "\n",
71
+    "#' @format data frame with columns: ", paste0(sprintf("`%s`", colnames(get(names(ids)[i]))), collapse = ", "), "\n",
72
+    "#' @docType data\n",
73
+    "#' @keywords datasets\n",
74
+    "#' @name ", dat, "\n",
75
+    "#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#", unname(ids)[i], ">\n",
76
+    "#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>\n",
77
+    "#' @references ", paste0(xml_attr(xml_find_all(node, "xref"), "data"), collapse = ", "), "\n",
78
+    note,
79
+    "#' @note Last updated ", upd, "\n",
80
+    "#' @usage data('", dat, "')\n",
81
+    "NULL\n\n",
82
+    sep = "", file = fil, append = TRUE
83
+  )
84
+
85
+}
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+

BIN
data/dns_classes.rda View File


BIN
data/dns_glob_names.rda View File


BIN
data/dns_opcodes.rda View File


BIN
data/dns_rcodes.rda View File


BIN
data/edns0_option_codes.rda View File


BIN
data/resource_record_tbl.rda View File


BIN
data/rrtypes.rda View File


+ 16
- 0
man/as.data.frame.gdns_response.Rd View File

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

+ 8
- 1
man/bulk_query.Rd View File

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

+ 26
- 0
man/dns_classes.Rd View File

@@ -0,0 +1,26 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/datasets.R
3
+\docType{data}
4
+\name{dns_classes}
5
+\alias{dns_classes}
6
+\title{DNS CLASSes (dataset)}
7
+\format{data frame with columns: \code{decimal}, \code{hexadecimal}, \code{name}, \code{reference}}
8
+\usage{
9
+data('dns_classes')
10
+}
11
+\description{
12
+DNS CLASSes
13
+}
14
+\note{
15
+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.
16
+
17
+Last updated 2019-06-27 11:16:48
18
+}
19
+\references{
20
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2}
21
+
22
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
23
+
24
+rfc6895
25
+}
26
+\keyword{datasets}

+ 24
- 0
man/dns_glob_names.Rd View File

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

+ 24
- 0
man/dns_opcodes.Rd View File

@@ -0,0 +1,24 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/datasets.R
3
+\docType{data}
4
+\name{dns_opcodes}
5
+\alias{dns_opcodes}
6
+\title{DNS OpCodes (dataset)}
7
+\format{data frame with columns: \code{op_code}, \code{name}, \code{reference}}
8
+\usage{
9
+data('dns_opcodes')
10
+}
11
+\description{
12
+DNS OpCodes
13
+}
14
+\note{
15
+Last updated 2019-06-27 11:16:48
16
+}
17
+\references{
18
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5}
19
+
20
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
21
+
22
+rfc6895, rfc1035
23
+}
24
+\keyword{datasets}

+ 24
- 0
man/dns_rcodes.Rd View File

@@ -0,0 +1,24 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/datasets.R
3
+\docType{data}
4
+\name{dns_rcodes}
5
+\alias{dns_rcodes}
6
+\title{DNS RCODEs (dataset)}
7
+\format{data frame with columns: \code{rcode}, \code{name}, \code{description}, \code{reference}}
8
+\usage{
9
+data('dns_rcodes')
10
+}
11
+\description{
12
+DNS RCODEs
13
+}
14
+\note{
15
+Last updated 2019-06-27 11:16:48
16
+}
17
+\references{
18
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6}
19
+
20
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
21
+
22
+rfc6895, rfc1035
23
+}
24
+\keyword{datasets}

+ 26
- 0
man/edns0_option_codes.Rd View File

@@ -0,0 +1,26 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/datasets.R
3
+\docType{data}
4
+\name{edns0_option_codes}
5
+\alias{edns0_option_codes}
6
+\title{DNS EDNS0 Option Codes (OPT) (dataset)}
7
+\format{data frame with columns: \code{value}, \code{name}, \code{status}, \code{reference}}
8
+\usage{
9
+data('edns0_option_codes')
10
+}
11
+\description{
12
+DNS EDNS0 Option Codes (OPT)
13
+}
14
+\note{
15
+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."
16
+
17
+Last updated 2019-06-27 11:16:48
18
+}
19
+\references{
20
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11}
21
+
22
+\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
23
+
24
+rfc6891, 3604
25
+}
26
+\keyword{datasets}

+ 12
- 0
man/pipe.Rd View File

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

+ 23
- 5
man/query.Rd View File

@@ -2,9 +2,14 @@
2 2
 % Please edit documentation in R/zgdns.r
3 3
 \name{query}
4 4
 \alias{query}
5
+\alias{dig}
5 6
 \title{Perform DNS over HTTPS queries using Google}
6 7
 \usage{
7
-query(name, type = "1", edns_client_subnet = "0.0.0.0/0")
8
+query(name, type = "1", cd = FALSE, do = FALSE,
9
+  edns_client_subnet = "0.0.0.0/0", random_padding = NULL)
10
+
11
+dig(name, type = "1", cd = FALSE, do = FALSE,
12
+  edns_client_subnet = "0.0.0.0/0", random_padding = NULL)
8 13
 }
9 14
 \arguments{
10 15
 \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
19 24
 found \href{http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4}{here}.
20 25
 You can use \code{255} for an \code{ANY} query.}
21 26
 
27
+\item{cd}{(Checking Disabled) flag. Use `TRUE` to disable DNSSEC validation;
28
+Default: `FALSE`.}
29
+
30
+\item{do}{(DNSSEC OK) flag. Use `TRUE` include DNSSEC records (RRSIG, NSEC, NSEC3);
31
+Default: `FALSE`.}
32
+
22 33
 \item{edns_client_subnet}{The edns0-client-subnet option. Format is an IP
23 34
 address with a subnet mask. Examples: \code{1.2.3.4/24},
24 35
 \code{2001:700:300::/48}.\cr
@@ -28,6 +39,13 @@ nameservers for geographic location accuracy, use
28 39
 \code{edns_client_subnet=0.0.0.0/0}. Google Public DNS normally sends
29 40
 approximate network information (usually replacing the last part of
30 41
 your IPv4 address with zeroes). \code{0.0.0.0/0} is the default.}
42
+
43
+\item{random_padding}{clients concerned about possible side-channel privacy
44
+attacks using the packet sizes of HTTPS GET requests can use this to
45
+make all requests exactly the same size by padding requests with random data.
46
+To prevent misinterpretation of the URL, restrict the padding characters to
47
+the unreserved URL characters: upper- and lower-case letters, digits,
48
+hyphen, period, underscore and tilde.}
31 49
 }
32 50
 \value{
33 51
 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
51 69
 }
52 70
 \examples{
53 71
 query("rud.is")
54
-query("example.com", "255") # ANY query
72
+dig("example.com", "255") # ANY query
55 73
 query("microsoft.com", "MX")
56
-query("google-public-dns-a.google.com", "TXT")
74
+dig("google-public-dns-a.google.com", "TXT")
57 75
 query("apple.com")
58
-query("17.142.160.59", "PTR")
76
+dig("17.142.160.59", "PTR")
59 77
 }
60 78
 \references{
61
-\url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
79
+<https://developers.google.com/speed/public-dns/docs/doh/json>
62 80
 }

+ 24
- 0
man/rrtypes.Rd View File

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

+ 1
- 1
tests/testthat/test-gdns.R View File

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

Loading…
Cancel
Save