Perform Secure-by-default or Woefully Insecure ‘DNS’ Queries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
749 B

#' Convert a wireformat DNS records to an R list
#'
#' @param wf DNS wireformat record as an R raw vector
#' @return list
#' @export
#' @examples
#' from_wireformat(
#' as.raw(c(
#' 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
#' 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, 0x07, 0x65, 0x78, 0x61,
#' 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00,
#' 0x01, 0x00, 0x01, 0x03, 0x77, 0x77, 0x77, 0x07, 0x65, 0x78,
#' 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00,
#' 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04,
#' 0xC0, 0x00, 0x02, 0x01
#' ))
#' )
from_wireformat <- function(wf) {
stopifnot(is.raw(wf))
res <- int_dns_wire_to_list(wf)
jsonlite::fromJSON(res)
}