import { ResourceRecord, ResourceType } from "../decode/types.js"; import { MulticastInterface } from "./multicast_interface.js"; export type MdnsQuestion = { name: string; recordType: ResourceType; }; /** A continuous multicast DNS query. * * Reports additions, flushes, and expirations of resource records answering the given query via an asynchronous iterator: * * ```ts * const query = new Query( * [{ name: '_http._tcp.local', recordType: 255 }], * multicastInterface: new MulticastInterface() * ); * * for await (const event of query) { * console.log(event) * } * ``` */ export declare class Query { private questions; private minterface; private recordCache; private scheduled; private ended; private suppressedQuestions; private additionalRecords; constructor(questions: MdnsQuestion[], multicastInterface: MulticastInterface); private scheduleInitialQuery; private scheduleFurtherQueries; /** Gets all questions given to this Query which we do not already know the answer to, and which we have not recently seen asked by anyone else via multicast. */ private getQuestions; private scheduleQuery; private handleQuery; private askedQuestionFor; private handleResponse; /** Sends a DNS query with given questions. * * If no questions are provided, uses the ones given to the `Query` at construction. */ private sendQuery; /** All answers obtained over the life of this query. */ answers(): ResourceRecord[]; /** All additional records obtained from responses which had valid answers in them. */ additional(): ResourceRecord[]; /** Stop this query from running. */ end(): void; [Symbol.asyncIterator](): AsyncGenerator; } export type QueryCacheEvent = { kind: "ADDED" | "EXPIRED" | "FLUSHED"; record: ResourceRecord; };