dohdec-cli
Version:
DNS over HTTPS and DNS over TLS
63 lines (62 loc) • 1.69 kB
TypeScript
/**
* @typedef {object} Stdio
* @property {import('stream').Readable} [in] StdIn.
* @property {import('stream').Writable} [out] StdOut.
* @property {import('stream').Writable} [err] StdErr.
*/
/**
* @typedef {object} HelpWidth
* @property {number} [helpWidth] Width of help, in columns, for testing.
*/
/**
* Command Line Interface for dohdec.
*/
export class DnsCli extends Command {
/**
* Create a CLI environment.
*
* @param {string[]} args Arguments from the command line
* (usually process.argv).
* @param {Stdio & HelpWidth} [stdio] Replacement streams for stdio,
* for testing.
*/
constructor(args: string[], stdio?: Stdio & HelpWidth);
/** @type {DNSoverHTTPS|DNSoverTLS|undefined} */
transport: DNSoverHTTPS | DNSoverTLS | undefined;
/** @type {Required<Stdio>} */
std: Required<Stdio>;
argv: import("commander").OptionValues;
/**
* Run the CLI.
*/
main(): Promise<void>;
/**
* @param {string} name
* @param {import('dns-packet').RecordType} rrtype
*/
get(name: string, rrtype: import("dns-packet").RecordType): Promise<void>;
prompt(): Promise<number[]>;
}
export type Stdio = {
/**
* StdIn.
*/
in?: import("stream").Readable | undefined;
/**
* StdOut.
*/
out?: import("stream").Writable | undefined;
/**
* StdErr.
*/
err?: import("stream").Writable | undefined;
};
export type HelpWidth = {
/**
* Width of help, in columns, for testing.
*/
helpWidth?: number | undefined;
};
import { Command } from 'commander';
import { DNSoverHTTPS } from 'dohdec';
import { DNSoverTLS } from 'dohdec';