Browse Source

root

master
boB Rudis 1 year ago
parent
commit
400455af55
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
27 changed files with 408 additions and 4 deletions
  1. +1
    -0
      NAMESPACE
  2. +21
    -0
      R/RcppExports.R
  3. +18
    -2
      R/resolver.R
  4. +1
    -0
      R/set-res-types.R
  5. +5
    -0
      man/gdns_context.Rd
  6. +5
    -0
      man/gdns_get_address.Rd
  7. +17
    -0
      man/gdns_get_hosts.Rd
  8. +17
    -0
      man/gdns_get_resolution_type.Rd
  9. +17
    -0
      man/gdns_get_resolvconf.Rd
  10. +31
    -0
      man/gdns_get_root_servers.Rd
  11. +17
    -0
      man/gdns_get_timeout.Rd
  12. +17
    -0
      man/gdns_get_tls_ca_file.Rd
  13. +17
    -0
      man/gdns_get_tls_ca_path.Rd
  14. +17
    -0
      man/gdns_get_transports.Rd
  15. +1
    -0
      man/gdns_lib_version.Rd
  16. +5
    -0
      man/gdns_query.Rd
  17. +18
    -1
      man/gdns_set_hosts.Rd
  18. +17
    -0
      man/gdns_set_resolution_type.Rd
  19. +17
    -0
      man/gdns_set_round_robin_upstreams.Rd
  20. +17
    -0
      man/gdns_set_timeout.Rd
  21. +17
    -0
      man/gdns_set_tls_ca_file.Rd
  22. +17
    -0
      man/gdns_set_tls_ca_path.Rd
  23. +18
    -1
      man/gdns_update_resolvers.Rd
  24. +15
    -0
      man/int_gdns_get_root_servers.Rd
  25. +12
    -0
      src/RcppExports.cpp
  26. +51
    -0
      src/clandnstine-main.cpp
  27. +2
    -0
      src/resolver.cpp

+ 1
- 0
NAMESPACE View File

@@ -8,6 +8,7 @@ export(gdns_get_address)
export(gdns_get_hosts)
export(gdns_get_resolution_type)
export(gdns_get_resolvconf)
export(gdns_get_root_servers)
export(gdns_get_timeout)
export(gdns_get_tls_ca_file)
export(gdns_get_tls_ca_path)


+ 21
- 0
R/RcppExports.R View File

@@ -3,6 +3,7 @@

#' Return gdns library version
#'
#' @family utlity functions
#' @export
gdns_lib_version <- function() {
.Call(`_clandnstine_gdns_lib_version`)
@@ -18,6 +19,7 @@ int_gdns_update_resolvers <- function(gctx, resolvers) {
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param timeout number of milliseconds (integer; i.e. not-fractional)
#' @family context functions
#' @export
gdns_set_timeout <- function(gctx, timeout) {
.Call(`_clandnstine_gdns_set_timeout`, gctx, timeout)
@@ -26,6 +28,7 @@ gdns_set_timeout <- function(gctx, timeout) {
#' Retreive the number of milliseconds to wait for request to return
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_timeout <- function(gctx) {
.Call(`_clandnstine_gdns_get_timeout`, gctx)
@@ -37,6 +40,7 @@ gdns_get_timeout <- function(gctx) {
#' @md
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param flag if `TRUE` (the default) round robin queries when using more than one stub resolver,
#' @family context functions
#' @export
gdns_set_round_robin_upstreams <- function(gctx, flag = TRUE) {
.Call(`_clandnstine_gdns_set_round_robin_upstreams`, gctx, flag)
@@ -63,6 +67,7 @@ int_gdns_set_resolution_type <- function(gctx, res_type) {
#' Retreive what transports are used for DNS lookups.
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_transports <- function(gctx) {
.Call(`_clandnstine_gdns_get_transports`, gctx)
@@ -71,6 +76,7 @@ gdns_get_transports <- function(gctx) {
#' Retreive the value of the localnames namespace
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_hosts <- function(gctx) {
.Call(`_clandnstine_gdns_get_hosts`, gctx)
@@ -79,6 +85,7 @@ gdns_get_hosts <- function(gctx) {
#' Retreive the value with which the context's upstream recursive servers and suffixes were initialized
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_resolvconf <- function(gctx) {
.Call(`_clandnstine_gdns_get_resolvconf`, gctx)
@@ -87,6 +94,7 @@ gdns_get_resolvconf <- function(gctx) {
#' Retreive the value with which the context's upstream recursive servers and suffixes were initialized
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_tls_ca_path <- function(gctx) {
.Call(`_clandnstine_gdns_get_tls_ca_path`, gctx)
@@ -95,6 +103,7 @@ gdns_get_tls_ca_path <- function(gctx) {
#' Retreive the file location with CA certificates for verification purposes
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @family context functions
#' @export
gdns_get_tls_ca_file <- function(gctx) {
.Call(`_clandnstine_gdns_get_tls_ca_file`, gctx)
@@ -104,6 +113,7 @@ gdns_get_tls_ca_file <- function(gctx) {
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param ca_path directory with Certificate Authority certificates
#' @family context functions
#' @export
gdns_set_tls_ca_path <- function(gctx, ca_path) {
.Call(`_clandnstine_gdns_set_tls_ca_path`, gctx, ca_path)
@@ -113,11 +123,20 @@ gdns_set_tls_ca_path <- function(gctx, ca_path) {
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param ca_file file with Certificate Authority certificates
#' @family context functions
#' @export
gdns_set_tls_ca_file <- function(gctx, ca_file) {
.Call(`_clandnstine_gdns_set_tls_ca_file`, gctx, ca_file)
}

#' Retrieve the list of addresses in use for looking up top-level domains in use by the context.
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @keywords internal
int_gdns_get_root_servers <- function(gctx) {
.Call(`_clandnstine_int_gdns_get_root_servers`, gctx)
}

#' Test whether an object is an external pointer
#'
#' @param x object to test
@@ -144,6 +163,7 @@ int_gdns_context <- function(resolvers) {
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param host to lookup
#' @family query functions
#' @export
#' @examples
#' x <- gdns_resolver()
@@ -165,6 +185,7 @@ int_gdns_query <- function(gctx, name, rr, include_reporting = FALSE) {
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @export
#' @family context functions
#' @examples
#' x <- gdns_context()
#' gdns_get_resolution_type(x)


+ 18
- 2
R/resolver.R View File

@@ -6,6 +6,7 @@
#' @param resolvers character vector of valid DNS over TLS resolvers;
#' Defaults to Quad9 (`9.9.9.9`).
#' @export
#' @family query functions
#' @examples
#' x <- gdns_context()
#' x <- gdns_context("1.1.1.1")
@@ -19,10 +20,11 @@ gdns_context <- function(resolvers = "9.9.9.9") {
#' maintains a list of DNS over TLS servers.
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param resolvers character vector of valid DNS over TLS resolvers
#' @family context functions
#' @export
#' @examples
#' x <- gdns_context()
#' x <- gdns_update_resolvers("1.1.1.1")
#' x <- gdns_update_resolvers(x, "1.1.1.1")
gdns_update_resolvers<- function(gctx, resolvers) {
int_gdns_update_resolvers(gctx, resolvers)
}
@@ -33,9 +35,10 @@ gdns_update_resolvers<- function(gctx, resolvers) {
#' @param hosts_file path to a valid `hosts` file (e.g. "`/etc/hosts`). This value
#' will be [path.expand()]ed.
#' @export
#' @family context functions
#' @examples
#' x <- gdns_context()
#' x <- gdns_set_hosts(x, "/etc/hosts")
#' gdns_set_hosts(x, "/etc/hosts")
gdns_set_hosts<- function(gctx, hosts_file) {
hosts_file <- path.expand(hosts_file[1])
stopifnot(file.exists(hosts_file))
@@ -43,6 +46,18 @@ gdns_set_hosts<- function(gctx, hosts_file) {
}


#' Retrieve the list of addresses in use for looking up top-level domains in use by the context.
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @export
#' @family context functions
# x <- gdns_context()
# gdns_get_root_servers(x)
gdns_get_root_servers <- function(gctx) {
x <- int_gdns_get_root_servers(gctx);
if (length(x)) jsonlite::fromJSON(x) else NULL
}

#' Arbitrary DNS queries
#'
#' Perform any valid resource record inquiry for a given name. See `Details`.
@@ -148,6 +163,7 @@ gdns_set_hosts<- function(gctx, hosts_file) {
#' @param include_reporting if `TRUE` include debugging information for queries
#' such as the length of time it takes for each query. Default: `FALSE`
#' @references <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml>
#' @family query functions
#' @export
#' @examples
#' x <- gdns_resolver()


+ 1
- 0
R/set-res-types.R View File

@@ -4,6 +4,7 @@
#'
#' @param gctx gdns resolver context created with [gdns_resolver()]
#' @param res_type length 1 character vector of either "`stub`" or "`recursive`"
#' @family context functions
#' @export
#' @examples
#' x <- gdns_context()


+ 5
- 0
man/gdns_context.Rd View File

@@ -23,3 +23,8 @@ maintains a list of DNS over TLS servers.
x <- gdns_context()
x <- gdns_context("1.1.1.1")
}
\seealso{
Other query functions: \code{\link{gdns_get_address}},
\code{\link{gdns_query}}
}
\concept{query functions}

+ 5
- 0
man/gdns_get_address.Rd View File

@@ -19,3 +19,8 @@ x <- gdns_resolver()
gdns_get_address(x, "yahoo.com")
x \%>\% gdns_get_address("yahoo.com")
}
\seealso{
Other query functions: \code{\link{gdns_context}},
\code{\link{gdns_query}}
}
\concept{query functions}

+ 17
- 0
man/gdns_get_hosts.Rd View File

@@ -12,3 +12,20 @@ gdns_get_hosts(gctx)
\description{
Retreive the value of the localnames namespace
}
\seealso{
Other context functions: \code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_resolution_type.Rd View File

@@ -16,3 +16,20 @@ Get the current resolution type setting
x <- gdns_context()
gdns_get_resolution_type(x)
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_resolvconf.Rd View File

@@ -12,3 +12,20 @@ gdns_get_resolvconf(gctx)
\description{
Retreive the value with which the context's upstream recursive servers and suffixes were initialized
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 31
- 0
man/gdns_get_root_servers.Rd View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/resolver.R
\name{gdns_get_root_servers}
\alias{gdns_get_root_servers}
\title{Retrieve the list of addresses in use for looking up top-level domains in use by the context.}
\usage{
gdns_get_root_servers(gctx)
}
\arguments{
\item{gctx}{gdns resolver context created with \code{\link[=gdns_resolver]{gdns_resolver()}}}
}
\description{
Retrieve the list of addresses in use for looking up top-level domains in use by the context.
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_timeout.Rd View File

@@ -12,3 +12,20 @@ gdns_get_timeout(gctx)
\description{
Retreive the number of milliseconds to wait for request to return
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_tls_ca_file.Rd View File

@@ -12,3 +12,20 @@ gdns_get_tls_ca_file(gctx)
\description{
Retreive the file location with CA certificates for verification purposes
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_tls_ca_path.Rd View File

@@ -12,3 +12,20 @@ gdns_get_tls_ca_path(gctx)
\description{
Retreive the value with which the context's upstream recursive servers and suffixes were initialized
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_get_transports.Rd View File

@@ -12,3 +12,20 @@ gdns_get_transports(gctx)
\description{
Retreive what transports are used for DNS lookups.
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 1
- 0
man/gdns_lib_version.Rd View File

@@ -9,3 +9,4 @@ gdns_lib_version()
\description{
Return gdns library version
}
\concept{utlity functions}

+ 5
- 0
man/gdns_query.Rd View File

@@ -127,3 +127,8 @@ gdns_query(x, "example.com")
\references{
\url{https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml}
}
\seealso{
Other query functions: \code{\link{gdns_context}},
\code{\link{gdns_get_address}}
}
\concept{query functions}

+ 18
- 1
man/gdns_set_hosts.Rd View File

@@ -17,5 +17,22 @@ Initialized the context's local names namespace with values from the given hosts
}
\examples{
x <- gdns_context()
x <- gdns_set_hosts(x, "/etc/hosts")
gdns_set_hosts(x, "/etc/hosts")
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_set_resolution_type.Rd View File

@@ -18,3 +18,20 @@ Specify whether DNS queries are performed with recursive lookups or as a stub re
x <- gdns_context()
x <- gdns_set_resolution_type(x, "stub")
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_set_round_robin_upstreams.Rd View File

@@ -16,3 +16,20 @@ gdns_set_round_robin_upstreams(gctx, flag = TRUE)
Set/unset context to round robin queries over the available upstreams
when resolving with the stub resolution type.
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_set_timeout.Rd View File

@@ -14,3 +14,20 @@ gdns_set_timeout(gctx, timeout)
\description{
Specify the number of milliseconds to wait for request to return
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_set_tls_ca_file.Rd View File

@@ -14,3 +14,20 @@ gdns_set_tls_ca_file(gctx, ca_file)
\description{
Specify the file with CA certificates for verification purposes
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_path}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 17
- 0
man/gdns_set_tls_ca_path.Rd View File

@@ -14,3 +14,20 @@ gdns_set_tls_ca_path(gctx, ca_path)
\description{
Specify where the location for CA certificates for verification purposes are located
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_update_resolvers}}
}
\concept{context functions}

+ 18
- 1
man/gdns_update_resolvers.Rd View File

@@ -20,5 +20,22 @@ maintains a list of DNS over TLS servers.
}
\examples{
x <- gdns_context()
x <- gdns_update_resolvers("1.1.1.1")
x <- gdns_update_resolvers(x, "1.1.1.1")
}
\seealso{
Other context functions: \code{\link{gdns_get_hosts}},
\code{\link{gdns_get_resolution_type}},
\code{\link{gdns_get_resolvconf}},
\code{\link{gdns_get_root_servers}},
\code{\link{gdns_get_timeout}},
\code{\link{gdns_get_tls_ca_file}},
\code{\link{gdns_get_tls_ca_path}},
\code{\link{gdns_get_transports}},
\code{\link{gdns_set_hosts}},
\code{\link{gdns_set_resolution_type}},
\code{\link{gdns_set_round_robin_upstreams}},
\code{\link{gdns_set_timeout}},
\code{\link{gdns_set_tls_ca_file}},
\code{\link{gdns_set_tls_ca_path}}
}
\concept{context functions}

+ 15
- 0
man/int_gdns_get_root_servers.Rd View File

@@ -0,0 +1,15 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{int_gdns_get_root_servers}
\alias{int_gdns_get_root_servers}
\title{Retrieve the list of addresses in use for looking up top-level domains in use by the context.}
\usage{
int_gdns_get_root_servers(gctx)
}
\arguments{
\item{gctx}{gdns resolver context created with \code{\link[=gdns_resolver]{gdns_resolver()}}}
}
\description{
Retrieve the list of addresses in use for looking up top-level domains in use by the context.
}
\keyword{internal}

+ 12
- 0
src/RcppExports.cpp View File

@@ -177,6 +177,17 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// int_gdns_get_root_servers
CharacterVector int_gdns_get_root_servers(SEXP gctx);
RcppExport SEXP _clandnstine_int_gdns_get_root_servers(SEXP gctxSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type gctx(gctxSEXP);
rcpp_result_gen = Rcpp::wrap(int_gdns_get_root_servers(gctx));
return rcpp_result_gen;
END_RCPP
}
// check_is_xptr
void check_is_xptr(SEXP s);
RcppExport SEXP _clandnstine_check_is_xptr(SEXP sSEXP) {
@@ -274,6 +285,7 @@ static const R_CallMethodDef CallEntries[] = {
{"_clandnstine_gdns_get_tls_ca_file", (DL_FUNC) &_clandnstine_gdns_get_tls_ca_file, 1},
{"_clandnstine_gdns_set_tls_ca_path", (DL_FUNC) &_clandnstine_gdns_set_tls_ca_path, 2},
{"_clandnstine_gdns_set_tls_ca_file", (DL_FUNC) &_clandnstine_gdns_set_tls_ca_file, 2},
{"_clandnstine_int_gdns_get_root_servers", (DL_FUNC) &_clandnstine_int_gdns_get_root_servers, 1},
{"_clandnstine_check_is_xptr", (DL_FUNC) &_clandnstine_check_is_xptr, 1},
{"_clandnstine_is_null_xptr_", (DL_FUNC) &_clandnstine_is_null_xptr_, 1},
{"_clandnstine_int_gdns_context", (DL_FUNC) &_clandnstine_int_gdns_context, 1},


+ 51
- 0
src/clandnstine-main.cpp View File

@@ -7,6 +7,7 @@ using namespace Rcpp;
extern void check_is_xptr(SEXP s);
//' Return gdns library version
//'
//' @family utlity functions
//' @export
// [[Rcpp::export]]
std::string gdns_lib_version() {
@@ -48,6 +49,7 @@ SEXP int_gdns_update_resolvers(SEXP gctx, std::vector< std::string > resolvers)
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @param timeout number of milliseconds (integer; i.e. not-fractional)
//' @family context functions
//' @export
// [[Rcpp::export]]
SEXP gdns_set_timeout(SEXP gctx, long timeout) {
@@ -71,6 +73,7 @@ SEXP gdns_set_timeout(SEXP gctx, long timeout) {
//' Retreive the number of milliseconds to wait for request to return
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
DoubleVector gdns_get_timeout(SEXP gctx) {
@@ -101,6 +104,7 @@ DoubleVector gdns_get_timeout(SEXP gctx) {
//' @md
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @param flag if `TRUE` (the default) round robin queries when using more than one stub resolver,
//' @family context functions
//' @export
// [[Rcpp::export]]
SEXP gdns_set_round_robin_upstreams(SEXP gctx, bool flag=true) {
@@ -196,6 +200,7 @@ SEXP int_gdns_set_resolution_type(SEXP gctx, int res_type) {
//' Retreive what transports are used for DNS lookups.
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
CharacterVector gdns_get_transports(SEXP gctx) {
@@ -233,6 +238,7 @@ CharacterVector gdns_get_transports(SEXP gctx) {
//' Retreive the value of the localnames namespace
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
CharacterVector gdns_get_hosts(SEXP gctx) {
@@ -257,6 +263,7 @@ CharacterVector gdns_get_hosts(SEXP gctx) {
//' Retreive the value with which the context's upstream recursive servers and suffixes were initialized
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
CharacterVector gdns_get_resolvconf(SEXP gctx) {
@@ -281,6 +288,7 @@ CharacterVector gdns_get_resolvconf(SEXP gctx) {
//' Retreive the value with which the context's upstream recursive servers and suffixes were initialized
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
StringVector gdns_get_tls_ca_path(SEXP gctx) {
@@ -305,6 +313,7 @@ StringVector gdns_get_tls_ca_path(SEXP gctx) {
//' Retreive the file location with CA certificates for verification purposes
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @family context functions
//' @export
// [[Rcpp::export]]
StringVector gdns_get_tls_ca_file(SEXP gctx) {
@@ -330,6 +339,7 @@ StringVector gdns_get_tls_ca_file(SEXP gctx) {
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @param ca_path directory with Certificate Authority certificates
//' @family context functions
//' @export
// [[Rcpp::export]]
SEXP gdns_set_tls_ca_path(SEXP gctx, std::string ca_path) {
@@ -354,6 +364,7 @@ SEXP gdns_set_tls_ca_path(SEXP gctx, std::string ca_path) {
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @param ca_file file with Certificate Authority certificates
//' @family context functions
//' @export
// [[Rcpp::export]]
SEXP gdns_set_tls_ca_file(SEXP gctx, std::string ca_file) {
@@ -373,3 +384,43 @@ SEXP gdns_set_tls_ca_file(SEXP gctx, std::string ca_file) {
return(gctx);

}

//' Retrieve the list of addresses in use for looking up top-level domains in use by the context.
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @keywords internal
// [[Rcpp::export]]
CharacterVector int_gdns_get_root_servers(SEXP gctx) {

check_is_xptr(gctx);

getdns_context *ctxt = (getdns_context *)R_ExternalPtrAddr(gctx);

if (gctx == NULL) return(R_NilValue);

getdns_return_t r;
getdns_list *addresses;

if ((r = getdns_context_get_dns_root_servers(ctxt, &addresses))) {
Rf_error(getdns_get_errorstr_by_id(r));
}

if (addresses) {
Rcout << "HERE" << std::endl;
char *lst = getdns_print_json_list(addresses, 0);
if (lst) {
Rcout << lst << std::endl;
std::string out = std::string(lst);
free(lst);
free(addresses);
return(wrap(out));
} else {
free(addresses);
return(CharacterVector());
}
} else {
return(CharacterVector());
}


}

+ 2
- 0
src/resolver.cpp View File

@@ -77,6 +77,7 @@ SEXP int_gdns_context(std::vector< std::string > resolvers) {
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @param host to lookup
//' @family query functions
//' @export
//' @examples
//' x <- gdns_resolver()
@@ -251,6 +252,7 @@ CharacterVector int_gdns_query(SEXP gctx, std::string name, uint16_t rr,
//'
//' @param gctx gdns resolver context created with [gdns_resolver()]
//' @export
//' @family context functions
//' @examples
//' x <- gdns_context()
//' gdns_get_resolution_type(x)


Loading…
Cancel
Save