about summary refs log tree commit diff
path: root/lisp/dns/resolver.lisp
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-01-26T01·18+0000
committerVincent Ambo <tazjin@google.com>2020-01-26T01·20+0000
commit09621f53716240c6a48cac7f09193a43b0ad305b (patch)
tree5d32bb2f4c6626a417bee511b5e9304b58385474 /lisp/dns/resolver.lisp
parent29e1de2fd248ec4e152d5b0c83514fa57bcb0a33 (diff)
refactor(lisp/dns): Split package into multiple files
Adds a package definition file and moves the current client into
client.lisp

Note that the client is not working at all at this commit as this is a
work-in-progress snapshot.
Diffstat (limited to 'lisp/dns/resolver.lisp')
-rw-r--r--lisp/dns/resolver.lisp29
1 files changed, 0 insertions, 29 deletions
diff --git a/lisp/dns/resolver.lisp b/lisp/dns/resolver.lisp
deleted file mode 100644
index 774be525cb20..000000000000
--- a/lisp/dns/resolver.lisp
+++ /dev/null
@@ -1,29 +0,0 @@
-;; Initial implementation is a simple client for
-;; https://developers.google.com/speed/public-dns/docs/doh/json
-
-(defpackage #:dns
-  (:documentation "Simple DNS resolver in Common Lisp")
-  (:use #:cl)
-  (:export #:lookup-txt #:lookup-mx))
-
-(defvar *doh-base-url* "https://dns.google/resolve"
-  "Base URL of the service providing DNS-over-HTTP(S). Defaults to the
-  Google-hosted API.")
-
-(defun lookup-generic (name type)
-  (multiple-value-bind (body)
-      (drakma:http-request *doh-base-url*
-                           :decode-content t
-                           :want-stream t
-                           :parameters `(("type" . ,type)
-                                         ("name" . ,name)
-                                         ("ct" . "application/x-javascript")))
-    (cl-json:decode-json body)))
-
-(defun lookup-txt (name)
-  "Look up the TXT records at NAME."
-  (lookup-generic name "TXT"))
-
-(defun lookup-mx (name)
-  "Look up the MX records at NAME."
-  (lookup-generic name "MX"))