socket-dns
Socket-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 socketDns = // resolve a name: pass the hostname by itselfsocketDnssocketDns // dont use cached 'misses'socketDns // dont use the cache at allsocketDns // dont use dns-over-httpssocketDns // dont use .well-known/socketsocketDns // list all entries in the cachesocketDns // clear the cachesocketDns // configure the DNS-over-HTTPS host usedvar socketDns = dnsHost: 'dns.google.com' dnsPath: '/resolve' // use a persistent fallback cache// (this is handy for persistent dns data when offline)var socketDns = 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/debuggingsocketDnssocketDnssocketDns
Spec
Option 1 (DNS-over-HTTPS). Create a DNS TXT record witht he following schema:
socketkey={key}
Option 2 (.well-known/socket). Place a file at /.well-known/socket
with the following schema:
{socket-url}
TTL={time in seconds}
TTL is optional and will default to 3600
(one hour). If set to 0
, the entry is not cached.