cabal-dns
Cabal-specific fork of datprotocol/dat-dns, originally written by pfrazee
Issue DNS lookups for Dat archives using HTTPS requests to the target host. Keeps an in-memory cache of recent lookups.
API
var cabalDns = // resolve a name: pass the hostname by itselfcabalDnscabalDns // dont use cached 'misses'cabalDns // dont use the cache at allcabalDns // dont use dns-over-httpscabalDns // dont use .well-known/cabalcabalDns // list all entries in the cachecabalDns // clear the cachecabalDns // configure the DNS-over-HTTPS host usedvar cabalDns = dnsHost: 'dns.google.com' dnsPath: '/resolve' // use a persistent fallback cache// (this is handy for persistent dns data when offline)var cabalDns = persistentCache: read: async { // try lookup // if failed, you can throw the original error: throw err } write: async { // write to your cache } // emits some events, mainly useful for logging/debuggingcabalDnscabalDnscabalDns
Spec
Option 1 (DNS-over-HTTPS). Create a DNS TXT record witht he following schema:
cabalkey={key}
Option 2 (.well-known/cabal). Place a file at /.well-known/cabal
with the following schema:
{cabal-url}
TTL={time in seconds}
TTL is optional and will default to 3600
(one hour). If set to 0
, the entry is not cached.