dns-message 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE.md +23 -0
- package/README.md +56 -0
- package/dist/dns-message.d.ts +491 -0
- package/dist/dns-message.js +1504 -0
- package/dist/dns-message.js.map +1 -0
- package/dist/dns-message.mjs +1492 -0
- package/dist/dns-message.mjs.map +1 -0
- package/package.json +75 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Phil Pluckthun,
|
|
4
|
+
Copyright (c) 650 Industries, Inc. (aka Expo),
|
|
5
|
+
Copyright (c) 2016 Mathias Buus
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# dns-message
|
|
2
|
+
|
|
3
|
+
`dns-message` is a web-compatible encoder and decoder of DNS message packets (derivative of [dns-packet](https://github.com/mafintosh/dns-packet))
|
|
4
|
+
|
|
5
|
+
## Implementation
|
|
6
|
+
|
|
7
|
+
The goal of `dns-message` is to be a derivative of [dns-packet](https://github.com/mafintosh/dns-packet) that uses typed arrays and `DataView`s to decode and encode DNS messages, removing the reliance on Node.js Buffer and being compatible with any JavaScript runtime that supports `DataView`s, while also having types baked-in.
|
|
8
|
+
|
|
9
|
+
## API Reference
|
|
10
|
+
|
|
11
|
+
For a full list of reference types, consult this library's typings.
|
|
12
|
+
|
|
13
|
+
### `interface Packet`
|
|
14
|
+
|
|
15
|
+
A DNS message input or decoded message.
|
|
16
|
+
|
|
17
|
+
- accepts `rtype: PacketRType` which is set using `PacketFlag` values
|
|
18
|
+
- flags `PacketFlag` as a bitfield (includes `rtype` and `type`)
|
|
19
|
+
|
|
20
|
+
### `interface Question`
|
|
21
|
+
|
|
22
|
+
A DNS question input or decoded payload.
|
|
23
|
+
|
|
24
|
+
- `qu` reflects the `class` field, which is a bit field usually set to `RecordClass`
|
|
25
|
+
|
|
26
|
+
### `encode(input: Packet): Uint8Array`
|
|
27
|
+
|
|
28
|
+
- Accepts a DNS packet of type `Packet`
|
|
29
|
+
|
|
30
|
+
Returns an encoded `Uint8Array` of the encoded DNS message
|
|
31
|
+
|
|
32
|
+
### `decode(bytes: ArrayBufferView | ArrayBufferLike): Packet`
|
|
33
|
+
|
|
34
|
+
- Accepts binary data of a DNS message
|
|
35
|
+
- May throw built-in `RangeError`s
|
|
36
|
+
|
|
37
|
+
Returns a decoded DNS `Packet`
|
|
38
|
+
|
|
39
|
+
### `encodingLength(input: Packet): number`
|
|
40
|
+
|
|
41
|
+
- Accepts a DNS packet of type `Packet`
|
|
42
|
+
|
|
43
|
+
Returns amount of bytes required for encoding
|
|
44
|
+
|
|
45
|
+
### `streamEncode(input: Packet): Uint8Array`
|
|
46
|
+
|
|
47
|
+
- Accepts a DNS packet of type `Packet`
|
|
48
|
+
|
|
49
|
+
Returns an encoded `Uint8Array` of the encoded DNS message, prefixed with a UInt16-BE length for TCP encoding.
|
|
50
|
+
|
|
51
|
+
### `streamDecode(bytes: ArrayBufferView | ArrayBufferLike): Packet`
|
|
52
|
+
|
|
53
|
+
- Accepts binary data of a DNS message, prefixed with a UInt16-BE length
|
|
54
|
+
- May throw built-in `RangeError`s
|
|
55
|
+
|
|
56
|
+
Returns a decoded DNS `Packet`
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
declare const enum PacketType {
|
|
2
|
+
QUERY = 0,
|
|
3
|
+
RESPONSE = 32768,
|
|
4
|
+
}
|
|
5
|
+
declare const enum RecordType {
|
|
6
|
+
A = 1,
|
|
7
|
+
NS = 2,
|
|
8
|
+
CNAME = 5,
|
|
9
|
+
SOA = 6,
|
|
10
|
+
NULL = 10,
|
|
11
|
+
PTR = 12,
|
|
12
|
+
HINFO = 13,
|
|
13
|
+
MX = 15,
|
|
14
|
+
TXT = 16,
|
|
15
|
+
RP = 17,
|
|
16
|
+
AFSDB = 18,
|
|
17
|
+
SIG = 24,
|
|
18
|
+
KEY = 25,
|
|
19
|
+
AAAA = 28,
|
|
20
|
+
LOC = 29,
|
|
21
|
+
SRV = 33,
|
|
22
|
+
NAPTR = 35,
|
|
23
|
+
KX = 36,
|
|
24
|
+
CERT = 37,
|
|
25
|
+
DNAME = 39,
|
|
26
|
+
OPT = 41,
|
|
27
|
+
APL = 42,
|
|
28
|
+
DS = 43,
|
|
29
|
+
SSHFP = 44,
|
|
30
|
+
IPSECKEY = 45,
|
|
31
|
+
RRSIG = 46,
|
|
32
|
+
NSEC = 47,
|
|
33
|
+
DNSKEY = 48,
|
|
34
|
+
DHCID = 49,
|
|
35
|
+
NSEC3 = 50,
|
|
36
|
+
NSEC3PARAM = 51,
|
|
37
|
+
TLSA = 52,
|
|
38
|
+
HIP = 55,
|
|
39
|
+
CDS = 59,
|
|
40
|
+
CDNSKEY = 60,
|
|
41
|
+
SVCB = 64,
|
|
42
|
+
HTTPS = 65,
|
|
43
|
+
SPF = 99,
|
|
44
|
+
TKEY = 249,
|
|
45
|
+
TSIG = 250,
|
|
46
|
+
IXFR = 251,
|
|
47
|
+
AXFR = 252,
|
|
48
|
+
ANY = 255,
|
|
49
|
+
CAA = 257,
|
|
50
|
+
TA = 32768,
|
|
51
|
+
DLV = 32769,
|
|
52
|
+
}
|
|
53
|
+
declare const enum RecordClass {
|
|
54
|
+
IN = 1,
|
|
55
|
+
CS = 2,
|
|
56
|
+
CH = 3,
|
|
57
|
+
HS = 4,
|
|
58
|
+
ANY = 255,
|
|
59
|
+
}
|
|
60
|
+
declare const enum PacketFlag {
|
|
61
|
+
NOERR = 0,
|
|
62
|
+
FORMERR = 1,
|
|
63
|
+
SERVFAIL = 2,
|
|
64
|
+
NXDOMAIN = 3,
|
|
65
|
+
NOTIMP = 4,
|
|
66
|
+
REFUSED = 5,
|
|
67
|
+
YXDOMAIN = 6,
|
|
68
|
+
YXRRSET = 7,
|
|
69
|
+
NXRRSET = 8,
|
|
70
|
+
NOTAUTH = 9,
|
|
71
|
+
NOTZONE = 10,
|
|
72
|
+
CHECKING_DISABLED = 16,
|
|
73
|
+
AUTHENTIC_DATA = 32,
|
|
74
|
+
RECURSION_AVAILABLE = 128,
|
|
75
|
+
RECURSION_DESIRED = 256,
|
|
76
|
+
TRUNCATED_RESPONSE = 512,
|
|
77
|
+
AUTHORITATIVE_ANSWER = 1024,
|
|
78
|
+
}
|
|
79
|
+
type PacketRType =
|
|
80
|
+
| PacketFlag.NOERR
|
|
81
|
+
| PacketFlag.FORMERR
|
|
82
|
+
| PacketFlag.SERVFAIL
|
|
83
|
+
| PacketFlag.NXDOMAIN
|
|
84
|
+
| PacketFlag.NOTIMP
|
|
85
|
+
| PacketFlag.REFUSED
|
|
86
|
+
| PacketFlag.YXDOMAIN
|
|
87
|
+
| PacketFlag.YXRRSET
|
|
88
|
+
| PacketFlag.NXRRSET
|
|
89
|
+
| PacketFlag.NOTAUTH
|
|
90
|
+
| PacketFlag.NOTZONE;
|
|
91
|
+
declare const enum OptCode {
|
|
92
|
+
OPTION_0 = 0,
|
|
93
|
+
LLQ = 1,
|
|
94
|
+
UL = 2,
|
|
95
|
+
NSID = 3,
|
|
96
|
+
OPTION_4 = 4,
|
|
97
|
+
DAU = 5,
|
|
98
|
+
DHU = 6,
|
|
99
|
+
N3U = 7,
|
|
100
|
+
CLIENT_SUBNET = 8,
|
|
101
|
+
EXPIRE = 9,
|
|
102
|
+
COOKIE = 10,
|
|
103
|
+
TCP_KEEPALIVE = 11,
|
|
104
|
+
PADDING = 12,
|
|
105
|
+
CHAIN = 13,
|
|
106
|
+
KEY_TAG = 14,
|
|
107
|
+
DEVICEID = 26946,
|
|
108
|
+
OPTION_65535 = 65535,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface Question {
|
|
112
|
+
name: string;
|
|
113
|
+
type: RecordType;
|
|
114
|
+
class?: RecordClass;
|
|
115
|
+
qu?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare const enum IPType {
|
|
119
|
+
v4 = 1,
|
|
120
|
+
v6 = 2,
|
|
121
|
+
}
|
|
122
|
+
interface BaseOpt {
|
|
123
|
+
code: number;
|
|
124
|
+
}
|
|
125
|
+
interface ClientSubnetOpt extends BaseOpt {
|
|
126
|
+
code: OptCode.CLIENT_SUBNET;
|
|
127
|
+
family?: IPType | (number & {});
|
|
128
|
+
sourcePrefixLength?: number;
|
|
129
|
+
scopePrefixLength?: number;
|
|
130
|
+
ip: string;
|
|
131
|
+
}
|
|
132
|
+
interface KeepAliveOpt extends BaseOpt {
|
|
133
|
+
code: OptCode.TCP_KEEPALIVE;
|
|
134
|
+
timeout?: number;
|
|
135
|
+
}
|
|
136
|
+
interface PaddingOpt extends BaseOpt {
|
|
137
|
+
code: OptCode.PADDING;
|
|
138
|
+
length?: number;
|
|
139
|
+
}
|
|
140
|
+
interface TagOpt extends BaseOpt {
|
|
141
|
+
code: OptCode.KEY_TAG;
|
|
142
|
+
tags: number[];
|
|
143
|
+
}
|
|
144
|
+
interface UnknownOpt extends BaseOpt {
|
|
145
|
+
data: Uint8Array;
|
|
146
|
+
}
|
|
147
|
+
type PacketOpt = ClientSubnetOpt | KeepAliveOpt | PaddingOpt | TagOpt | UnknownOpt;
|
|
148
|
+
|
|
149
|
+
declare const enum SvcParamCode {
|
|
150
|
+
Mandatory = 0,
|
|
151
|
+
Alpn = 1,
|
|
152
|
+
NoDefaultAlpn = 2,
|
|
153
|
+
Port = 3,
|
|
154
|
+
Ipv4Hint = 4,
|
|
155
|
+
EchConfig = 5,
|
|
156
|
+
Ipv6Hint = 6,
|
|
157
|
+
DohPath = 7,
|
|
158
|
+
Odoh = 32769,
|
|
159
|
+
}
|
|
160
|
+
interface SvcParams {
|
|
161
|
+
mandatory?: (SvcParamCode | (number & {}))[];
|
|
162
|
+
alpn?: string[];
|
|
163
|
+
'no-default-alpn'?: boolean;
|
|
164
|
+
port?: number;
|
|
165
|
+
ipv4hint?: string[];
|
|
166
|
+
ipv6hint?: string[];
|
|
167
|
+
echconfig?: Uint8Array;
|
|
168
|
+
dohpath?: string;
|
|
169
|
+
odoh?: Uint8Array;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface BaseAnswer {
|
|
173
|
+
type: RecordType;
|
|
174
|
+
name: string;
|
|
175
|
+
ttl?: number;
|
|
176
|
+
class?: RecordClass;
|
|
177
|
+
flush?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface NsAnswer extends BaseAnswer {
|
|
180
|
+
type: RecordType.NS;
|
|
181
|
+
data: string;
|
|
182
|
+
}
|
|
183
|
+
interface AAnswer extends BaseAnswer {
|
|
184
|
+
type: RecordType.A;
|
|
185
|
+
data: string;
|
|
186
|
+
}
|
|
187
|
+
interface AAAAAnswer extends BaseAnswer {
|
|
188
|
+
type: RecordType.AAAA;
|
|
189
|
+
data: string;
|
|
190
|
+
}
|
|
191
|
+
interface TxtAnswer extends BaseAnswer {
|
|
192
|
+
type: RecordType.TXT;
|
|
193
|
+
data: string[];
|
|
194
|
+
}
|
|
195
|
+
interface SrvData {
|
|
196
|
+
priority?: number;
|
|
197
|
+
weight?: number;
|
|
198
|
+
port: number;
|
|
199
|
+
target: string;
|
|
200
|
+
}
|
|
201
|
+
interface SrvAnswer extends BaseAnswer {
|
|
202
|
+
type: RecordType.SRV;
|
|
203
|
+
data: SrvData;
|
|
204
|
+
}
|
|
205
|
+
interface HInfoData {
|
|
206
|
+
cpu: string;
|
|
207
|
+
os: string;
|
|
208
|
+
}
|
|
209
|
+
interface HInfoAnswer extends BaseAnswer {
|
|
210
|
+
type: RecordType.HINFO;
|
|
211
|
+
data: HInfoData;
|
|
212
|
+
}
|
|
213
|
+
interface CaaData {
|
|
214
|
+
flags?: number;
|
|
215
|
+
tag: 'issue' | 'issuewild' | 'iodef';
|
|
216
|
+
value: Uint8Array;
|
|
217
|
+
issuerCritical?: boolean;
|
|
218
|
+
}
|
|
219
|
+
interface CaaAnswer extends BaseAnswer {
|
|
220
|
+
type: RecordType.CAA;
|
|
221
|
+
data: CaaData;
|
|
222
|
+
}
|
|
223
|
+
interface SoaData {
|
|
224
|
+
mname: string;
|
|
225
|
+
rname: string;
|
|
226
|
+
serial?: number;
|
|
227
|
+
refresh?: number;
|
|
228
|
+
retry?: number;
|
|
229
|
+
expire?: number;
|
|
230
|
+
minimum?: number;
|
|
231
|
+
}
|
|
232
|
+
interface SoaAnswer extends BaseAnswer {
|
|
233
|
+
type: RecordType.SOA;
|
|
234
|
+
data: SoaData;
|
|
235
|
+
}
|
|
236
|
+
interface MxData {
|
|
237
|
+
preference?: number;
|
|
238
|
+
exchange: string;
|
|
239
|
+
}
|
|
240
|
+
interface MxAnswer extends BaseAnswer {
|
|
241
|
+
type: RecordType.MX;
|
|
242
|
+
data: MxData;
|
|
243
|
+
}
|
|
244
|
+
interface DnskeyData {
|
|
245
|
+
flags: number;
|
|
246
|
+
algorithm: number;
|
|
247
|
+
key: Uint8Array;
|
|
248
|
+
}
|
|
249
|
+
interface DnskeyAnswer extends BaseAnswer {
|
|
250
|
+
type: RecordType.DNSKEY;
|
|
251
|
+
data: DnskeyData;
|
|
252
|
+
}
|
|
253
|
+
interface RrsigData {
|
|
254
|
+
typeCovered: RecordType;
|
|
255
|
+
algorithm: number;
|
|
256
|
+
labels: number;
|
|
257
|
+
originalTTL: number;
|
|
258
|
+
expiration: number;
|
|
259
|
+
inception: number;
|
|
260
|
+
keyTag: number;
|
|
261
|
+
signersName: string;
|
|
262
|
+
signature: Uint8Array;
|
|
263
|
+
}
|
|
264
|
+
interface RrsigAnswer extends BaseAnswer {
|
|
265
|
+
type: RecordType.RRSIG;
|
|
266
|
+
data: RrsigData;
|
|
267
|
+
}
|
|
268
|
+
interface RpData {
|
|
269
|
+
mbox: string;
|
|
270
|
+
txt: string;
|
|
271
|
+
}
|
|
272
|
+
interface RpAnswer extends BaseAnswer {
|
|
273
|
+
type: RecordType.RP;
|
|
274
|
+
data: RpData;
|
|
275
|
+
}
|
|
276
|
+
interface NsecData {
|
|
277
|
+
nextDomain: string;
|
|
278
|
+
rrtypes: RecordType[];
|
|
279
|
+
}
|
|
280
|
+
interface NsecAnswer extends BaseAnswer {
|
|
281
|
+
type: RecordType.NSEC;
|
|
282
|
+
data: NsecData;
|
|
283
|
+
}
|
|
284
|
+
interface Nsec3Data {
|
|
285
|
+
algorithm: number;
|
|
286
|
+
flags: number;
|
|
287
|
+
iterations: number;
|
|
288
|
+
salt: string;
|
|
289
|
+
nextDomain: string;
|
|
290
|
+
rrtypes: RecordType[];
|
|
291
|
+
}
|
|
292
|
+
interface Nsec3Answer extends BaseAnswer {
|
|
293
|
+
type: RecordType.NSEC3;
|
|
294
|
+
data: Nsec3Data;
|
|
295
|
+
}
|
|
296
|
+
interface SshfpData {
|
|
297
|
+
algorithm: number;
|
|
298
|
+
hash: number;
|
|
299
|
+
fingerprint: Uint8Array;
|
|
300
|
+
}
|
|
301
|
+
interface SshfpAnswer extends BaseAnswer {
|
|
302
|
+
type: RecordType.SSHFP;
|
|
303
|
+
data: SshfpData;
|
|
304
|
+
}
|
|
305
|
+
interface DsData {
|
|
306
|
+
keyTag: number;
|
|
307
|
+
algorithm: number;
|
|
308
|
+
digestType: number;
|
|
309
|
+
digest: Uint8Array;
|
|
310
|
+
}
|
|
311
|
+
interface DsAnswer extends BaseAnswer {
|
|
312
|
+
type: RecordType.DS;
|
|
313
|
+
data: DsData;
|
|
314
|
+
}
|
|
315
|
+
interface NaptrData {
|
|
316
|
+
order: number;
|
|
317
|
+
preference: number;
|
|
318
|
+
flags: string;
|
|
319
|
+
services: string;
|
|
320
|
+
regexp: string;
|
|
321
|
+
replacement: string;
|
|
322
|
+
}
|
|
323
|
+
interface NaptrAnswer extends BaseAnswer {
|
|
324
|
+
type: RecordType.NAPTR;
|
|
325
|
+
data: NaptrData;
|
|
326
|
+
}
|
|
327
|
+
interface TlsaData {
|
|
328
|
+
usage: number;
|
|
329
|
+
selector: number;
|
|
330
|
+
matchingType: number;
|
|
331
|
+
certificate: Uint8Array;
|
|
332
|
+
}
|
|
333
|
+
interface TlsaAnswer extends BaseAnswer {
|
|
334
|
+
type: RecordType.TLSA;
|
|
335
|
+
data: TlsaData;
|
|
336
|
+
}
|
|
337
|
+
interface SvcbData {
|
|
338
|
+
name: string;
|
|
339
|
+
priority?: number;
|
|
340
|
+
params: SvcParams;
|
|
341
|
+
}
|
|
342
|
+
interface SvcbAnswer extends BaseAnswer {
|
|
343
|
+
type: RecordType.SVCB;
|
|
344
|
+
data: SvcbData;
|
|
345
|
+
}
|
|
346
|
+
interface HttpsAnswer extends BaseAnswer {
|
|
347
|
+
type: RecordType.HTTPS;
|
|
348
|
+
data: SvcbData;
|
|
349
|
+
}
|
|
350
|
+
interface OptAnswer {
|
|
351
|
+
type: RecordType.OPT;
|
|
352
|
+
name?: '.';
|
|
353
|
+
udpPayloadSize: number;
|
|
354
|
+
extendedRcode: number;
|
|
355
|
+
ednsVersion: number;
|
|
356
|
+
flags: number;
|
|
357
|
+
data: PacketOpt[];
|
|
358
|
+
}
|
|
359
|
+
interface PtrAnswer extends BaseAnswer {
|
|
360
|
+
type: RecordType.PTR;
|
|
361
|
+
data: Uint8Array | string;
|
|
362
|
+
}
|
|
363
|
+
interface CnameAnswer extends BaseAnswer {
|
|
364
|
+
type: RecordType.CNAME;
|
|
365
|
+
data: Uint8Array | string;
|
|
366
|
+
}
|
|
367
|
+
interface DnameAnswer extends BaseAnswer {
|
|
368
|
+
type: RecordType.DNAME;
|
|
369
|
+
data: Uint8Array | string;
|
|
370
|
+
}
|
|
371
|
+
interface NullAnswer extends BaseAnswer {
|
|
372
|
+
type: RecordType.NULL;
|
|
373
|
+
data: Uint8Array | string;
|
|
374
|
+
}
|
|
375
|
+
interface UnknownAnswer extends BaseAnswer {
|
|
376
|
+
type:
|
|
377
|
+
| RecordType.AFSDB
|
|
378
|
+
| RecordType.APL
|
|
379
|
+
| RecordType.AXFR
|
|
380
|
+
| RecordType.CDNSKEY
|
|
381
|
+
| RecordType.CDS
|
|
382
|
+
| RecordType.CERT
|
|
383
|
+
| RecordType.DHCID
|
|
384
|
+
| RecordType.DLV
|
|
385
|
+
| RecordType.HIP
|
|
386
|
+
| RecordType.IPSECKEY
|
|
387
|
+
| RecordType.IXFR
|
|
388
|
+
| RecordType.KEY
|
|
389
|
+
| RecordType.KX
|
|
390
|
+
| RecordType.LOC
|
|
391
|
+
| RecordType.NSEC3PARAM
|
|
392
|
+
| RecordType.NULL
|
|
393
|
+
| RecordType.SIG
|
|
394
|
+
| RecordType.TA
|
|
395
|
+
| RecordType.TKEY
|
|
396
|
+
| RecordType.TSIG;
|
|
397
|
+
data: Uint8Array | string;
|
|
398
|
+
}
|
|
399
|
+
type Answer =
|
|
400
|
+
| AAnswer
|
|
401
|
+
| AAAAAnswer
|
|
402
|
+
| TxtAnswer
|
|
403
|
+
| SrvAnswer
|
|
404
|
+
| HInfoAnswer
|
|
405
|
+
| CaaAnswer
|
|
406
|
+
| NsAnswer
|
|
407
|
+
| SoaAnswer
|
|
408
|
+
| MxAnswer
|
|
409
|
+
| OptAnswer
|
|
410
|
+
| DnskeyAnswer
|
|
411
|
+
| RrsigAnswer
|
|
412
|
+
| RpAnswer
|
|
413
|
+
| NsecAnswer
|
|
414
|
+
| Nsec3Answer
|
|
415
|
+
| SshfpAnswer
|
|
416
|
+
| DsAnswer
|
|
417
|
+
| NaptrAnswer
|
|
418
|
+
| TlsaAnswer
|
|
419
|
+
| PtrAnswer
|
|
420
|
+
| CnameAnswer
|
|
421
|
+
| DnameAnswer
|
|
422
|
+
| SvcbAnswer
|
|
423
|
+
| HttpsAnswer
|
|
424
|
+
| NullAnswer
|
|
425
|
+
| UnknownAnswer;
|
|
426
|
+
|
|
427
|
+
interface Packet {
|
|
428
|
+
id?: number;
|
|
429
|
+
type?: PacketType;
|
|
430
|
+
rtype?: PacketRType;
|
|
431
|
+
flags?: PacketFlag | (number & {});
|
|
432
|
+
questions?: Question[];
|
|
433
|
+
answers?: Answer[];
|
|
434
|
+
additionals?: Answer[];
|
|
435
|
+
authorities?: Answer[];
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare function decode(bytes: ArrayBufferView | ArrayBufferLike): Packet;
|
|
439
|
+
declare function streamDecode(bytes: ArrayBufferView | ArrayBufferLike): Packet;
|
|
440
|
+
declare function encodingLength(input: Packet): number;
|
|
441
|
+
declare function encode(input: Packet): Uint8Array;
|
|
442
|
+
declare function streamEncode(input: Packet): Uint8Array;
|
|
443
|
+
|
|
444
|
+
export {
|
|
445
|
+
IPType,
|
|
446
|
+
OptCode,
|
|
447
|
+
PacketFlag,
|
|
448
|
+
PacketType,
|
|
449
|
+
RecordClass,
|
|
450
|
+
RecordType,
|
|
451
|
+
decode,
|
|
452
|
+
encode,
|
|
453
|
+
encodingLength,
|
|
454
|
+
streamDecode,
|
|
455
|
+
streamEncode,
|
|
456
|
+
};
|
|
457
|
+
export type {
|
|
458
|
+
AAAAAnswer,
|
|
459
|
+
AAnswer,
|
|
460
|
+
Answer,
|
|
461
|
+
CaaAnswer,
|
|
462
|
+
ClientSubnetOpt,
|
|
463
|
+
CnameAnswer,
|
|
464
|
+
DnameAnswer,
|
|
465
|
+
DnskeyAnswer,
|
|
466
|
+
DsAnswer,
|
|
467
|
+
HInfoAnswer,
|
|
468
|
+
KeepAliveOpt,
|
|
469
|
+
MxAnswer,
|
|
470
|
+
NaptrAnswer,
|
|
471
|
+
NsAnswer,
|
|
472
|
+
Nsec3Answer,
|
|
473
|
+
NsecAnswer,
|
|
474
|
+
NullAnswer,
|
|
475
|
+
Packet,
|
|
476
|
+
PacketOpt,
|
|
477
|
+
PacketRType,
|
|
478
|
+
PaddingOpt,
|
|
479
|
+
PtrAnswer,
|
|
480
|
+
Question,
|
|
481
|
+
RpAnswer,
|
|
482
|
+
RrsigAnswer,
|
|
483
|
+
SoaAnswer,
|
|
484
|
+
SrvAnswer,
|
|
485
|
+
SshfpAnswer,
|
|
486
|
+
TagOpt,
|
|
487
|
+
TlsaAnswer,
|
|
488
|
+
TxtAnswer,
|
|
489
|
+
UnknownAnswer,
|
|
490
|
+
UnknownOpt,
|
|
491
|
+
};
|