Bläddra i källkod

bulk_query

tags/v0.3.1
Bob Rudis 8 år sedan
förälder
incheckning
d39ec0442c
  1. 1
      NAMESPACE
  2. 18
      R/gdns.r
  3. 10
      README.Rmd
  4. 25
      README.md
  5. 25
      man/bulk_query.Rd
  6. 7
      man/query.Rd

1
NAMESPACE

@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand
export(bulk_query)
export(query)
import(httr)
importFrom(jsonlite,fromJSON)

18
R/gdns.r

@ -14,6 +14,9 @@ S_GET <- purrr::safely(GET)
#' security between a client and a recursive resolver, and complements DNSSEC
#' to provide end-to-end authenticated DNS lookups.
#'
#' To perform vectorized queries with only answers (and no metadata) use
#' \code{bulk_query()}).
#'
#' @param name item to lookup. Valid characters are numbers, letters, hyphen, and dot. Length
#' must be between 1 and 255. Names with escaped or non-ASCII characters
#' are not supported. Internationalized domain names must use the
@ -30,6 +33,7 @@ S_GET <- purrr::safely(GET)
#' approximate network information (usually replacing the last part of
#' your IPv4 address with zeroes).
#' @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}
#' @export
#' @examples
#' query("rud.is")
@ -48,3 +52,17 @@ query <- function(name, type="1", cd=FALSE, edns_client_subnet=NULL) {
}
}
#' Vectorized query, returning only answers in a data frame
#'
#' @param hosts character vector of hosts to query
#' @return \code{data.frame} of only answers (use \code{query()} for detailed responses)
#' @references \url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
#' @export
#' @examples
#' hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
#' gdns::bulk_query(hosts)
bulk_query <- function(hosts) {
results <- map(hosts, gdns::query)
map_df(results, "Answer")
}

10
README.Rmd

@ -20,9 +20,12 @@ Traditional DNS queries and responses are sent over UDP or TCP without encryptio
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>.
The following functions are implemented:
- `query` : perform the DNS query
- `query` : perform Google DNS query for a single host (retreives metadata & answer)
- `bulk_query` : perform bulk host queries, returning a \code{data.frame} of only answers (no metadata)
### News
@ -60,9 +63,8 @@ test_dir("tests/")
library(purrr)
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com")
results <- map(hosts, gdns::query)
map_df(results, "Answer")
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts)
```
### Code of Conduct

25
README.md

@ -5,9 +5,12 @@ Traditional DNS queries and responses are sent over UDP or TCP without encryptio
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>.
The following functions are implemented:
- `query` : perform the DNS query
- `query` : perform Google DNS query for a single host (retreives metadata & answer)
- `bulk_query` : perform bulk host queries, returning a of only answers (no metadata)
### News
@ -36,7 +39,7 @@ library(gdns)
library(testthat)
date()
#> [1] "Sat Apr 9 17:16:13 2016"
#> [1] "Sat Apr 9 17:24:33 2016"
test_dir("tests/")
#> testthat results ========================================================================================================
@ -49,17 +52,19 @@ library(purrr)
#>
#> is_null
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com")
results <- map(hosts, gdns::query)
map_df(results, "Answer")
#> Source: local data frame [4 x 4]
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts)
#> Source: local data frame [7 x 4]
#>
#> name type TTL data
#> (chr) (int) (int) (chr)
#> 1 rud.is. 1 823 104.236.112.222
#> 2 dds.ec. 1 204 162.243.111.4
#> 3 r-project.org. 1 927 137.208.57.37
#> 4 rstudio.com. 1 3386 45.79.156.36
#> 1 rud.is. 1 3599 104.236.112.222
#> 2 dds.ec. 1 299 162.243.111.4
#> 3 r-project.org. 1 6462 137.208.57.37
#> 4 rstudio.com. 1 3599 45.79.156.36
#> 5 apple.com. 1 2866 17.172.224.47
#> 6 apple.com. 1 2866 17.178.96.59
#> 7 apple.com. 1 2866 17.142.160.59
```
### Code of Conduct

25
man/bulk_query.Rd

@ -0,0 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gdns.r
\name{bulk_query}
\alias{bulk_query}
\title{Vectorized query, returning only answers in a data frame}
\usage{
bulk_query(hosts)
}
\arguments{
\item{hosts}{character vector of hosts to query}
}
\value{
\code{data.frame} of only answers (use \code{query()} for detailed responses)
}
\description{
Vectorized query, returning only answers in a data frame
}
\examples{
hosts <- c("rud.is", "dds.ec", "r-project.org", "rstudio.com", "apple.com")
gdns::bulk_query(hosts)
}
\references{
\url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
}

7
man/query.Rd

@ -41,7 +41,14 @@ 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.
}
\details{
To perform vectorized queries with only answers (and no metadata) use
\code{bulk_query()}).
}
\examples{
query("rud.is")
}
\references{
\url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
}

Laddar…
Avbryt
Spara