Create a mock DNS-over-TLS server based on mock-tls-server.
npm install -D mock-dns-server
Full API documentation is available.
Example:
import {connect, createServer} from 'mock-dns-server';
/** @type {import('mock-dns-server').Zones} */
const zones = {
'xmpp.example.com': {
A: ['192.168.1.2', '192.168.1.3'],
},
'_xmpp-server._tcp.example.com': {
SRV: {
priority: 30,
weight: 30,
port: 5269,
target: 'xmpp.example.com',
},
},
};
const server = createServer({zones});
/** @type {import('node:tls').TLSSocket} */
const sock = connect(server.port);