@node-red/editor-client 3.1.8 → 4.0.0-beta.2

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 (149) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/en-US/editor.json +10 -1
  3. package/locales/fr/editor.json +8 -1
  4. package/locales/ja/editor.json +10 -3
  5. package/package.json +1 -1
  6. package/public/red/about +52 -0
  7. package/public/red/red.js +1433 -263
  8. package/public/red/red.min.js +3 -3
  9. package/public/red/style.min.css +2 -2
  10. package/public/red/tours/3.1/welcome.js +231 -0
  11. package/public/red/tours/images/nr4-auto-complete.png +0 -0
  12. package/public/red/tours/images/nr4-config-select.png +0 -0
  13. package/public/red/tours/images/nr4-multiplayer.png +0 -0
  14. package/public/red/tours/images/nr4-plugins.png +0 -0
  15. package/public/red/tours/images/nr4-sf-config.png +0 -0
  16. package/public/red/tours/images/nr4-timestamp-formatting.png +0 -0
  17. package/public/red/tours/welcome.js +105 -161
  18. package/public/types/node/assert/strict.d.ts +1 -1
  19. package/public/types/node/assert.d.ts +8 -9
  20. package/public/types/node/async_hooks.d.ts +9 -5
  21. package/public/types/node/buffer.d.ts +43 -18
  22. package/public/types/node/child_process.d.ts +8 -5
  23. package/public/types/node/cluster.d.ts +15 -19
  24. package/public/types/node/console.d.ts +2 -2
  25. package/public/types/node/crypto.d.ts +165 -70
  26. package/public/types/node/dgram.d.ts +4 -4
  27. package/public/types/node/diagnostics_channel.d.ts +8 -7
  28. package/public/types/node/dns/promises.d.ts +11 -9
  29. package/public/types/node/dns.d.ts +18 -13
  30. package/public/types/node/dom-events.d.ts +129 -0
  31. package/public/types/node/domain.d.ts +2 -2
  32. package/public/types/node/events.d.ts +49 -12
  33. package/public/types/node/fs/promises.d.ts +68 -24
  34. package/public/types/node/fs.d.ts +132 -59
  35. package/public/types/node/globals.d.ts +31 -17
  36. package/public/types/node/http.d.ts +138 -27
  37. package/public/types/node/http2.d.ts +38 -5
  38. package/public/types/node/https.d.ts +12 -3
  39. package/public/types/node/module.d.ts +1 -2
  40. package/public/types/node/net.d.ts +69 -28
  41. package/public/types/node/os.d.ts +16 -5
  42. package/public/types/node/path.d.ts +5 -5
  43. package/public/types/node/perf_hooks.d.ts +48 -9
  44. package/public/types/node/process.d.ts +18 -17
  45. package/public/types/node/querystring.d.ts +2 -2
  46. package/public/types/node/readline/promises.d.ts +146 -0
  47. package/public/types/node/readline.d.ts +141 -31
  48. package/public/types/node/stream/consumers.d.ts +2 -2
  49. package/public/types/node/stream/promises.d.ts +1 -1
  50. package/public/types/node/stream/web.d.ts +4 -66
  51. package/public/types/node/stream.d.ts +96 -118
  52. package/public/types/node/string_decoder.d.ts +2 -2
  53. package/public/types/node/test.d.ts +200 -16
  54. package/public/types/node/timers/promises.d.ts +1 -26
  55. package/public/types/node/timers.d.ts +2 -2
  56. package/public/types/node/tls.d.ts +21 -12
  57. package/public/types/node/trace_events.d.ts +12 -2
  58. package/public/types/node/ts4.8/assert/strict.d.ts +11 -0
  59. package/public/types/node/ts4.8/assert.d.ts +964 -0
  60. package/public/types/node/ts4.8/async_hooks.d.ts +504 -0
  61. package/public/types/node/ts4.8/buffer.d.ts +2262 -0
  62. package/public/types/node/ts4.8/child_process.d.ts +1372 -0
  63. package/public/types/node/ts4.8/cluster.d.ts +413 -0
  64. package/public/types/node/ts4.8/console.d.ts +415 -0
  65. package/public/types/node/ts4.8/crypto.d.ts +3967 -0
  66. package/public/types/node/ts4.8/dgram.d.ts +548 -0
  67. package/public/types/node/ts4.8/diagnostics_channel.d.ts +156 -0
  68. package/public/types/node/ts4.8/dns/promises.d.ts +373 -0
  69. package/public/types/node/ts4.8/dns.d.ts +662 -0
  70. package/public/types/node/ts4.8/dom-events.d.ts +129 -0
  71. package/public/types/node/ts4.8/domain.d.ts +173 -0
  72. package/public/types/node/ts4.8/events.d.ts +681 -0
  73. package/public/types/node/ts4.8/fs/promises.d.ts +1141 -0
  74. package/public/types/node/ts4.8/fs.d.ts +3875 -0
  75. package/public/types/node/ts4.8/globals.d.ts +297 -0
  76. package/public/types/node/ts4.8/http.d.ts +1617 -0
  77. package/public/types/node/ts4.8/http2.d.ts +2137 -0
  78. package/public/types/node/ts4.8/https.d.ts +544 -0
  79. package/public/types/node/ts4.8/module.d.ts +117 -0
  80. package/public/types/node/ts4.8/net.d.ts +872 -0
  81. package/public/types/node/ts4.8/os.d.ts +469 -0
  82. package/public/types/node/ts4.8/path.d.ts +194 -0
  83. package/public/types/node/ts4.8/perf_hooks.d.ts +628 -0
  84. package/public/types/node/ts4.8/process.d.ts +1485 -0
  85. package/public/types/node/ts4.8/querystring.d.ts +134 -0
  86. package/public/types/node/ts4.8/readline/promises.d.ts +146 -0
  87. package/public/types/node/ts4.8/readline.d.ts +656 -0
  88. package/public/types/node/ts4.8/stream/consumers.d.ts +15 -0
  89. package/public/types/node/ts4.8/stream/promises.d.ts +45 -0
  90. package/public/types/node/ts4.8/stream/web.d.ts +333 -0
  91. package/public/types/node/ts4.8/stream.d.ts +1343 -0
  92. package/public/types/node/ts4.8/string_decoder.d.ts +70 -0
  93. package/public/types/node/ts4.8/test.d.ts +377 -0
  94. package/public/types/node/ts4.8/timers/promises.d.ts +71 -0
  95. package/public/types/node/ts4.8/timers.d.ts +97 -0
  96. package/public/types/node/ts4.8/tls.d.ts +1031 -0
  97. package/public/types/node/ts4.8/trace_events.d.ts +174 -0
  98. package/public/types/node/ts4.8/tty.d.ts +209 -0
  99. package/public/types/node/ts4.8/url.d.ts +900 -0
  100. package/public/types/node/ts4.8/util.d.ts +1853 -0
  101. package/public/types/node/ts4.8/v8.d.ts +399 -0
  102. package/public/types/node/ts4.8/vm.d.ts +512 -0
  103. package/public/types/node/ts4.8/wasi.d.ts +161 -0
  104. package/public/types/node/ts4.8/worker_threads.d.ts +692 -0
  105. package/public/types/node/ts4.8/zlib.d.ts +520 -0
  106. package/public/types/node/tty.d.ts +5 -3
  107. package/public/types/node/url.d.ts +81 -39
  108. package/public/types/node/util.d.ts +269 -13
  109. package/public/types/node/v8.d.ts +22 -4
  110. package/public/types/node/vm.d.ts +7 -5
  111. package/public/types/node/wasi.d.ts +2 -2
  112. package/public/types/node/worker_threads.d.ts +51 -11
  113. package/public/types/node/zlib.d.ts +2 -2
  114. package/public/types/node-red/func.d.ts +26 -17
  115. package/public/vendor/ace/worker-jsonata.js +1 -1
  116. package/public/vendor/monaco/dist/{fa2cc0ab9f0bec2b3365.ttf → 0c718f5b7d2bce997c5f.ttf} +0 -0
  117. package/public/vendor/monaco/dist/css.worker.js +1 -1
  118. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  119. package/public/vendor/monaco/dist/editor.js +1 -29
  120. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +2 -2
  121. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  122. package/public/vendor/monaco/dist/html.worker.js +1 -1
  123. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  124. package/public/vendor/monaco/dist/json.worker.js +1 -1
  125. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  126. package/public/vendor/monaco/dist/locale/cs.js +324 -106
  127. package/public/vendor/monaco/dist/locale/de.js +336 -118
  128. package/public/vendor/monaco/dist/locale/es.js +329 -111
  129. package/public/vendor/monaco/dist/locale/fr.js +334 -116
  130. package/public/vendor/monaco/dist/locale/it.js +327 -109
  131. package/public/vendor/monaco/dist/locale/ja.js +329 -111
  132. package/public/vendor/monaco/dist/locale/ko.js +330 -112
  133. package/public/vendor/monaco/dist/locale/pl.js +329 -111
  134. package/public/vendor/monaco/dist/locale/pt-br.js +329 -111
  135. package/public/vendor/monaco/dist/locale/qps-ploc.js +330 -112
  136. package/public/vendor/monaco/dist/locale/ru.js +331 -113
  137. package/public/vendor/monaco/dist/locale/tr.js +329 -111
  138. package/public/vendor/monaco/dist/locale/zh-hans.js +331 -113
  139. package/public/vendor/monaco/dist/locale/zh-hant.js +331 -113
  140. package/public/vendor/monaco/dist/ts.worker.js +2 -2
  141. package/public/vendor/vendor.js +1 -1
  142. package/public/vendor/monaco/dist/7064e66c3890a12c47b4.ttf +0 -0
  143. /package/public/red/tours/{images → 3.1/images}/context-menu.png +0 -0
  144. /package/public/red/tours/{images → 3.1/images}/global-env-vars.png +0 -0
  145. /package/public/red/tours/{images → 3.1/images}/hiding-flows.png +0 -0
  146. /package/public/red/tours/{images → 3.1/images}/locking-flows.png +0 -0
  147. /package/public/red/tours/{images → 3.1/images}/mermaid.png +0 -0
  148. /package/public/red/tours/{images → 3.1/images}/node-help.png +0 -0
  149. /package/public/red/tours/{images → 3.1/images}/tab-changes.png +0 -0
@@ -0,0 +1,872 @@
1
+
2
+ /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
3
+
4
+ /**
5
+ * > Stability: 2 - Stable
6
+ *
7
+ * The `net` module provides an asynchronous network API for creating stream-based
8
+ * TCP or `IPC` servers ({@link createServer}) and clients
9
+ * ({@link createConnection}).
10
+ *
11
+ * It can be accessed using:
12
+ *
13
+ * ```js
14
+ * const net = require('net');
15
+ * ```
16
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
17
+ */
18
+ declare module 'net' {
19
+ import * as stream from 'node:stream';
20
+ import { Abortable, EventEmitter } from 'node:events';
21
+ import * as dns from 'node:dns';
22
+ type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
23
+ interface AddressInfo {
24
+ address: string;
25
+ family: string;
26
+ port: number;
27
+ }
28
+ interface SocketConstructorOpts {
29
+ fd?: number | undefined;
30
+ allowHalfOpen?: boolean | undefined;
31
+ readable?: boolean | undefined;
32
+ writable?: boolean | undefined;
33
+ signal?: AbortSignal;
34
+ }
35
+ interface OnReadOpts {
36
+ buffer: Uint8Array | (() => Uint8Array);
37
+ /**
38
+ * This function is called for every chunk of incoming data.
39
+ * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
40
+ * Return false from this function to implicitly pause() the socket.
41
+ */
42
+ callback(bytesWritten: number, buf: Uint8Array): boolean;
43
+ }
44
+ interface ConnectOpts {
45
+ /**
46
+ * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
47
+ * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
48
+ * still be emitted as normal and methods like pause() and resume() will also behave as expected.
49
+ */
50
+ onread?: OnReadOpts | undefined;
51
+ }
52
+ interface TcpSocketConnectOpts extends ConnectOpts {
53
+ port: number;
54
+ host?: string | undefined;
55
+ localAddress?: string | undefined;
56
+ localPort?: number | undefined;
57
+ hints?: number | undefined;
58
+ family?: number | undefined;
59
+ lookup?: LookupFunction | undefined;
60
+ noDelay?: boolean | undefined;
61
+ keepAlive?: boolean | undefined;
62
+ keepAliveInitialDelay?: number | undefined;
63
+ }
64
+ interface IpcSocketConnectOpts extends ConnectOpts {
65
+ path: string;
66
+ }
67
+ type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
68
+ type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
69
+ /**
70
+ * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
71
+ * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
72
+ * an `EventEmitter`.
73
+ *
74
+ * A `net.Socket` can be created by the user and used directly to interact with
75
+ * a server. For example, it is returned by {@link createConnection},
76
+ * so the user can use it to talk to the server.
77
+ *
78
+ * It can also be created by Node.js and passed to the user when a connection
79
+ * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use
80
+ * it to interact with the client.
81
+ * @since v0.3.4
82
+ */
83
+ class Socket extends stream.Duplex {
84
+ constructor(options?: SocketConstructorOpts);
85
+ /**
86
+ * Sends data on the socket. The second parameter specifies the encoding in the
87
+ * case of a string. It defaults to UTF8 encoding.
88
+ *
89
+ * Returns `true` if the entire data was flushed successfully to the kernel
90
+ * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free.
91
+ *
92
+ * The optional `callback` parameter will be executed when the data is finally
93
+ * written out, which may not be immediately.
94
+ *
95
+ * See `Writable` stream `write()` method for more
96
+ * information.
97
+ * @since v0.1.90
98
+ * @param [encoding='utf8'] Only used when data is `string`.
99
+ */
100
+ write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
101
+ write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
102
+ /**
103
+ * Initiate a connection on a given socket.
104
+ *
105
+ * Possible signatures:
106
+ *
107
+ * * `socket.connect(options[, connectListener])`
108
+ * * `socket.connect(path[, connectListener])` for `IPC` connections.
109
+ * * `socket.connect(port[, host][, connectListener])` for TCP connections.
110
+ * * Returns: `net.Socket` The socket itself.
111
+ *
112
+ * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
113
+ * instead of a `'connect'` event, an `'error'` event will be emitted with
114
+ * the error passed to the `'error'` listener.
115
+ * The last parameter `connectListener`, if supplied, will be added as a listener
116
+ * for the `'connect'` event **once**.
117
+ *
118
+ * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined
119
+ * behavior.
120
+ */
121
+ connect(options: SocketConnectOpts, connectionListener?: () => void): this;
122
+ connect(port: number, host: string, connectionListener?: () => void): this;
123
+ connect(port: number, connectionListener?: () => void): this;
124
+ connect(path: string, connectionListener?: () => void): this;
125
+ /**
126
+ * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information.
127
+ * @since v0.1.90
128
+ * @return The socket itself.
129
+ */
130
+ setEncoding(encoding?: BufferEncoding): this;
131
+ /**
132
+ * Pauses the reading of data. That is, `'data'` events will not be emitted.
133
+ * Useful to throttle back an upload.
134
+ * @return The socket itself.
135
+ */
136
+ pause(): this;
137
+ /**
138
+ * Close the TCP connection by sending an RST packet and destroy the stream.
139
+ * If this TCP socket is in connecting status, it will send an RST packet
140
+ * and destroy this TCP socket once it is connected. Otherwise, it will call
141
+ * `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. If this is not a TCP socket
142
+ * (for example, a pipe), calling this method will immediately throw
143
+ * an `ERR_INVALID_HANDLE_TYPE` Error.
144
+ * @since v18.3.0
145
+ * @return The socket itself.
146
+ */
147
+ resetAndDestroy(): this;
148
+ /**
149
+ * Resumes reading after a call to `socket.pause()`.
150
+ * @return The socket itself.
151
+ */
152
+ resume(): this;
153
+ /**
154
+ * Sets the socket to timeout after `timeout` milliseconds of inactivity on
155
+ * the socket. By default `net.Socket` do not have a timeout.
156
+ *
157
+ * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to
158
+ * end the connection.
159
+ *
160
+ * ```js
161
+ * socket.setTimeout(3000);
162
+ * socket.on('timeout', () => {
163
+ * console.log('socket timeout');
164
+ * socket.end();
165
+ * });
166
+ * ```
167
+ *
168
+ * If `timeout` is 0, then the existing idle timeout is disabled.
169
+ *
170
+ * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event.
171
+ * @since v0.1.90
172
+ * @return The socket itself.
173
+ */
174
+ setTimeout(timeout: number, callback?: () => void): this;
175
+ /**
176
+ * Enable/disable the use of Nagle's algorithm.
177
+ *
178
+ * When a TCP connection is created, it will have Nagle's algorithm enabled.
179
+ *
180
+ * Nagle's algorithm delays data before it is sent via the network. It attempts
181
+ * to optimize throughput at the expense of latency.
182
+ *
183
+ * Passing `true` for `noDelay` or not passing an argument will disable Nagle's
184
+ * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
185
+ * algorithm.
186
+ * @since v0.1.90
187
+ * @param [noDelay=true]
188
+ * @return The socket itself.
189
+ */
190
+ setNoDelay(noDelay?: boolean): this;
191
+ /**
192
+ * Enable/disable keep-alive functionality, and optionally set the initial
193
+ * delay before the first keepalive probe is sent on an idle socket.
194
+ *
195
+ * Set `initialDelay` (in milliseconds) to set the delay between the last
196
+ * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default
197
+ * (or previous) setting.
198
+ *
199
+ * Enabling the keep-alive functionality will set the following socket options:
200
+ *
201
+ * * `SO_KEEPALIVE=1`
202
+ * * `TCP_KEEPIDLE=initialDelay`
203
+ * * `TCP_KEEPCNT=10`
204
+ * * `TCP_KEEPINTVL=1`
205
+ * @since v0.1.92
206
+ * @param [enable=false]
207
+ * @param [initialDelay=0]
208
+ * @return The socket itself.
209
+ */
210
+ setKeepAlive(enable?: boolean, initialDelay?: number): this;
211
+ /**
212
+ * Returns the bound `address`, the address `family` name and `port` of the
213
+ * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
214
+ * @since v0.1.90
215
+ */
216
+ address(): AddressInfo | {};
217
+ /**
218
+ * Calling `unref()` on a socket will allow the program to exit if this is the only
219
+ * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect.
220
+ * @since v0.9.1
221
+ * @return The socket itself.
222
+ */
223
+ unref(): this;
224
+ /**
225
+ * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior).
226
+ * If the socket is `ref`ed calling `ref` again will have no effect.
227
+ * @since v0.9.1
228
+ * @return The socket itself.
229
+ */
230
+ ref(): this;
231
+ /**
232
+ * This property shows the number of characters buffered for writing. The buffer
233
+ * may contain strings whose length after encoding is not yet known. So this number
234
+ * is only an approximation of the number of bytes in the buffer.
235
+ *
236
+ * `net.Socket` has the property that `socket.write()` always works. This is to
237
+ * help users get up and running quickly. The computer cannot always keep up
238
+ * with the amount of data that is written to a socket. The network connection
239
+ * simply might be too slow. Node.js will internally queue up the data written to a
240
+ * socket and send it out over the wire when it is possible.
241
+ *
242
+ * The consequence of this internal buffering is that memory may grow.
243
+ * Users who experience large or growing `bufferSize` should attempt to
244
+ * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`.
245
+ * @since v0.3.8
246
+ * @deprecated Since v14.6.0 - Use `writableLength` instead.
247
+ */
248
+ readonly bufferSize: number;
249
+ /**
250
+ * The amount of received bytes.
251
+ * @since v0.5.3
252
+ */
253
+ readonly bytesRead: number;
254
+ /**
255
+ * The amount of bytes sent.
256
+ * @since v0.5.3
257
+ */
258
+ readonly bytesWritten: number;
259
+ /**
260
+ * If `true`,`socket.connect(options[, connectListener])` was
261
+ * called and has not yet finished. It will stay `true` until the socket becomes
262
+ * connected, then it is set to `false` and the `'connect'` event is emitted. Note
263
+ * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event.
264
+ * @since v6.1.0
265
+ */
266
+ readonly connecting: boolean;
267
+ /**
268
+ * See `writable.destroyed` for further details.
269
+ */
270
+ readonly destroyed: boolean;
271
+ /**
272
+ * The string representation of the local IP address the remote client is
273
+ * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client
274
+ * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`.
275
+ * @since v0.9.6
276
+ */
277
+ readonly localAddress?: string;
278
+ /**
279
+ * The numeric representation of the local port. For example, `80` or `21`.
280
+ * @since v0.9.6
281
+ */
282
+ readonly localPort?: number;
283
+ /**
284
+ * The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
285
+ * @since v18.8.0
286
+ */
287
+ readonly localFamily?: string;
288
+ /**
289
+ * This property represents the state of the connection as a string.
290
+ * @see {https://nodejs.org/api/net.html#socketreadystate}
291
+ * @since v0.5.0
292
+ */
293
+ readonly readyState: SocketReadyState;
294
+ /**
295
+ * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
296
+ * the socket is destroyed (for example, if the client disconnected).
297
+ * @since v0.5.10
298
+ */
299
+ readonly remoteAddress?: string | undefined;
300
+ /**
301
+ * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
302
+ * @since v0.11.14
303
+ */
304
+ readonly remoteFamily?: string | undefined;
305
+ /**
306
+ * The numeric representation of the remote port. For example, `80` or `21`.
307
+ * @since v0.5.10
308
+ */
309
+ readonly remotePort?: number | undefined;
310
+ /**
311
+ * The socket timeout in milliseconds as set by socket.setTimeout(). It is undefined if a timeout has not been set.
312
+ * @since v10.7.0
313
+ */
314
+ readonly timeout?: number | undefined;
315
+ /**
316
+ * Half-closes the socket. i.e., it sends a FIN packet. It is possible the
317
+ * server will still send some data.
318
+ *
319
+ * See `writable.end()` for further details.
320
+ * @since v0.1.90
321
+ * @param [encoding='utf8'] Only used when data is `string`.
322
+ * @param callback Optional callback for when the socket is finished.
323
+ * @return The socket itself.
324
+ */
325
+ end(callback?: () => void): this;
326
+ end(buffer: Uint8Array | string, callback?: () => void): this;
327
+ end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
328
+ /**
329
+ * events.EventEmitter
330
+ * 1. close
331
+ * 2. connect
332
+ * 3. data
333
+ * 4. drain
334
+ * 5. end
335
+ * 6. error
336
+ * 7. lookup
337
+ * 8. ready
338
+ * 9. timeout
339
+ */
340
+ addListener(event: string, listener: (...args: any[]) => void): this;
341
+ addListener(event: 'close', listener: (hadError: boolean) => void): this;
342
+ addListener(event: 'connect', listener: () => void): this;
343
+ addListener(event: 'data', listener: (data: Buffer) => void): this;
344
+ addListener(event: 'drain', listener: () => void): this;
345
+ addListener(event: 'end', listener: () => void): this;
346
+ addListener(event: 'error', listener: (err: Error) => void): this;
347
+ addListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
348
+ addListener(event: 'ready', listener: () => void): this;
349
+ addListener(event: 'timeout', listener: () => void): this;
350
+ emit(event: string | symbol, ...args: any[]): boolean;
351
+ emit(event: 'close', hadError: boolean): boolean;
352
+ emit(event: 'connect'): boolean;
353
+ emit(event: 'data', data: Buffer): boolean;
354
+ emit(event: 'drain'): boolean;
355
+ emit(event: 'end'): boolean;
356
+ emit(event: 'error', err: Error): boolean;
357
+ emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean;
358
+ emit(event: 'ready'): boolean;
359
+ emit(event: 'timeout'): boolean;
360
+ on(event: string, listener: (...args: any[]) => void): this;
361
+ on(event: 'close', listener: (hadError: boolean) => void): this;
362
+ on(event: 'connect', listener: () => void): this;
363
+ on(event: 'data', listener: (data: Buffer) => void): this;
364
+ on(event: 'drain', listener: () => void): this;
365
+ on(event: 'end', listener: () => void): this;
366
+ on(event: 'error', listener: (err: Error) => void): this;
367
+ on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
368
+ on(event: 'ready', listener: () => void): this;
369
+ on(event: 'timeout', listener: () => void): this;
370
+ once(event: string, listener: (...args: any[]) => void): this;
371
+ once(event: 'close', listener: (hadError: boolean) => void): this;
372
+ once(event: 'connect', listener: () => void): this;
373
+ once(event: 'data', listener: (data: Buffer) => void): this;
374
+ once(event: 'drain', listener: () => void): this;
375
+ once(event: 'end', listener: () => void): this;
376
+ once(event: 'error', listener: (err: Error) => void): this;
377
+ once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
378
+ once(event: 'ready', listener: () => void): this;
379
+ once(event: 'timeout', listener: () => void): this;
380
+ prependListener(event: string, listener: (...args: any[]) => void): this;
381
+ prependListener(event: 'close', listener: (hadError: boolean) => void): this;
382
+ prependListener(event: 'connect', listener: () => void): this;
383
+ prependListener(event: 'data', listener: (data: Buffer) => void): this;
384
+ prependListener(event: 'drain', listener: () => void): this;
385
+ prependListener(event: 'end', listener: () => void): this;
386
+ prependListener(event: 'error', listener: (err: Error) => void): this;
387
+ prependListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
388
+ prependListener(event: 'ready', listener: () => void): this;
389
+ prependListener(event: 'timeout', listener: () => void): this;
390
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
391
+ prependOnceListener(event: 'close', listener: (hadError: boolean) => void): this;
392
+ prependOnceListener(event: 'connect', listener: () => void): this;
393
+ prependOnceListener(event: 'data', listener: (data: Buffer) => void): this;
394
+ prependOnceListener(event: 'drain', listener: () => void): this;
395
+ prependOnceListener(event: 'end', listener: () => void): this;
396
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
397
+ prependOnceListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
398
+ prependOnceListener(event: 'ready', listener: () => void): this;
399
+ prependOnceListener(event: 'timeout', listener: () => void): this;
400
+ }
401
+ interface ListenOptions extends Abortable {
402
+ port?: number | undefined;
403
+ host?: string | undefined;
404
+ backlog?: number | undefined;
405
+ path?: string | undefined;
406
+ exclusive?: boolean | undefined;
407
+ readableAll?: boolean | undefined;
408
+ writableAll?: boolean | undefined;
409
+ /**
410
+ * @default false
411
+ */
412
+ ipv6Only?: boolean | undefined;
413
+ }
414
+ interface ServerOpts {
415
+ /**
416
+ * Indicates whether half-opened TCP connections are allowed.
417
+ * @default false
418
+ */
419
+ allowHalfOpen?: boolean | undefined;
420
+ /**
421
+ * Indicates whether the socket should be paused on incoming connections.
422
+ * @default false
423
+ */
424
+ pauseOnConnect?: boolean | undefined;
425
+ /**
426
+ * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
427
+ * @default false
428
+ * @since v16.5.0
429
+ */
430
+ noDelay?: boolean | undefined;
431
+ /**
432
+ * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
433
+ * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
434
+ * @default false
435
+ * @since v16.5.0
436
+ */
437
+ keepAlive?: boolean | undefined;
438
+ /**
439
+ * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
440
+ * @default 0
441
+ * @since v16.5.0
442
+ */
443
+ keepAliveInitialDelay?: number | undefined;
444
+ }
445
+ interface DropArgument {
446
+ localAddress?: string;
447
+ localPort?: number;
448
+ localFamily?: string;
449
+ remoteAddress?: string;
450
+ remotePort?: number;
451
+ remoteFamily?: string;
452
+ }
453
+ /**
454
+ * This class is used to create a TCP or `IPC` server.
455
+ * @since v0.1.90
456
+ */
457
+ class Server extends EventEmitter {
458
+ constructor(connectionListener?: (socket: Socket) => void);
459
+ constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
460
+ /**
461
+ * Start a server listening for connections. A `net.Server` can be a TCP or
462
+ * an `IPC` server depending on what it listens to.
463
+ *
464
+ * Possible signatures:
465
+ *
466
+ * * `server.listen(handle[, backlog][, callback])`
467
+ * * `server.listen(options[, callback])`
468
+ * * `server.listen(path[, backlog][, callback])` for `IPC` servers
469
+ * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers
470
+ *
471
+ * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'`
472
+ * event.
473
+ *
474
+ * All `listen()` methods can take a `backlog` parameter to specify the maximum
475
+ * length of the queue of pending connections. The actual length will be determined
476
+ * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512).
477
+ *
478
+ * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for
479
+ * details).
480
+ *
481
+ * The `server.listen()` method can be called again if and only if there was an
482
+ * error during the first `server.listen()` call or `server.close()` has been
483
+ * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
484
+ *
485
+ * One of the most common errors raised when listening is `EADDRINUSE`.
486
+ * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry
487
+ * after a certain amount of time:
488
+ *
489
+ * ```js
490
+ * server.on('error', (e) => {
491
+ * if (e.code === 'EADDRINUSE') {
492
+ * console.log('Address in use, retrying...');
493
+ * setTimeout(() => {
494
+ * server.close();
495
+ * server.listen(PORT, HOST);
496
+ * }, 1000);
497
+ * }
498
+ * });
499
+ * ```
500
+ */
501
+ listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
502
+ listen(port?: number, hostname?: string, listeningListener?: () => void): this;
503
+ listen(port?: number, backlog?: number, listeningListener?: () => void): this;
504
+ listen(port?: number, listeningListener?: () => void): this;
505
+ listen(path: string, backlog?: number, listeningListener?: () => void): this;
506
+ listen(path: string, listeningListener?: () => void): this;
507
+ listen(options: ListenOptions, listeningListener?: () => void): this;
508
+ listen(handle: any, backlog?: number, listeningListener?: () => void): this;
509
+ listen(handle: any, listeningListener?: () => void): this;
510
+ /**
511
+ * Stops the server from accepting new connections and keeps existing
512
+ * connections. This function is asynchronous, the server is finally closed
513
+ * when all connections are ended and the server emits a `'close'` event.
514
+ * The optional `callback` will be called once the `'close'` event occurs. Unlike
515
+ * that event, it will be called with an `Error` as its only argument if the server
516
+ * was not open when it was closed.
517
+ * @since v0.1.90
518
+ * @param callback Called when the server is closed.
519
+ */
520
+ close(callback?: (err?: Error) => void): this;
521
+ /**
522
+ * Returns the bound `address`, the address `family` name, and `port` of the server
523
+ * as reported by the operating system if listening on an IP socket
524
+ * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
525
+ *
526
+ * For a server listening on a pipe or Unix domain socket, the name is returned
527
+ * as a string.
528
+ *
529
+ * ```js
530
+ * const server = net.createServer((socket) => {
531
+ * socket.end('goodbye\n');
532
+ * }).on('error', (err) => {
533
+ * // Handle errors here.
534
+ * throw err;
535
+ * });
536
+ *
537
+ * // Grab an arbitrary unused port.
538
+ * server.listen(() => {
539
+ * console.log('opened server on', server.address());
540
+ * });
541
+ * ```
542
+ *
543
+ * `server.address()` returns `null` before the `'listening'` event has been
544
+ * emitted or after calling `server.close()`.
545
+ * @since v0.1.90
546
+ */
547
+ address(): AddressInfo | string | null;
548
+ /**
549
+ * Asynchronously get the number of concurrent connections on the server. Works
550
+ * when sockets were sent to forks.
551
+ *
552
+ * Callback should take two arguments `err` and `count`.
553
+ * @since v0.9.7
554
+ */
555
+ getConnections(cb: (error: Error | null, count: number) => void): void;
556
+ /**
557
+ * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
558
+ * If the server is `ref`ed calling `ref()` again will have no effect.
559
+ * @since v0.9.1
560
+ */
561
+ ref(): this;
562
+ /**
563
+ * Calling `unref()` on a server will allow the program to exit if this is the only
564
+ * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect.
565
+ * @since v0.9.1
566
+ */
567
+ unref(): this;
568
+ /**
569
+ * Set this property to reject connections when the server's connection count gets
570
+ * high.
571
+ *
572
+ * It is not recommended to use this option once a socket has been sent to a child
573
+ * with `child_process.fork()`.
574
+ * @since v0.2.0
575
+ */
576
+ maxConnections: number;
577
+ connections: number;
578
+ /**
579
+ * Indicates whether or not the server is listening for connections.
580
+ * @since v5.7.0
581
+ */
582
+ listening: boolean;
583
+ /**
584
+ * events.EventEmitter
585
+ * 1. close
586
+ * 2. connection
587
+ * 3. error
588
+ * 4. listening
589
+ * 5. drop
590
+ */
591
+ addListener(event: string, listener: (...args: any[]) => void): this;
592
+ addListener(event: 'close', listener: () => void): this;
593
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
594
+ addListener(event: 'error', listener: (err: Error) => void): this;
595
+ addListener(event: 'listening', listener: () => void): this;
596
+ addListener(event: 'drop', listener: (data?: DropArgument) => void): this;
597
+ emit(event: string | symbol, ...args: any[]): boolean;
598
+ emit(event: 'close'): boolean;
599
+ emit(event: 'connection', socket: Socket): boolean;
600
+ emit(event: 'error', err: Error): boolean;
601
+ emit(event: 'listening'): boolean;
602
+ emit(event: 'drop', data?: DropArgument): boolean;
603
+ on(event: string, listener: (...args: any[]) => void): this;
604
+ on(event: 'close', listener: () => void): this;
605
+ on(event: 'connection', listener: (socket: Socket) => void): this;
606
+ on(event: 'error', listener: (err: Error) => void): this;
607
+ on(event: 'listening', listener: () => void): this;
608
+ on(event: 'drop', listener: (data?: DropArgument) => void): this;
609
+ once(event: string, listener: (...args: any[]) => void): this;
610
+ once(event: 'close', listener: () => void): this;
611
+ once(event: 'connection', listener: (socket: Socket) => void): this;
612
+ once(event: 'error', listener: (err: Error) => void): this;
613
+ once(event: 'listening', listener: () => void): this;
614
+ once(event: 'drop', listener: (data?: DropArgument) => void): this;
615
+ prependListener(event: string, listener: (...args: any[]) => void): this;
616
+ prependListener(event: 'close', listener: () => void): this;
617
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
618
+ prependListener(event: 'error', listener: (err: Error) => void): this;
619
+ prependListener(event: 'listening', listener: () => void): this;
620
+ prependListener(event: 'drop', listener: (data?: DropArgument) => void): this;
621
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
622
+ prependOnceListener(event: 'close', listener: () => void): this;
623
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
624
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
625
+ prependOnceListener(event: 'listening', listener: () => void): this;
626
+ prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
627
+ }
628
+ type IPVersion = 'ipv4' | 'ipv6';
629
+ /**
630
+ * The `BlockList` object can be used with some network APIs to specify rules for
631
+ * disabling inbound or outbound access to specific IP addresses, IP ranges, or
632
+ * IP subnets.
633
+ * @since v15.0.0, v14.18.0
634
+ */
635
+ class BlockList {
636
+ /**
637
+ * Adds a rule to block the given IP address.
638
+ * @since v15.0.0, v14.18.0
639
+ * @param address An IPv4 or IPv6 address.
640
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
641
+ */
642
+ addAddress(address: string, type?: IPVersion): void;
643
+ addAddress(address: SocketAddress): void;
644
+ /**
645
+ * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
646
+ * @since v15.0.0, v14.18.0
647
+ * @param start The starting IPv4 or IPv6 address in the range.
648
+ * @param end The ending IPv4 or IPv6 address in the range.
649
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
650
+ */
651
+ addRange(start: string, end: string, type?: IPVersion): void;
652
+ addRange(start: SocketAddress, end: SocketAddress): void;
653
+ /**
654
+ * Adds a rule to block a range of IP addresses specified as a subnet mask.
655
+ * @since v15.0.0, v14.18.0
656
+ * @param net The network IPv4 or IPv6 address.
657
+ * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.
658
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
659
+ */
660
+ addSubnet(net: SocketAddress, prefix: number): void;
661
+ addSubnet(net: string, prefix: number, type?: IPVersion): void;
662
+ /**
663
+ * Returns `true` if the given IP address matches any of the rules added to the`BlockList`.
664
+ *
665
+ * ```js
666
+ * const blockList = new net.BlockList();
667
+ * blockList.addAddress('123.123.123.123');
668
+ * blockList.addRange('10.0.0.1', '10.0.0.10');
669
+ * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6');
670
+ *
671
+ * console.log(blockList.check('123.123.123.123')); // Prints: true
672
+ * console.log(blockList.check('10.0.0.3')); // Prints: true
673
+ * console.log(blockList.check('222.111.111.222')); // Prints: false
674
+ *
675
+ * // IPv6 notation for IPv4 addresses works:
676
+ * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
677
+ * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
678
+ * ```
679
+ * @since v15.0.0, v14.18.0
680
+ * @param address The IP address to check
681
+ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
682
+ */
683
+ check(address: SocketAddress): boolean;
684
+ check(address: string, type?: IPVersion): boolean;
685
+ }
686
+ interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
687
+ timeout?: number | undefined;
688
+ }
689
+ interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
690
+ timeout?: number | undefined;
691
+ }
692
+ type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
693
+ /**
694
+ * Creates a new TCP or `IPC` server.
695
+ *
696
+ * If `allowHalfOpen` is set to `true`, when the other end of the socket
697
+ * signals the end of transmission, the server will only send back the end of
698
+ * transmission when `socket.end()` is explicitly called. For example, in the
699
+ * context of TCP, when a FIN packed is received, a FIN packed is sent
700
+ * back only when `socket.end()` is explicitly called. Until then the
701
+ * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information.
702
+ *
703
+ * If `pauseOnConnect` is set to `true`, then the socket associated with each
704
+ * incoming connection will be paused, and no data will be read from its handle.
705
+ * This allows connections to be passed between processes without any data being
706
+ * read by the original process. To begin reading data from a paused socket, call `socket.resume()`.
707
+ *
708
+ * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
709
+ *
710
+ * Here is an example of a TCP echo server which listens for connections
711
+ * on port 8124:
712
+ *
713
+ * ```js
714
+ * const net = require('net');
715
+ * const server = net.createServer((c) => {
716
+ * // 'connection' listener.
717
+ * console.log('client connected');
718
+ * c.on('end', () => {
719
+ * console.log('client disconnected');
720
+ * });
721
+ * c.write('hello\r\n');
722
+ * c.pipe(c);
723
+ * });
724
+ * server.on('error', (err) => {
725
+ * throw err;
726
+ * });
727
+ * server.listen(8124, () => {
728
+ * console.log('server bound');
729
+ * });
730
+ * ```
731
+ *
732
+ * Test this by using `telnet`:
733
+ *
734
+ * ```console
735
+ * $ telnet localhost 8124
736
+ * ```
737
+ *
738
+ * To listen on the socket `/tmp/echo.sock`:
739
+ *
740
+ * ```js
741
+ * server.listen('/tmp/echo.sock', () => {
742
+ * console.log('server bound');
743
+ * });
744
+ * ```
745
+ *
746
+ * Use `nc` to connect to a Unix domain socket server:
747
+ *
748
+ * ```console
749
+ * $ nc -U /tmp/echo.sock
750
+ * ```
751
+ * @since v0.5.0
752
+ * @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
753
+ */
754
+ function createServer(connectionListener?: (socket: Socket) => void): Server;
755
+ function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
756
+ /**
757
+ * Aliases to {@link createConnection}.
758
+ *
759
+ * Possible signatures:
760
+ *
761
+ * * {@link connect}
762
+ * * {@link connect} for `IPC` connections.
763
+ * * {@link connect} for TCP connections.
764
+ */
765
+ function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
766
+ function connect(port: number, host?: string, connectionListener?: () => void): Socket;
767
+ function connect(path: string, connectionListener?: () => void): Socket;
768
+ /**
769
+ * A factory function, which creates a new {@link Socket},
770
+ * immediately initiates connection with `socket.connect()`,
771
+ * then returns the `net.Socket` that starts the connection.
772
+ *
773
+ * When the connection is established, a `'connect'` event will be emitted
774
+ * on the returned socket. The last parameter `connectListener`, if supplied,
775
+ * will be added as a listener for the `'connect'` event **once**.
776
+ *
777
+ * Possible signatures:
778
+ *
779
+ * * {@link createConnection}
780
+ * * {@link createConnection} for `IPC` connections.
781
+ * * {@link createConnection} for TCP connections.
782
+ *
783
+ * The {@link connect} function is an alias to this function.
784
+ */
785
+ function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
786
+ function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
787
+ function createConnection(path: string, connectionListener?: () => void): Socket;
788
+ /**
789
+ * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
790
+ * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
791
+ *
792
+ * ```js
793
+ * net.isIP('::1'); // returns 6
794
+ * net.isIP('127.0.0.1'); // returns 4
795
+ * net.isIP('127.000.000.001'); // returns 0
796
+ * net.isIP('127.0.0.1/24'); // returns 0
797
+ * net.isIP('fhqwhgads'); // returns 0
798
+ * ```
799
+ * @since v0.3.0
800
+ */
801
+ function isIP(input: string): number;
802
+ /**
803
+ * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
804
+ * leading zeroes. Otherwise, returns `false`.
805
+ *
806
+ * ```js
807
+ * net.isIPv4('127.0.0.1'); // returns true
808
+ * net.isIPv4('127.000.000.001'); // returns false
809
+ * net.isIPv4('127.0.0.1/24'); // returns false
810
+ * net.isIPv4('fhqwhgads'); // returns false
811
+ * ```
812
+ * @since v0.3.0
813
+ */
814
+ function isIPv4(input: string): boolean;
815
+ /**
816
+ * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
817
+ *
818
+ * ```js
819
+ * net.isIPv6('::1'); // returns true
820
+ * net.isIPv6('fhqwhgads'); // returns false
821
+ * ```
822
+ * @since v0.3.0
823
+ */
824
+ function isIPv6(input: string): boolean;
825
+ interface SocketAddressInitOptions {
826
+ /**
827
+ * The network address as either an IPv4 or IPv6 string.
828
+ * @default 127.0.0.1
829
+ */
830
+ address?: string | undefined;
831
+ /**
832
+ * @default `'ipv4'`
833
+ */
834
+ family?: IPVersion | undefined;
835
+ /**
836
+ * An IPv6 flow-label used only if `family` is `'ipv6'`.
837
+ * @default 0
838
+ */
839
+ flowlabel?: number | undefined;
840
+ /**
841
+ * An IP port.
842
+ * @default 0
843
+ */
844
+ port?: number | undefined;
845
+ }
846
+ /**
847
+ * @since v15.14.0, v14.18.0
848
+ */
849
+ class SocketAddress {
850
+ constructor(options: SocketAddressInitOptions);
851
+ /**
852
+ * @since v15.14.0, v14.18.0
853
+ */
854
+ readonly address: string;
855
+ /**
856
+ * Either \`'ipv4'\` or \`'ipv6'\`.
857
+ * @since v15.14.0, v14.18.0
858
+ */
859
+ readonly family: IPVersion;
860
+ /**
861
+ * @since v15.14.0, v14.18.0
862
+ */
863
+ readonly port: number;
864
+ /**
865
+ * @since v15.14.0, v14.18.0
866
+ */
867
+ readonly flowlabel: number;
868
+ }
869
+ }
870
+ declare module 'node:net' {
871
+ export * from 'net';
872
+ }