ask for json in dns_record

This commit is contained in:
Mylloon 2023-06-19 22:33:05 +02:00
parent 9ec05b3aba
commit b9015b2c55
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -18,14 +18,14 @@ let dns_question (question : Types.dns_question) =
question.class_ question.class_
;; ;;
let dns_record (record : Types.dns_record) = let dns_record ?(json = false) (record : Types.dns_record) =
Printf.sprintf Printf.sprintf
"{ \"name\": \"%s\", \"type_\": %d, \"class_\": %d, \"ttl\": %d, \"data\": \"%s\" }" "{ \"name\": \"%s\", \"type_\": %d, \"class_\": %d, \"ttl\": %d, \"data\": \"%s\" }"
(Bytes.to_string record.name) (Bytes.to_string record.name)
record.type_ record.type_
record.class_ record.class_
record.ttl record.ttl
(Utils.get_bytecode ~json:true record.data) (Utils.get_bytecode ~json record.data)
;; ;;
let dns_packet (record : Types.dns_packet) = let dns_packet (record : Types.dns_packet) =