@types/dns2 2.0.8 → 2.0.10
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.
- dns2/README.md +1 -1
- dns2/index.d.ts +47 -2
- dns2/package.json +4 -3
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:
|
|
11
|
+
* Last updated: Thu, 21 Aug 2025 14:02:56 GMT
|
|
12
12
|
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
|
13
13
|
|
|
14
14
|
# Credits
|
dns2/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare namespace DNS {
|
|
|
52
52
|
retries: number;
|
|
53
53
|
timeout: number;
|
|
54
54
|
recursive: boolean;
|
|
55
|
-
resolverProtocol: "UDP" | "TCP";
|
|
55
|
+
resolverProtocol: "UDP" | "TCP" | "DOH" | "Google";
|
|
56
56
|
nameServers: string[];
|
|
57
57
|
rootServers: string[];
|
|
58
58
|
}
|
|
@@ -84,6 +84,12 @@ declare namespace DNS {
|
|
|
84
84
|
type: "udp4" | "udp6";
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
interface DnsServerListenOptions {
|
|
88
|
+
udp?: ListenOptions;
|
|
89
|
+
tcp?: ListenOptions;
|
|
90
|
+
doh?: ListenOptions;
|
|
91
|
+
}
|
|
92
|
+
|
|
87
93
|
type DnsHandler = (
|
|
88
94
|
request: DnsRequest,
|
|
89
95
|
sendResponse: (response: DnsResponse) => void,
|
|
@@ -92,8 +98,42 @@ declare namespace DNS {
|
|
|
92
98
|
|
|
93
99
|
type PacketClass = typeof Packet.CLASS[keyof typeof Packet.CLASS];
|
|
94
100
|
type PacketQuestion = keyof typeof Packet.TYPE;
|
|
101
|
+
type ListenOptions = number | {
|
|
102
|
+
port: number;
|
|
103
|
+
address: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
interface DnsResolveOptions {
|
|
107
|
+
recursive?: boolean;
|
|
108
|
+
/** EDNS ECS, in CIDR format */
|
|
109
|
+
clientIp?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type DnsResolver = (
|
|
113
|
+
name: string,
|
|
114
|
+
type?: DNS.PacketQuestion,
|
|
115
|
+
cls?: DNS.PacketClass,
|
|
116
|
+
options?: DNS.DnsResolveOptions,
|
|
117
|
+
) => Promise<DNS.DnsResponse>;
|
|
118
|
+
|
|
119
|
+
interface TCPClientOptions {
|
|
120
|
+
dns: string;
|
|
121
|
+
protocol?: "tcp:" | "tls:";
|
|
122
|
+
port?: 53 | 853 | (number & {});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface DOHClientOptions {
|
|
126
|
+
dns: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface UDPClientOptions {
|
|
130
|
+
dns: string;
|
|
131
|
+
port?: 53 | (number & {});
|
|
132
|
+
socketType?: udp.SocketType;
|
|
133
|
+
}
|
|
95
134
|
}
|
|
96
135
|
|
|
136
|
+
// ******** Server *******
|
|
97
137
|
declare class DnsServer extends EventEmitter {
|
|
98
138
|
addresses(): {
|
|
99
139
|
udp?: net.AddressInfo;
|
|
@@ -101,7 +141,7 @@ declare class DnsServer extends EventEmitter {
|
|
|
101
141
|
doh?: net.AddressInfo;
|
|
102
142
|
};
|
|
103
143
|
|
|
104
|
-
listen(
|
|
144
|
+
listen(options: DNS.DnsServerListenOptions): Promise<void>;
|
|
105
145
|
|
|
106
146
|
close(): Promise<void>;
|
|
107
147
|
}
|
|
@@ -133,6 +173,11 @@ declare class DNS {
|
|
|
133
173
|
static createTCPServer: (...options: ConstructorParameters<typeof TcpDnsServer>) => TcpDnsServer;
|
|
134
174
|
static TCPServer: typeof TcpDnsServer;
|
|
135
175
|
|
|
176
|
+
static TCPClient: (options: DNS.TCPClientOptions) => DNS.DnsResolver;
|
|
177
|
+
static DOHClient: (options: DNS.DOHClientOptions) => DNS.DnsResolver;
|
|
178
|
+
static UDPClient: (options: DNS.UDPClientOptions) => DNS.DnsResolver;
|
|
179
|
+
static GoogleClient: () => DNS.DnsResolver;
|
|
180
|
+
|
|
136
181
|
query(name: string, type: DNS.PacketQuestion, cls?: DNS.PacketClass, clientIp?: string): Promise<DNS.DnsResponse>;
|
|
137
182
|
resolve(
|
|
138
183
|
domain: string,
|
dns2/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/dns2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
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,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@types/node": "*"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"peerDependencies": {},
|
|
26
|
+
"typesPublisherContentHash": "14ea7fcb4d6d35db47093b2aa384825d41128ba2c5a3799d1c844f004c4125dd",
|
|
27
|
+
"typeScriptVersion": "5.2"
|
|
27
28
|
}
|