@types/dns2 2.0.2 → 2.0.4

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.
Files changed (4) hide show
  1. dns2/LICENSE +0 -0
  2. dns2/README.md +1 -1
  3. dns2/index.d.ts +25 -3
  4. dns2/package.json +3 -3
dns2/LICENSE CHANGED
File without changes
dns2/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for dns2 (https://github.com/song940/node
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dns2.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 10 Feb 2023 00:32:30 GMT
11
+ * Last updated: Fri, 22 Sep 2023 20:29:40 GMT
12
12
  * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
13
13
  * Global values: none
14
14
 
dns2/index.d.ts CHANGED
@@ -5,9 +5,9 @@
5
5
 
6
6
  /// <reference types="node" />
7
7
 
8
- import * as net from 'net';
9
- import * as udp from 'dgram';
10
- import { EventEmitter } from 'events';
8
+ import * as udp from "dgram";
9
+ import { EventEmitter } from "events";
10
+ import * as net from "net";
11
11
 
12
12
  declare class Packet {
13
13
  static TYPE: {
@@ -52,6 +52,16 @@ declare class Packet {
52
52
  }
53
53
 
54
54
  declare namespace DNS {
55
+ interface DnsClientOptions {
56
+ port: number;
57
+ retries: number;
58
+ timeout: number;
59
+ recursive: boolean;
60
+ resolverProtocol: "UDP" | "TCP";
61
+ nameServers: string[];
62
+ rootServers: string[];
63
+ }
64
+
55
65
  interface DnsRequest {
56
66
  header: { id: string };
57
67
  questions: DnsQuestion[];
@@ -80,6 +90,9 @@ declare namespace DNS {
80
90
  sendResponse: (response: DnsResponse) => void,
81
91
  remoteInfo: udp.RemoteInfo,
82
92
  ) => void;
93
+
94
+ type PacketClass = typeof Packet.CLASS[keyof typeof Packet.CLASS];
95
+ type PacketQuestion = keyof typeof Packet.TYPE;
83
96
  }
84
97
 
85
98
  declare class DnsServer extends EventEmitter {
@@ -104,6 +117,8 @@ declare class TcpDnsServer extends net.Server {
104
117
  }
105
118
 
106
119
  declare class DNS {
120
+ constructor(options?: Partial<DNS.DnsClientOptions>);
121
+
107
122
  static createServer(options: { udp?: boolean; tcp?: boolean; doh?: boolean; handle: DNS.DnsHandler }): DnsServer;
108
123
 
109
124
  static Packet: typeof Packet;
@@ -114,6 +129,13 @@ declare class DNS {
114
129
  static createTCPServer: (...options: ConstructorParameters<typeof TcpDnsServer>) => TcpDnsServer;
115
130
  static TCPServer: typeof TcpDnsServer;
116
131
 
132
+ query(name: string, type: DNS.PacketQuestion, cls?: DNS.PacketClass, clientIp?: string): Promise<DNS.DnsResponse>;
133
+ resolve(
134
+ domain: string,
135
+ type?: DNS.PacketQuestion,
136
+ cls?: DNS.PacketClass,
137
+ clientIp?: string,
138
+ ): Promise<DNS.DnsResponse>;
117
139
  resolveA(domain: string, clientIp?: string): Promise<DNS.DnsResponse>;
118
140
  resolveAAAA(domain: string): Promise<DNS.DnsResponse>;
119
141
  resolveMX(domain: string): Promise<DNS.DnsResponse>;
dns2/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/dns2",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "TypeScript definitions for dns2",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dns2",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "dependencies": {
23
23
  "@types/node": "*"
24
24
  },
25
- "typesPublisherContentHash": "af5593f3f3c02cc597f98d8ff2cd482b868c48bfcd7f3371ac1287792f0f2654",
26
- "typeScriptVersion": "4.2"
25
+ "typesPublisherContentHash": "2d7ed4673bd9f953130b8c2a7b73327985c6710fa8d245117e2d295399f2da7d",
26
+ "typeScriptVersion": "4.5"
27
27
  }