From 253a166bbc15e316ba99b7a202c3ed501d6d2c58 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 27 Jan 2020 02:10:39 +0000 Subject: [PATCH] refactor(lisp/dns): Return dns-answer from query functions --- lisp/dns/client.lisp | 3 ++- lisp/dns/package.lisp | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/dns/client.lisp b/lisp/dns/client.lisp index 01d403a60..cee7bceb5 100644 --- a/lisp/dns/client.lisp +++ b/lisp/dns/client.lisp @@ -40,7 +40,8 @@ ("name" . ,name) ("ct" . "application/dns-message"))) (if (= 200 status) - (read-binary 'dns-message (flexi-streams:make-in-memory-input-stream body)) + (dns-message-answer + (read-binary 'dns-message (flexi-streams:make-in-memory-input-stream body))) (restart-case (error 'doh-error :query-name name diff --git a/lisp/dns/package.lisp b/lisp/dns/package.lisp index 639d9994a..2b8bfaa8b 100644 --- a/lisp/dns/package.lisp +++ b/lisp/dns/package.lisp @@ -1,4 +1,11 @@ (defpackage #:dns (:documentation "Simple DNS resolver in Common Lisp") (:use #:cl #:iterate #:lisp-binary) - (:export #:lookup-txt #:lookup-mx)) + (:export + ;; Individual lookup functions + #:lookup-txt #:lookup-mx #:lookup-cname #:lookup-a #:lookup-ns + + ;; Useful accessors + #:dns-message-header #:dns-message-answer #:dns-message-question + #:dns-rr-name #:dns-rr-type #:dns-rr-ttl #:dns-rr-rdata + #:dns-question-qname #:dns-question-qtype))