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.
 
 

43 lines
730 B

R6Class(
classname = "DNSLabel",
public = list(
label = NULL,
initialize = function(label) {
if (inherits(label, "DNSLabel")) {
self$label <- label$label
} else if (length(label) > 1) {
self$label <- as.character(label)
} else if (is.character(label)) {
label <- sub("\\.$", "", label)
self$label <- unlist(strsplit(label, "\\."), use.names = FALSE)
}
},
encode = function() {
sz <- nchar(self$label)
out <- raw()
for (i in seq_along(self$label)) {
out <- c(out, as.raw(sz[[i]]), charToRaw(self$label[[i]]))
}
c(out, as.raw(0x00))
},
parse = function(buf, buf_pos) {
}
)
) -> DNSLabel