02566cdcfb
Adds ECL as a second supported implementation, specifically a statically linked ECL. This is interesting because we can create statically linked binaries, but has a few drawbacks which doesn't make it generally useful: * Loading things is very slow: The statically linked ECL only has byte compilation available, so when we do load things or use the REPL it is significantly worse than with e. g. SBCL. * We can't load shared objects via the FFI since ECL's dffi is not available when linked statically. This means that as it stands, we can't build a statically linked //web/panettone for example. Since ECL is quite slow anyways, I think these drawbacks are worth it since the biggest reason for using ECL would be to get a statically linked binary. If we change our minds, it shouldn't be too hard to provide ecl-static and ecl-dynamic as separate implementations. ECL is LGPL and some libraries it uses as part of its runtime are as well. I've outlined in the ecl-static overlay why this should be of no concern in the context of depot even though we are statically linking. Currently everything is building except projects that are using cffi to load shared libaries which have gotten an appropriate `badImplementations` entry. To get the rest building the following changes were made: * Anywhere a dependency on UIOP is expressed as `bundled "uiop"` we now use `bundled "asdf"` for all implementations except SBCL. From my testing, SBCL seems to be the only implementation to support using `(require 'uiop)` to only load the UIOP package. Where both a dependency on ASDF and UIOP exists, we just delete the UIOP one. `(require 'asdf)` always causes UIOP to be available. * Where appropriate only conditionally compile SBCL-specific code and if any build the corresponding files for ECL. * //lisp/klatre: Use the standard condition parse-error for all implementations except SBCL in try-parse-integer. * //3p/lisp/ironclad: disable SBCL assembly optimization hack for all other platforms as it may interfere with compilation. * //3p/lisp/trivial-mimes: prevent call to asdf function by substituting it out of the source since it always errors out in ECL and we hardcode the correct path elsewhere anyways. As it stands ECL still suffers from a very weird problem which happens when compiling postmodern and moptilities: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/651 Change-Id: I0285924f92ac154126b4c42145073c3fb33702ed Reviewed-on: https://cl.tvl.fyi/c/depot/+/3297 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: eta <tvl@eta.st> |
||
---|---|---|
.. | ||
client.lisp | ||
default.nix | ||
message.lisp | ||
package.lisp | ||
README.md |
dns
This library is a DNS-over-HTTPS client for Common Lisp.
The ambition is to transform it into a fully-featured DNS resolver instead of piggy-backing on the HTTPS implementation, but ... baby-steps!
Note that there is no Common Lisp HTTP client that fully supports the HTTP2 protocol at the moment, so you can not expect this library to provide equivalent performance to a native DNS resolver (yet).
API
The API is kept as simple as it can be.
Types
The types of this library are implemented as several structs that support binary (de-)serialisation via lisp-binary.
The existing structs are as follows and directly implement the corresponding definitions from RFC 1035:
dns-header
dns-question
dns-rr
dns-message
All relevant field accessors for these structs are exported and can be used to inspect query results.
Functions
All lookup functions are of the type (function (string &key doh-url) (dns-message))
and signal a dns:doh-error
condition for
unsuccessful requests.
If :doh-url
is unspecified, Google's public DNS-over-HTTPS servers
at [dns.google][https://dns.google] will be used.
Currently implemented lookup functions:
lookup-a
lookup-mx
lookup-txt
Example usage
DNS> (dns-message-answer (lookup-a "git.tazj.in."))
#(#S(DNS-RR
:NAME #S(QNAME :START-AT 29 :NAMES #(12))
:TYPE A
:CLASS 1
:TTL 286
:RDLENGTH 4
:RDATA #(34 98 120 189)))
TODO
Various things in this library are currently broken because I only implemented it to work for my blog setup, but these things will be ironed out.
Most importantly, the following needs to be fixed:
- Each qname fragment needs to track its offset, not each qname.
- The RDATA for a TXT record can have multiple counted strings.
- qnames should be canonicalised after parsing.