• Version 5.6.5
  • Published
  • 10.6 kB
  • 1 dependency
  • MIT license


npm i @types/dns-packet
yarn add @types/dns-packet
pnpm add @types/dns-packet


TypeScript definitions for dns-packet




const AUTHENTIC_DATA: number;


    const AUTHORITATIVE_ANSWER: number;

      variable CHECKING_DISABLED

      const CHECKING_DISABLED: number;

        variable DNSSEC_OK

        const DNSSEC_OK: number;

          variable RECURSION_AVAILABLE

          const RECURSION_AVAILABLE: number;

            variable RECURSION_DESIRED

            const RECURSION_DESIRED: number;

              variable TRUNCATED_RESPONSE

              const TRUNCATED_RESPONSE: number;


                function decode

                decode: typeof decode;

                  function encode

                  encode: typeof encode;

                    function encodingLength

                    encodingLength: (packet: Packet) => number;

                      function streamDecode

                      streamDecode: typeof streamDecode;

                        function streamEncode

                        streamEncode: typeof streamEncode;


                          interface BaseAnswer

                          interface BaseAnswer<T, D> extends GenericAnswer<T> {}

                            property class

                            class?: RecordClass | undefined;

                              property data

                              data: D;

                                property flush

                                flush?: boolean | undefined;

                                  property ttl

                                  ttl?: number | undefined;

                                    interface CaaData

                                    interface CaaData {}

                                      property flags

                                      flags?: number | undefined;

                                        property issuerCritical

                                        issuerCritical?: boolean | undefined;

                                          property tag

                                          tag: 'issue' | 'issuewild' | 'iodef';

                                            property value

                                            value: string;

                                              interface DecodedPacket

                                              interface DecodedPacket extends Packet {}

                                                property flag_aa

                                                flag_aa: boolean;

                                                  property flag_ad

                                                  flag_ad: boolean;

                                                    property flag_cd

                                                    flag_cd: boolean;

                                                      property flag_qr

                                                      flag_qr: boolean;

                                                        property flag_ra

                                                        flag_ra: boolean;

                                                          property flag_rd

                                                          flag_rd: boolean;

                                                            property flag_tc

                                                            flag_tc: boolean;

                                                              property flag_z

                                                              flag_z: boolean;

                                                                interface DnskeyData

                                                                interface DnskeyData {}

                                                                  property algorithm

                                                                  algorithm: number;

                                                                    property flags

                                                                    flags: number;

                                                                      property key

                                                                      key: Buffer;

                                                                        interface DsData

                                                                        interface DsData {}

                                                                          property algorithm

                                                                          algorithm: number;

                                                                            property digest

                                                                            digest: Buffer;

                                                                              property digestType

                                                                              digestType: number;

                                                                                property keyTag

                                                                                keyTag: number;

                                                                                  interface GenericAnswer

                                                                                  interface GenericAnswer<T> {}

                                                                                    property name

                                                                                    name: string;

                                                                                      property type

                                                                                      type: T;

                                                                                        interface HInfoData

                                                                                        interface HInfoData {}

                                                                                          property cpu

                                                                                          cpu: string;

                                                                                            property os

                                                                                            os: string;

                                                                                              interface MxData

                                                                                              interface MxData {}

                                                                                                property exchange

                                                                                                exchange: string;

                                                                                                  property preference

                                                                                                  preference?: number | undefined;

                                                                                                    interface NaptrData

                                                                                                    interface NaptrData {}

                                                                                                      property flags

                                                                                                      flags: string;

                                                                                                        property order

                                                                                                        order: number;

                                                                                                          property preference

                                                                                                          preference: number;

                                                                                                            property regexp

                                                                                                            regexp: string;

                                                                                                              property replacement

                                                                                                              replacement: string;

                                                                                                                property services

                                                                                                                services: string;

                                                                                                                  interface Nsec3Data

                                                                                                                  interface Nsec3Data {}

                                                                                                                    property algorithm

                                                                                                                    algorithm: number;

                                                                                                                      property flags

                                                                                                                      flags: number;

                                                                                                                        property iterations

                                                                                                                        iterations: number;

                                                                                                                          property nextDomain

                                                                                                                          nextDomain: Buffer;

                                                                                                                            property rrtypes

                                                                                                                            rrtypes: string[];

                                                                                                                              property salt

                                                                                                                              salt: Buffer;

                                                                                                                                interface NsecData

                                                                                                                                interface NsecData {}

                                                                                                                                  property nextDomain

                                                                                                                                  nextDomain: string;

                                                                                                                                    property rrtypes

                                                                                                                                    rrtypes: string[];

                                                                                                                                      interface OptAnswer

                                                                                                                                      interface OptAnswer extends GenericAnswer<'OPT'> {}

                                                                                                                                        property ednsVersion

                                                                                                                                        ednsVersion: number;

                                                                                                                                          property extendedRcode

                                                                                                                                          extendedRcode: number;

                                                                                                                                            property flag_do

                                                                                                                                            flag_do: boolean;
                                                                                                                                            • Whether or not the DNS DO bit is set

                                                                                                                                            property flags

                                                                                                                                            flags: number;

                                                                                                                                              property options

                                                                                                                                              options: PacketOpt[];

                                                                                                                                                property udpPayloadSize

                                                                                                                                                udpPayloadSize: number;

                                                                                                                                                  interface Packet

                                                                                                                                                  interface Packet {}

                                                                                                                                                    property additionals

                                                                                                                                                    additionals?: Answer[] | undefined;

                                                                                                                                                      property answers

                                                                                                                                                      answers?: Answer[] | undefined;

                                                                                                                                                        property authorities

                                                                                                                                                        authorities?: Answer[] | undefined;

                                                                                                                                                          property flags

                                                                                                                                                          flags?: number | undefined;

                                                                                                                                                          property id

                                                                                                                                                          id?: number | undefined;

                                                                                                                                                            property questions

                                                                                                                                                            questions?: Question[] | undefined;

                                                                                                                                                              property type

                                                                                                                                                              type?: 'query' | 'response' | undefined;
                                                                                                                                                              • Whether the packet is a query or a response. This field may be omitted if it is clear from the context of usage what type of packet it is.

                                                                                                                                                              interface Question

                                                                                                                                                              interface Question {}

                                                                                                                                                                property class

                                                                                                                                                                class?: RecordClass | undefined;

                                                                                                                                                                  property name

                                                                                                                                                                  name: string;

                                                                                                                                                                    property type

                                                                                                                                                                    type: RecordType;

                                                                                                                                                                      interface RpData

                                                                                                                                                                      interface RpData {}

                                                                                                                                                                        property mbox

                                                                                                                                                                        mbox: string;

                                                                                                                                                                          property txt

                                                                                                                                                                          txt: string;

                                                                                                                                                                            interface RrsigData

                                                                                                                                                                            interface RrsigData {}

                                                                                                                                                                              property algorithm

                                                                                                                                                                              algorithm: number;

                                                                                                                                                                                property expiration

                                                                                                                                                                                expiration: number;

                                                                                                                                                                                  property inception

                                                                                                                                                                                  inception: number;

                                                                                                                                                                                    property keyTag

                                                                                                                                                                                    keyTag: number;

                                                                                                                                                                                      property labels

                                                                                                                                                                                      labels: number;

                                                                                                                                                                                        property originalTTL

                                                                                                                                                                                        originalTTL: number;

                                                                                                                                                                                          property signature

                                                                                                                                                                                          signature: Buffer;

                                                                                                                                                                                            property signersName

                                                                                                                                                                                            signersName: string;

                                                                                                                                                                                              property typeCovered

                                                                                                                                                                                              typeCovered: string;

                                                                                                                                                                                                interface SoaData

                                                                                                                                                                                                interface SoaData {}

                                                                                                                                                                                                  property expire

                                                                                                                                                                                                  expire?: number | undefined;

                                                                                                                                                                                                    property minimum

                                                                                                                                                                                                    minimum?: number | undefined;

                                                                                                                                                                                                      property mname

                                                                                                                                                                                                      mname: string;

                                                                                                                                                                                                        property refresh

                                                                                                                                                                                                        refresh?: number | undefined;

                                                                                                                                                                                                          property retry

                                                                                                                                                                                                          retry?: number | undefined;

                                                                                                                                                                                                            property rname

                                                                                                                                                                                                            rname: string;

                                                                                                                                                                                                              property serial

                                                                                                                                                                                                              serial?: number | undefined;

                                                                                                                                                                                                                interface SrvData

                                                                                                                                                                                                                interface SrvData {}

                                                                                                                                                                                                                  property port

                                                                                                                                                                                                                  port: number;

                                                                                                                                                                                                                    property priority

                                                                                                                                                                                                                    priority?: number | undefined;

                                                                                                                                                                                                                      property target

                                                                                                                                                                                                                      target: string;

                                                                                                                                                                                                                        property weight

                                                                                                                                                                                                                        weight?: number | undefined;

                                                                                                                                                                                                                          interface SshfpData

                                                                                                                                                                                                                          interface SshfpData {}

                                                                                                                                                                                                                            property algorithm

                                                                                                                                                                                                                            algorithm: number;

                                                                                                                                                                                                                              property fingerprint

                                                                                                                                                                                                                              fingerprint: string;

                                                                                                                                                                                                                                property hash

                                                                                                                                                                                                                                hash: number;

                                                                                                                                                                                                                                  interface TlsaData

                                                                                                                                                                                                                                  interface TlsaData {}

                                                                                                                                                                                                                                    property certificate

                                                                                                                                                                                                                                    certificate: Buffer;

                                                                                                                                                                                                                                      property matchingType

                                                                                                                                                                                                                                      matchingType: number;

                                                                                                                                                                                                                                        property selector

                                                                                                                                                                                                                                        selector: number;

                                                                                                                                                                                                                                          property usage

                                                                                                                                                                                                                                          usage: number;

                                                                                                                                                                                                                                            Type Aliases

                                                                                                                                                                                                                                            type Answer

                                                                                                                                                                                                                                            type Answer =
                                                                                                                                                                                                                                            | StringAnswer
                                                                                                                                                                                                                                            | BufferAnswer
                                                                                                                                                                                                                                            | CaaAnswer
                                                                                                                                                                                                                                            | DnskeyAnswer
                                                                                                                                                                                                                                            | DSAnswer
                                                                                                                                                                                                                                            | HInfoAnswer
                                                                                                                                                                                                                                            | MxAnswer
                                                                                                                                                                                                                                            | NaptrAnswer
                                                                                                                                                                                                                                            | Nsec3Answer
                                                                                                                                                                                                                                            | NsecAnswer
                                                                                                                                                                                                                                            | OptAnswer
                                                                                                                                                                                                                                            | RpAnswer
                                                                                                                                                                                                                                            | RrsigAnswer
                                                                                                                                                                                                                                            | SoaAnswer
                                                                                                                                                                                                                                            | SrvAnswer
                                                                                                                                                                                                                                            | SshfpAnswer
                                                                                                                                                                                                                                            | TlsaAnswer
                                                                                                                                                                                                                                            | TxtAnswer;

                                                                                                                                                                                                                                              type BufferAnswer

                                                                                                                                                                                                                                              type BufferAnswer = BaseAnswer<OtherRecordType, Buffer>;

                                                                                                                                                                                                                                                type CaaAnswer

                                                                                                                                                                                                                                                type CaaAnswer = BaseAnswer<'CAA', CaaData>;

                                                                                                                                                                                                                                                  type DnskeyAnswer

                                                                                                                                                                                                                                                  type DnskeyAnswer = BaseAnswer<'DNSKEY', DnskeyData>;

                                                                                                                                                                                                                                                    type DSAnswer

                                                                                                                                                                                                                                                    type DSAnswer = BaseAnswer<'DS', DsData>;

                                                                                                                                                                                                                                                      type HInfoAnswer

                                                                                                                                                                                                                                                      type HInfoAnswer = BaseAnswer<'HINFO', HInfoData>;

                                                                                                                                                                                                                                                        type MxAnswer

                                                                                                                                                                                                                                                        type MxAnswer = BaseAnswer<'MX', MxData>;

                                                                                                                                                                                                                                                          type NaptrAnswer

                                                                                                                                                                                                                                                          type NaptrAnswer = BaseAnswer<'NAPTR', NaptrData>;

                                                                                                                                                                                                                                                            type Nsec3Answer

                                                                                                                                                                                                                                                            type Nsec3Answer = BaseAnswer<'NSEC3', Nsec3Data>;

                                                                                                                                                                                                                                                              type NsecAnswer

                                                                                                                                                                                                                                                              type NsecAnswer = BaseAnswer<'NSEC', NsecData>;

                                                                                                                                                                                                                                                                type OtherRecordType

                                                                                                                                                                                                                                                                type OtherRecordType =
                                                                                                                                                                                                                                                                | 'AFSDB'
                                                                                                                                                                                                                                                                | 'APL'
                                                                                                                                                                                                                                                                | 'AXFR'
                                                                                                                                                                                                                                                                | 'CDNSKEY'
                                                                                                                                                                                                                                                                | 'CDS'
                                                                                                                                                                                                                                                                | 'CERT'
                                                                                                                                                                                                                                                                | 'DHCID'
                                                                                                                                                                                                                                                                | 'DLV'
                                                                                                                                                                                                                                                                | 'HIP'
                                                                                                                                                                                                                                                                | 'IPSECKEY'
                                                                                                                                                                                                                                                                | 'IXFR'
                                                                                                                                                                                                                                                                | 'KEY'
                                                                                                                                                                                                                                                                | 'KX'
                                                                                                                                                                                                                                                                | 'LOC'
                                                                                                                                                                                                                                                                | 'NSEC3PARAM'
                                                                                                                                                                                                                                                                | 'NULL'
                                                                                                                                                                                                                                                                | 'SIG'
                                                                                                                                                                                                                                                                | 'TA'
                                                                                                                                                                                                                                                                | 'TKEY'
                                                                                                                                                                                                                                                                | 'TSIG'
                                                                                                                                                                                                                                                                | 'URI';
                                                                                                                                                                                                                                                                • Record types for which the library does not attempt to process the data field.

                                                                                                                                                                                                                                                                type PacketOpt

                                                                                                                                                                                                                                                                type PacketOpt = ClientSubnetOpt | KeepAliveOpt | PaddingOpt | TagOpt;

                                                                                                                                                                                                                                                                  type RecordClass

                                                                                                                                                                                                                                                                  type RecordClass = 'IN' | 'CS' | 'CH' | 'HS' | 'ANY';

                                                                                                                                                                                                                                                                    type RecordType

                                                                                                                                                                                                                                                                    type RecordType =
                                                                                                                                                                                                                                                                    | 'A'
                                                                                                                                                                                                                                                                    | 'AAAA'
                                                                                                                                                                                                                                                                    | 'AFSDB'
                                                                                                                                                                                                                                                                    | 'APL'
                                                                                                                                                                                                                                                                    | 'AXFR'
                                                                                                                                                                                                                                                                    | 'CAA'
                                                                                                                                                                                                                                                                    | 'CDNSKEY'
                                                                                                                                                                                                                                                                    | 'CDS'
                                                                                                                                                                                                                                                                    | 'CERT'
                                                                                                                                                                                                                                                                    | 'CNAME'
                                                                                                                                                                                                                                                                    | 'DNAME'
                                                                                                                                                                                                                                                                    | 'DHCID'
                                                                                                                                                                                                                                                                    | 'DLV'
                                                                                                                                                                                                                                                                    | 'DNSKEY'
                                                                                                                                                                                                                                                                    | 'DS'
                                                                                                                                                                                                                                                                    | 'HINFO'
                                                                                                                                                                                                                                                                    | 'HIP'
                                                                                                                                                                                                                                                                    | 'IXFR'
                                                                                                                                                                                                                                                                    | 'IPSECKEY'
                                                                                                                                                                                                                                                                    | 'KEY'
                                                                                                                                                                                                                                                                    | 'KX'
                                                                                                                                                                                                                                                                    | 'LOC'
                                                                                                                                                                                                                                                                    | 'MX'
                                                                                                                                                                                                                                                                    | 'NAPTR'
                                                                                                                                                                                                                                                                    | 'NS'
                                                                                                                                                                                                                                                                    | 'NSEC'
                                                                                                                                                                                                                                                                    | 'NSEC3'
                                                                                                                                                                                                                                                                    | 'NSEC3PARAM'
                                                                                                                                                                                                                                                                    | 'NULL'
                                                                                                                                                                                                                                                                    | 'OPT'
                                                                                                                                                                                                                                                                    | 'PTR'
                                                                                                                                                                                                                                                                    | 'RRSIG'
                                                                                                                                                                                                                                                                    | 'RP'
                                                                                                                                                                                                                                                                    | 'SIG'
                                                                                                                                                                                                                                                                    | 'SOA'
                                                                                                                                                                                                                                                                    | 'SRV'
                                                                                                                                                                                                                                                                    | 'SSHFP'
                                                                                                                                                                                                                                                                    | 'TA'
                                                                                                                                                                                                                                                                    | 'TKEY'
                                                                                                                                                                                                                                                                    | 'TLSA'
                                                                                                                                                                                                                                                                    | 'TSIG'
                                                                                                                                                                                                                                                                    | 'TXT'
                                                                                                                                                                                                                                                                    | 'URI';
                                                                                                                                                                                                                                                                    • The currently defined set of DNS record types.

                                                                                                                                                                                                                                                                    type RpAnswer

                                                                                                                                                                                                                                                                    type RpAnswer = BaseAnswer<'RP', RpData>;

                                                                                                                                                                                                                                                                      type RrsigAnswer

                                                                                                                                                                                                                                                                      type RrsigAnswer = BaseAnswer<'RRSIG', RrsigData>;

                                                                                                                                                                                                                                                                        type SoaAnswer

                                                                                                                                                                                                                                                                        type SoaAnswer = BaseAnswer<'SOA', SoaData>;

                                                                                                                                                                                                                                                                          type SrvAnswer

                                                                                                                                                                                                                                                                          type SrvAnswer = BaseAnswer<'SRV', SrvData>;

                                                                                                                                                                                                                                                                            type SshfpAnswer

                                                                                                                                                                                                                                                                            type SshfpAnswer = BaseAnswer<'SSHFP', SshfpData>;

                                                                                                                                                                                                                                                                              type StringAnswer

                                                                                                                                                                                                                                                                              type StringAnswer = BaseAnswer<StringRecordType, string>;

                                                                                                                                                                                                                                                                                type StringRecordType

                                                                                                                                                                                                                                                                                type StringRecordType = 'A' | 'AAAA' | 'CNAME' | 'DNAME' | 'NS' | 'PTR';
                                                                                                                                                                                                                                                                                • Record types for which the library will provide a string in the data field.

                                                                                                                                                                                                                                                                                type TlsaAnswer

                                                                                                                                                                                                                                                                                type TlsaAnswer = BaseAnswer<'TLSA', TlsaData>;

                                                                                                                                                                                                                                                                                  type TxtAnswer

                                                                                                                                                                                                                                                                                  type TxtAnswer = BaseAnswer<'TXT', TxtData>;

                                                                                                                                                                                                                                                                                    type TxtData

                                                                                                                                                                                                                                                                                    type TxtData = string | Buffer | Array<string | Buffer>;


                                                                                                                                                                                                                                                                                      namespace decode

                                                                                                                                                                                                                                                                                      namespace decode {}

                                                                                                                                                                                                                                                                                        variable bytes

                                                                                                                                                                                                                                                                                        let bytes: number;

                                                                                                                                                                                                                                                                                          namespace encode

                                                                                                                                                                                                                                                                                          namespace encode {}

                                                                                                                                                                                                                                                                                            variable bytes

                                                                                                                                                                                                                                                                                            let bytes: number;

                                                                                                                                                                                                                                                                                              namespace streamDecode

                                                                                                                                                                                                                                                                                              namespace streamDecode {}

                                                                                                                                                                                                                                                                                                variable bytes

                                                                                                                                                                                                                                                                                                let bytes: number;

                                                                                                                                                                                                                                                                                                  namespace streamEncode

                                                                                                                                                                                                                                                                                                  namespace streamEncode {}

                                                                                                                                                                                                                                                                                                    variable bytes

                                                                                                                                                                                                                                                                                                    let bytes: number;

                                                                                                                                                                                                                                                                                                      Package Files (1)

                                                                                                                                                                                                                                                                                                      Dependencies (1)

                                                                                                                                                                                                                                                                                                      Dev Dependencies (0)

                                                                                                                                                                                                                                                                                                      No dev dependencies.

                                                                                                                                                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                      No peer dependencies.


                                                                                                                                                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/dns-packet.

                                                                                                                                                                                                                                                                                                      • Markdown
                                                                                                                                                                                                                                                                                                      • HTML
                                                                                                                                                                                                                                                                                                        <a href="https://www.jsdocs.io/package/@types/dns-packet"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>