@defold-typescript/types 0.9.0 → 0.11.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/generated/buffer.d.ts +2 -2
- package/generated/gui.d.ts +1 -1
- package/generated/socket.d.ts +636 -11
- package/index.d.ts +1 -0
- package/package.json +4 -1
- package/scripts/fidelity-audit.ts +26 -3
- package/scripts/materialize-version.ts +23 -0
- package/scripts/regen.ts +1 -1
- package/src/core-types.ts +9 -4
- package/src/emit-dts.ts +134 -5
- package/src/lifecycle.ts +383 -4
- package/src/socket-types.d.ts +48 -0
package/generated/socket.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Opaque } from "../src/core-types";
|
|
3
|
-
|
|
4
2
|
declare global {
|
|
5
3
|
/**
|
|
6
4
|
* [LuaSocket](https://github.com/diegonehab/luasocket) is a Lua extension library that provides
|
|
@@ -23,9 +21,575 @@ declare global {
|
|
|
23
21
|
* LuaSocket is free software, released under the MIT license (same license as the Lua core).
|
|
24
22
|
*/
|
|
25
23
|
namespace socket {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
interface client {
|
|
25
|
+
/**
|
|
26
|
+
* Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
|
|
27
|
+
* It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
|
|
28
|
+
*/
|
|
29
|
+
close(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Check the read buffer status.
|
|
32
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
33
|
+
*
|
|
34
|
+
* @returns `true` if there is any data in the read buffer, `false` otherwise.
|
|
35
|
+
*/
|
|
36
|
+
dirty(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the underlying socket descriptor or handle associated to the object.
|
|
39
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
40
|
+
*
|
|
41
|
+
* @returns the descriptor or handle. In case the object has been closed, the return will be -1.
|
|
42
|
+
*/
|
|
43
|
+
getfd(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Gets options for the TCP object. See client:setoption for description of the option names and values.
|
|
46
|
+
*
|
|
47
|
+
* @param option - the name of the option to get:
|
|
48
|
+
*
|
|
49
|
+
* - `"keepalive"`
|
|
50
|
+
*
|
|
51
|
+
* - `"linger"`
|
|
52
|
+
*
|
|
53
|
+
* - `"reuseaddr"`
|
|
54
|
+
*
|
|
55
|
+
* - `"tcp-nodelay"`
|
|
56
|
+
*/
|
|
57
|
+
getoption(option: string): LuaMultiReturn<[unknown, string | unknown]>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns information about the remote side of a connected client object.
|
|
60
|
+
* It makes no sense to call this method on server objects.
|
|
61
|
+
*
|
|
62
|
+
* @returns a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
63
|
+
*/
|
|
64
|
+
getpeername(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the local address information associated to the object.
|
|
67
|
+
*
|
|
68
|
+
* @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
69
|
+
*/
|
|
70
|
+
getsockname(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Returns accounting information on the socket, useful for throttling of bandwidth.
|
|
73
|
+
*
|
|
74
|
+
* @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
|
|
75
|
+
*/
|
|
76
|
+
getstats(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Reads data from a client object, according to the specified `read pattern`. Patterns follow the Lua file I/O format, and the difference in performance between patterns is negligible.
|
|
79
|
+
*
|
|
80
|
+
* @param pattern - the read pattern that can be any of the following:
|
|
81
|
+
*
|
|
82
|
+
* `"*a"`
|
|
83
|
+
* reads from the socket until the connection is closed. No end-of-line translation is performed;
|
|
84
|
+
* `"*l"`
|
|
85
|
+
* reads a line of text from the socket. The line is terminated by a LF character (ASCII 10), optionally preceded by a CR character (ASCII 13). The CR and LF characters are not included in the returned line. In fact, all CR characters are ignored by the pattern. This is the default pattern;
|
|
86
|
+
* `number`
|
|
87
|
+
* causes the method to read a specified number of bytes from the socket.
|
|
88
|
+
* @param prefix - an optional string to be concatenated to the beginning of any received data before return.
|
|
89
|
+
*/
|
|
90
|
+
receive(pattern?: string | number, prefix?: string): LuaMultiReturn<[string | unknown, string | unknown, string | unknown]>;
|
|
91
|
+
/**
|
|
92
|
+
* Sends data through client object.
|
|
93
|
+
* The optional arguments i and j work exactly like the standard string.sub Lua function to allow the selection of a substring to be sent.
|
|
94
|
+
* Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the `..` operator) and send the result in one call instead of calling the method several times.
|
|
95
|
+
*
|
|
96
|
+
* @param data - the string to be sent.
|
|
97
|
+
* @param i - optional starting index of the string.
|
|
98
|
+
* @param j - optional end index of string.
|
|
99
|
+
*/
|
|
100
|
+
send(data: string, i?: number, j?: number): LuaMultiReturn<[number | unknown, string | unknown, number | unknown]>;
|
|
101
|
+
/**
|
|
102
|
+
* Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
|
|
103
|
+
*
|
|
104
|
+
* @param handle - the descriptor or handle to set.
|
|
105
|
+
*/
|
|
106
|
+
setfd(handle: number): void;
|
|
107
|
+
/**
|
|
108
|
+
* Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
|
|
109
|
+
*
|
|
110
|
+
* @param option - the name of the option to set. The value is provided in the `value` parameter:
|
|
111
|
+
*
|
|
112
|
+
* `"keepalive"`
|
|
113
|
+
* Setting this option to `true` enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;
|
|
114
|
+
* `"linger"`
|
|
115
|
+
* Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
|
|
116
|
+
*
|
|
117
|
+
* - boolean `on`
|
|
118
|
+
*
|
|
119
|
+
* - number `timeout` (seconds)
|
|
120
|
+
*
|
|
121
|
+
* If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
|
|
122
|
+
*
|
|
123
|
+
* `"reuseaddr"`
|
|
124
|
+
* Setting this option indicates that the rules used in validating addresses supplied in a call to `bind` should allow reuse of local addresses;
|
|
125
|
+
* `"tcp-nodelay"`
|
|
126
|
+
* Setting this option to `true` disables the Nagle's algorithm for the connection;
|
|
127
|
+
* `"ipv6-v6only"`
|
|
128
|
+
* Setting this option to `true` restricts an inet6 socket to sending and receiving only IPv6 packets.
|
|
129
|
+
* @param value - the value to set for the specified option.
|
|
130
|
+
*/
|
|
131
|
+
setoption(option: string, value?: unknown): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
132
|
+
/**
|
|
133
|
+
* Resets accounting information on the socket, useful for throttling of bandwidth.
|
|
134
|
+
*
|
|
135
|
+
* @param received - the new number of bytes received.
|
|
136
|
+
* @param sent - the new number of bytes sent.
|
|
137
|
+
* @param age - the new age in seconds.
|
|
138
|
+
* @returns the value `1` in case of success, or `nil` in case of error.
|
|
139
|
+
*/
|
|
140
|
+
setstats(received: number, sent: number, age: number): number | unknown;
|
|
141
|
+
/**
|
|
142
|
+
* Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
|
|
143
|
+
* There are two timeout modes and both can be used together for fine tuning.
|
|
144
|
+
* Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
|
|
145
|
+
*
|
|
146
|
+
* @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
|
|
147
|
+
* @param mode - optional timeout mode to set:
|
|
148
|
+
*
|
|
149
|
+
* `"b"`
|
|
150
|
+
* block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
|
|
151
|
+
* `"t"`
|
|
152
|
+
* total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
|
|
153
|
+
*/
|
|
154
|
+
settimeout(value: number, mode?: string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Shuts down part of a full-duplex connection.
|
|
157
|
+
*
|
|
158
|
+
* @param mode - which way of the connection should be shut down:
|
|
159
|
+
*
|
|
160
|
+
* `"both"`
|
|
161
|
+
* disallow further sends and receives on the object. This is the default mode;
|
|
162
|
+
* `"send"`
|
|
163
|
+
* disallow further sends on the object;
|
|
164
|
+
* `"receive"`
|
|
165
|
+
* disallow further receives on the object.
|
|
166
|
+
* @returns the value `1`.
|
|
167
|
+
*/
|
|
168
|
+
shutdown(mode: string): number;
|
|
169
|
+
}
|
|
170
|
+
interface connected {
|
|
171
|
+
/**
|
|
172
|
+
* Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
|
|
173
|
+
* It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
|
|
174
|
+
*/
|
|
175
|
+
close(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Gets an option value from the UDP object. See connected:setoption for description of the option names and values.
|
|
178
|
+
*
|
|
179
|
+
* @param option - the name of the option to get:
|
|
180
|
+
*
|
|
181
|
+
* - `"dontroute"`
|
|
182
|
+
*
|
|
183
|
+
* - `"broadcast"`
|
|
184
|
+
*
|
|
185
|
+
* - `"reuseaddr"`
|
|
186
|
+
*
|
|
187
|
+
* - `"reuseport"`
|
|
188
|
+
*
|
|
189
|
+
* - `"ip-multicast-loop"`
|
|
190
|
+
*
|
|
191
|
+
* - `"ipv6-v6only"`
|
|
192
|
+
*
|
|
193
|
+
* - `"ip-multicast-if"`
|
|
194
|
+
*
|
|
195
|
+
* - `"ip-multicast-ttl"`
|
|
196
|
+
*
|
|
197
|
+
* - `"ip-add-membership"`
|
|
198
|
+
*
|
|
199
|
+
* - `"ip-drop-membership"`
|
|
200
|
+
*/
|
|
201
|
+
getoption(option: string): LuaMultiReturn<[unknown, string | unknown]>;
|
|
202
|
+
/**
|
|
203
|
+
* Retrieves information about the peer associated with a connected UDP object.
|
|
204
|
+
* It makes no sense to call this method on unconnected objects.
|
|
205
|
+
*
|
|
206
|
+
* @returns a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
207
|
+
*/
|
|
208
|
+
getpeername(): string;
|
|
209
|
+
/**
|
|
210
|
+
* Returns the local address information associated to the object.
|
|
211
|
+
* UDP sockets are not bound to any address until the `setsockname` or the `sendto` method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
|
|
212
|
+
*
|
|
213
|
+
* @returns a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
214
|
+
*/
|
|
215
|
+
getsockname(): string;
|
|
216
|
+
/**
|
|
217
|
+
* Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
|
|
218
|
+
*
|
|
219
|
+
* @param size - optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
|
|
220
|
+
*/
|
|
221
|
+
receive(size?: number): LuaMultiReturn<[string | unknown, string | unknown]>;
|
|
222
|
+
/**
|
|
223
|
+
* Sends a datagram to the UDP peer of a connected object.
|
|
224
|
+
* In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
|
|
225
|
+
*
|
|
226
|
+
* @param datagram - a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
|
|
227
|
+
*/
|
|
228
|
+
send(datagram: string): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
229
|
+
/**
|
|
230
|
+
* Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
|
|
231
|
+
*
|
|
232
|
+
* @param option - the name of the option to set. The value is provided in the `value` parameter:
|
|
233
|
+
*
|
|
234
|
+
* `"dontroute"`
|
|
235
|
+
* Indicates that outgoing messages should bypass the standard routing facilities. Receives a boolean value;
|
|
236
|
+
* `"broadcast"`
|
|
237
|
+
* Requests permission to send broadcast datagrams on the socket. Receives a boolean value;
|
|
238
|
+
* `"reuseaddr"`
|
|
239
|
+
* Indicates that the rules used in validating addresses supplied in a `bind` call should allow reuse of local addresses. Receives a boolean value;
|
|
240
|
+
* `"reuseport"`
|
|
241
|
+
* Allows completely duplicate bindings by multiple processes if they all set `"reuseport"` before binding the port. Receives a boolean value;
|
|
242
|
+
* `"ip-multicast-loop"`
|
|
243
|
+
* Specifies whether or not a copy of an outgoing multicast datagram is delivered to the sending host as long as it is a member of the multicast group. Receives a boolean value;
|
|
244
|
+
* `"ipv6-v6only"`
|
|
245
|
+
* Specifies whether to restrict inet6 sockets to sending and receiving only IPv6 packets. Receive a boolean value;
|
|
246
|
+
* `"ip-multicast-if"`
|
|
247
|
+
* Sets the interface over which outgoing multicast datagrams are sent. Receives an IP address;
|
|
248
|
+
* `"ip-multicast-ttl"`
|
|
249
|
+
* Sets the Time To Live in the IP header for outgoing multicast datagrams. Receives a number;
|
|
250
|
+
*
|
|
251
|
+
* `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
|
|
252
|
+
*
|
|
253
|
+
* - string `multiaddr` (IP address)
|
|
254
|
+
*
|
|
255
|
+
* - string `interface` (IP address)
|
|
256
|
+
*
|
|
257
|
+
* "'ip-drop-membership"`
|
|
258
|
+
* Leaves the multicast group specified. Receives a table with fields:
|
|
259
|
+
*
|
|
260
|
+
* - string `multiaddr` (IP address)
|
|
261
|
+
*
|
|
262
|
+
* - string `interface` (IP address)
|
|
263
|
+
* @param value - the value to set for the specified option.
|
|
264
|
+
*/
|
|
265
|
+
setoption(option: string, value?: unknown): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
266
|
+
/**
|
|
267
|
+
* Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
|
|
268
|
+
* For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the `send` and `receive` methods instead of `sendto` and `receivefrom`.
|
|
269
|
+
* Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
|
|
270
|
+
*
|
|
271
|
+
* @param arg0 - if address is "*" and the object is connected, the peer association is removed and the object becomes an unconnected object again.
|
|
272
|
+
*/
|
|
273
|
+
setpeername(arg0: string): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
274
|
+
/**
|
|
275
|
+
* Changes the timeout values for the object. By default, the `receive` and `receivefrom` operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The `settimeout` function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
|
|
276
|
+
* In UDP, the `send` and `sendto` methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the `settimeout` method has no effect on them.
|
|
277
|
+
*
|
|
278
|
+
* @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
|
|
279
|
+
*/
|
|
280
|
+
settimeout(value: number): void;
|
|
281
|
+
}
|
|
282
|
+
interface master {
|
|
283
|
+
/**
|
|
284
|
+
* Binds a master object to address and port on the local host.
|
|
285
|
+
*
|
|
286
|
+
* @param address - an IP address or a host name. If address is `"*"`, the system binds to all local interfaces using the `INADDR_ANY` constant.
|
|
287
|
+
* @param port - the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
|
|
288
|
+
*/
|
|
289
|
+
bind(address: string, port: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
290
|
+
/**
|
|
291
|
+
* Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
|
|
292
|
+
* It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
|
|
293
|
+
*/
|
|
294
|
+
close(): void;
|
|
295
|
+
/**
|
|
296
|
+
* Attempts to connect a master object to a remote host, transforming it into a client object. Client objects support methods send, receive, getsockname, getpeername, settimeout, and close.
|
|
297
|
+
* Note that the function `socket.connect` is available and is a shortcut for the creation of client sockets.
|
|
298
|
+
*
|
|
299
|
+
* @param address - an IP address or a host name. If address is `"*"`, the system binds to all local interfaces using the `INADDR_ANY` constant.
|
|
300
|
+
* @param port - the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
|
|
301
|
+
*/
|
|
302
|
+
connect(address: string, port: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
303
|
+
/**
|
|
304
|
+
* Check the read buffer status.
|
|
305
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
306
|
+
*
|
|
307
|
+
* @returns `true` if there is any data in the read buffer, `false` otherwise.
|
|
308
|
+
*/
|
|
309
|
+
dirty(): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Returns the underlying socket descriptor or handle associated to the object.
|
|
312
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
313
|
+
*
|
|
314
|
+
* @returns the descriptor or handle. In case the object has been closed, the return will be -1.
|
|
315
|
+
*/
|
|
316
|
+
getfd(): number;
|
|
317
|
+
/**
|
|
318
|
+
* Returns the local address information associated to the object.
|
|
319
|
+
*
|
|
320
|
+
* @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
321
|
+
*/
|
|
322
|
+
getsockname(): string;
|
|
323
|
+
/**
|
|
324
|
+
* Returns accounting information on the socket, useful for throttling of bandwidth.
|
|
325
|
+
*
|
|
326
|
+
* @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
|
|
327
|
+
*/
|
|
328
|
+
getstats(): string;
|
|
329
|
+
/**
|
|
330
|
+
* Specifies the socket is willing to receive connections, transforming the object into a server object. Server objects support the `accept`, `getsockname`, `setoption`, `settimeout`, and `close` methods.
|
|
331
|
+
*
|
|
332
|
+
* @param backlog - the number of client connections that can be queued waiting for service. If the queue is full and another client attempts connection, the connection is refused.
|
|
333
|
+
*/
|
|
334
|
+
listen(backlog: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
335
|
+
/**
|
|
336
|
+
* Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
|
|
337
|
+
*
|
|
338
|
+
* @param handle - the descriptor or handle to set.
|
|
339
|
+
*/
|
|
340
|
+
setfd(handle: number): void;
|
|
341
|
+
/**
|
|
342
|
+
* Resets accounting information on the socket, useful for throttling of bandwidth.
|
|
343
|
+
*
|
|
344
|
+
* @param received - the new number of bytes received.
|
|
345
|
+
* @param sent - the new number of bytes sent.
|
|
346
|
+
* @param age - the new age in seconds.
|
|
347
|
+
* @returns the value `1` in case of success, or `nil` in case of error.
|
|
348
|
+
*/
|
|
349
|
+
setstats(received: number, sent: number, age: number): number | unknown;
|
|
350
|
+
/**
|
|
351
|
+
* Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
|
|
352
|
+
* There are two timeout modes and both can be used together for fine tuning.
|
|
353
|
+
* Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
|
|
354
|
+
*
|
|
355
|
+
* @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
|
|
356
|
+
* @param mode - optional timeout mode to set:
|
|
357
|
+
*
|
|
358
|
+
* `"b"`
|
|
359
|
+
* block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
|
|
360
|
+
* `"t"`
|
|
361
|
+
* total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
|
|
362
|
+
*/
|
|
363
|
+
settimeout(value: number, mode?: string): void;
|
|
364
|
+
}
|
|
365
|
+
interface server {
|
|
366
|
+
/**
|
|
367
|
+
* Waits for a remote connection on the server object and returns a client object representing that connection.
|
|
368
|
+
* Calling `socket.select` with a server object in the `recvt` parameter before a call to accept does not guarantee accept will return immediately. Use the `settimeout` method or accept might block until another client shows up.
|
|
369
|
+
*/
|
|
370
|
+
accept(): LuaMultiReturn<[client | unknown, string | unknown]>;
|
|
371
|
+
/**
|
|
372
|
+
* Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
|
|
373
|
+
* It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
|
|
374
|
+
*/
|
|
375
|
+
close(): void;
|
|
376
|
+
/**
|
|
377
|
+
* Check the read buffer status.
|
|
378
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
379
|
+
*
|
|
380
|
+
* @returns `true` if there is any data in the read buffer, `false` otherwise.
|
|
381
|
+
*/
|
|
382
|
+
dirty(): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Returns the underlying socket descriptor or handle associated to the object.
|
|
385
|
+
* This is an internal method, any use is unlikely to be portable.
|
|
386
|
+
*
|
|
387
|
+
* @returns the descriptor or handle. In case the object has been closed, the return will be -1.
|
|
388
|
+
*/
|
|
389
|
+
getfd(): number;
|
|
390
|
+
/**
|
|
391
|
+
* Gets options for the TCP object. See server:setoption for description of the option names and values.
|
|
392
|
+
*
|
|
393
|
+
* @param option - the name of the option to get:
|
|
394
|
+
*
|
|
395
|
+
* - `"keepalive"`
|
|
396
|
+
*
|
|
397
|
+
* - `"linger"`
|
|
398
|
+
*
|
|
399
|
+
* - `"reuseaddr"`
|
|
400
|
+
*
|
|
401
|
+
* - `"tcp-nodelay"`
|
|
402
|
+
*/
|
|
403
|
+
getoption(option: string): LuaMultiReturn<[unknown, string | unknown]>;
|
|
404
|
+
/**
|
|
405
|
+
* Returns the local address information associated to the object.
|
|
406
|
+
*
|
|
407
|
+
* @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
408
|
+
*/
|
|
409
|
+
getsockname(): string;
|
|
410
|
+
/**
|
|
411
|
+
* Returns accounting information on the socket, useful for throttling of bandwidth.
|
|
412
|
+
*
|
|
413
|
+
* @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
|
|
414
|
+
*/
|
|
415
|
+
getstats(): string;
|
|
416
|
+
/**
|
|
417
|
+
* Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
|
|
418
|
+
*
|
|
419
|
+
* @param handle - the descriptor or handle to set.
|
|
420
|
+
*/
|
|
421
|
+
setfd(handle: number): void;
|
|
422
|
+
/**
|
|
423
|
+
* Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
|
|
424
|
+
*
|
|
425
|
+
* @param option - the name of the option to set. The value is provided in the `value` parameter:
|
|
426
|
+
*
|
|
427
|
+
* `"keepalive"`
|
|
428
|
+
* Setting this option to `true` enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;
|
|
429
|
+
* `"linger"`
|
|
430
|
+
* Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
|
|
431
|
+
*
|
|
432
|
+
* - boolean `on`
|
|
433
|
+
*
|
|
434
|
+
* - number `timeout` (seconds)
|
|
435
|
+
*
|
|
436
|
+
* If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
|
|
437
|
+
*
|
|
438
|
+
* `"reuseaddr"`
|
|
439
|
+
* Setting this option indicates that the rules used in validating addresses supplied in a call to `bind` should allow reuse of local addresses;
|
|
440
|
+
* `"tcp-nodelay"`
|
|
441
|
+
* Setting this option to `true` disables the Nagle's algorithm for the connection;
|
|
442
|
+
* `"ipv6-v6only"`
|
|
443
|
+
* Setting this option to `true` restricts an inet6 socket to sending and receiving only IPv6 packets.
|
|
444
|
+
* @param value - the value to set for the specified option.
|
|
445
|
+
*/
|
|
446
|
+
setoption(option: string, value?: unknown): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
447
|
+
/**
|
|
448
|
+
* Resets accounting information on the socket, useful for throttling of bandwidth.
|
|
449
|
+
*
|
|
450
|
+
* @param received - the new number of bytes received.
|
|
451
|
+
* @param sent - the new number of bytes sent.
|
|
452
|
+
* @param age - the new age in seconds.
|
|
453
|
+
* @returns the value `1` in case of success, or `nil` in case of error.
|
|
454
|
+
*/
|
|
455
|
+
setstats(received: number, sent: number, age: number): number | unknown;
|
|
456
|
+
/**
|
|
457
|
+
* Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
|
|
458
|
+
* There are two timeout modes and both can be used together for fine tuning.
|
|
459
|
+
* Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
|
|
460
|
+
*
|
|
461
|
+
* @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
|
|
462
|
+
* @param mode - optional timeout mode to set:
|
|
463
|
+
*
|
|
464
|
+
* `"b"`
|
|
465
|
+
* block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
|
|
466
|
+
* `"t"`
|
|
467
|
+
* total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
|
|
468
|
+
*/
|
|
469
|
+
settimeout(value: number, mode?: string): void;
|
|
470
|
+
}
|
|
471
|
+
interface unconnected {
|
|
472
|
+
/**
|
|
473
|
+
* Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
|
|
474
|
+
* It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
|
|
475
|
+
*/
|
|
476
|
+
close(): void;
|
|
477
|
+
/**
|
|
478
|
+
* Gets an option value from the UDP object. See unconnected:setoption for description of the option names and values.
|
|
479
|
+
*
|
|
480
|
+
* @param option - the name of the option to get:
|
|
481
|
+
*
|
|
482
|
+
* - `"dontroute"`
|
|
483
|
+
*
|
|
484
|
+
* - `"broadcast"`
|
|
485
|
+
*
|
|
486
|
+
* - `"reuseaddr"`
|
|
487
|
+
*
|
|
488
|
+
* - `"reuseport"`
|
|
489
|
+
*
|
|
490
|
+
* - `"ip-multicast-loop"`
|
|
491
|
+
*
|
|
492
|
+
* - `"ipv6-v6only"`
|
|
493
|
+
*
|
|
494
|
+
* - `"ip-multicast-if"`
|
|
495
|
+
*
|
|
496
|
+
* - `"ip-multicast-ttl"`
|
|
497
|
+
*
|
|
498
|
+
* - `"ip-add-membership"`
|
|
499
|
+
*
|
|
500
|
+
* - `"ip-drop-membership"`
|
|
501
|
+
*/
|
|
502
|
+
getoption(option: string): LuaMultiReturn<[unknown, string | unknown]>;
|
|
503
|
+
/**
|
|
504
|
+
* Returns the local address information associated to the object.
|
|
505
|
+
* UDP sockets are not bound to any address until the `setsockname` or the `sendto` method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
|
|
506
|
+
*
|
|
507
|
+
* @returns a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
|
|
508
|
+
*/
|
|
509
|
+
getsockname(): string;
|
|
510
|
+
/**
|
|
511
|
+
* Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
|
|
512
|
+
*
|
|
513
|
+
* @param size - optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
|
|
514
|
+
*/
|
|
515
|
+
receive(size?: number): LuaMultiReturn<[string | unknown, string | unknown]>;
|
|
516
|
+
/**
|
|
517
|
+
* Works exactly as the receive method, except it returns the IP address and port as extra return values (and is therefore slightly less efficient).
|
|
518
|
+
*
|
|
519
|
+
* @param size - optional maximum size of the datagram to be retrieved.
|
|
520
|
+
*/
|
|
521
|
+
receivefrom(size?: number): LuaMultiReturn<[string | unknown, string, number | unknown]>;
|
|
522
|
+
/**
|
|
523
|
+
* Sends a datagram to the specified IP address and port number.
|
|
524
|
+
* In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
|
|
525
|
+
*
|
|
526
|
+
* @param datagram - a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
|
|
527
|
+
* @param ip - the IP address of the recipient. Host names are not allowed for performance reasons.
|
|
528
|
+
* @param port - the port number at the recipient.
|
|
529
|
+
*/
|
|
530
|
+
sendto(datagram: string, ip: string, port: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
531
|
+
/**
|
|
532
|
+
* Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
|
|
533
|
+
*
|
|
534
|
+
* @param option - the name of the option to set. The value is provided in the `value` parameter:
|
|
535
|
+
*
|
|
536
|
+
* `"dontroute"`
|
|
537
|
+
* Indicates that outgoing messages should bypass the standard routing facilities. Receives a boolean value;
|
|
538
|
+
* `"broadcast"`
|
|
539
|
+
* Requests permission to send broadcast datagrams on the socket. Receives a boolean value;
|
|
540
|
+
* `"reuseaddr"`
|
|
541
|
+
* Indicates that the rules used in validating addresses supplied in a `bind` call should allow reuse of local addresses. Receives a boolean value;
|
|
542
|
+
* `"reuseport"`
|
|
543
|
+
* Allows completely duplicate bindings by multiple processes if they all set `"reuseport"` before binding the port. Receives a boolean value;
|
|
544
|
+
* `"ip-multicast-loop"`
|
|
545
|
+
* Specifies whether or not a copy of an outgoing multicast datagram is delivered to the sending host as long as it is a member of the multicast group. Receives a boolean value;
|
|
546
|
+
* `"ipv6-v6only"`
|
|
547
|
+
* Specifies whether to restrict inet6 sockets to sending and receiving only IPv6 packets. Receive a boolean value;
|
|
548
|
+
* `"ip-multicast-if"`
|
|
549
|
+
* Sets the interface over which outgoing multicast datagrams are sent. Receives an IP address;
|
|
550
|
+
* `"ip-multicast-ttl"`
|
|
551
|
+
* Sets the Time To Live in the IP header for outgoing multicast datagrams. Receives a number;
|
|
552
|
+
*
|
|
553
|
+
* `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
|
|
554
|
+
*
|
|
555
|
+
* - string `multiaddr` (IP address)
|
|
556
|
+
*
|
|
557
|
+
* - string `interface` (IP address)
|
|
558
|
+
*
|
|
559
|
+
* "'ip-drop-membership"`
|
|
560
|
+
* Leaves the multicast group specified. Receives a table with fields:
|
|
561
|
+
*
|
|
562
|
+
* - string `multiaddr` (IP address)
|
|
563
|
+
*
|
|
564
|
+
* - string `interface` (IP address)
|
|
565
|
+
* @param value - the value to set for the specified option.
|
|
566
|
+
*/
|
|
567
|
+
setoption(option: string, value?: unknown): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
568
|
+
/**
|
|
569
|
+
* Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
|
|
570
|
+
* For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the `send` and `receive` methods instead of `sendto` and `receivefrom`.
|
|
571
|
+
* Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
|
|
572
|
+
*
|
|
573
|
+
* @param address - an IP address or a host name.
|
|
574
|
+
* @param port - the port number.
|
|
575
|
+
*/
|
|
576
|
+
setpeername(address: string, port: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
577
|
+
/**
|
|
578
|
+
* Binds the UDP object to a local address.
|
|
579
|
+
* This method can only be called before any datagram is sent through the UDP object, and only once. Otherwise, the system automatically binds the object to all local interfaces and chooses an ephemeral port as soon as the first datagram is sent. After the local address is set, either automatically by the system or explicitly by `setsockname`, it cannot be changed.
|
|
580
|
+
*
|
|
581
|
+
* @param address - an IP address or a host name. If address is "*" the system binds to all local interfaces using the constant `INADDR_ANY`.
|
|
582
|
+
* @param port - the port number. If port is 0, the system chooses an ephemeral port.
|
|
583
|
+
*/
|
|
584
|
+
setsockname(address: string, port: number): LuaMultiReturn<[number | unknown, string | unknown]>;
|
|
585
|
+
/**
|
|
586
|
+
* Changes the timeout values for the object. By default, the `receive` and `receivefrom` operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The `settimeout` function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
|
|
587
|
+
* In UDP, the `send` and `sendto` methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the `settimeout` method has no effect on them.
|
|
588
|
+
*
|
|
589
|
+
* @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
|
|
590
|
+
*/
|
|
591
|
+
settimeout(value: number): void;
|
|
592
|
+
}
|
|
29
593
|
/**
|
|
30
594
|
* This constant contains the maximum number of sockets that the select function can handle.
|
|
31
595
|
*/
|
|
@@ -47,7 +611,7 @@ declare global {
|
|
|
47
611
|
* @param locport - optional local port to bind to.
|
|
48
612
|
* @param family - optional socket family to use, `"inet"` or `"inet6"`.
|
|
49
613
|
*/
|
|
50
|
-
function connect(address: string, port: number, locaddr?: string, locport?: number, family?: string): LuaMultiReturn<[
|
|
614
|
+
function connect(address: string, port: number, locaddr?: string, locport?: number, family?: string): LuaMultiReturn<[client | unknown, string | unknown]>;
|
|
51
615
|
/**
|
|
52
616
|
* Returns the time in seconds, relative to the system epoch (Unix epoch time since January 1, 1970 (UTC) or Windows file time since January 1, 1601 (UTC)).
|
|
53
617
|
* You should use the values returned by this function for relative measurements only.
|
|
@@ -117,7 +681,7 @@ declare global {
|
|
|
117
681
|
* @param sendt - array with sockets that are watched to see if it is OK to immediately write on them.
|
|
118
682
|
* @param timeout - the maximum amount of time (in seconds) to wait for a change in status. Nil, negative or omitted timeout value allows the function to block indefinitely.
|
|
119
683
|
*/
|
|
120
|
-
function select(recvt: (
|
|
684
|
+
function select(recvt: (client | master | unconnected)[], sendt: (client | master | unconnected)[], timeout?: number): LuaMultiReturn<[(client | master | unconnected)[], (client | master | unconnected)[], string | unknown]>;
|
|
121
685
|
/**
|
|
122
686
|
* This function drops a number of arguments and returns the remaining.
|
|
123
687
|
* It is useful to avoid creation of dummy variables:
|
|
@@ -149,21 +713,82 @@ declare global {
|
|
|
149
713
|
/**
|
|
150
714
|
* Creates and returns an IPv4 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method `connect`. The only other method supported by a master object is the `close` method.
|
|
151
715
|
*/
|
|
152
|
-
function tcp(): LuaMultiReturn<[
|
|
716
|
+
function tcp(): LuaMultiReturn<[master | unknown, string | unknown]>;
|
|
153
717
|
/**
|
|
154
718
|
* Creates and returns an IPv6 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method connect. The only other method supported by a master object is the close method.
|
|
155
719
|
* Note: The TCP object returned will have the option "ipv6-v6only" set to true.
|
|
156
720
|
*/
|
|
157
|
-
function tcp6(): LuaMultiReturn<[
|
|
721
|
+
function tcp6(): LuaMultiReturn<[master | unknown, string | unknown]>;
|
|
158
722
|
/**
|
|
159
723
|
* Creates and returns an unconnected IPv4 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
|
|
160
724
|
*/
|
|
161
|
-
function udp(): LuaMultiReturn<[
|
|
725
|
+
function udp(): LuaMultiReturn<[unconnected | unknown, string | unknown]>;
|
|
162
726
|
/**
|
|
163
727
|
* Creates and returns an unconnected IPv6 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
|
|
164
728
|
* Note: The UDP object returned will have the option "ipv6-v6only" set to true.
|
|
165
729
|
*/
|
|
166
|
-
function udp6(): LuaMultiReturn<[
|
|
730
|
+
function udp6(): LuaMultiReturn<[unconnected | unknown, string | unknown]>;
|
|
731
|
+
namespace dns {
|
|
732
|
+
/**
|
|
733
|
+
* This function converts a host name to IPv4 or IPv6 address.
|
|
734
|
+
* The supplied address can be an IPv4 or IPv6 address or host name.
|
|
735
|
+
* The function returns a table with all information returned by the resolver:
|
|
736
|
+
*
|
|
737
|
+
* `{
|
|
738
|
+
* [1] = {
|
|
739
|
+
* family = family-name-1,
|
|
740
|
+
* addr = address-1
|
|
741
|
+
* },
|
|
742
|
+
* ...
|
|
743
|
+
* [n] = {
|
|
744
|
+
* family = family-name-n,
|
|
745
|
+
* addr = address-n
|
|
746
|
+
* }
|
|
747
|
+
* }
|
|
748
|
+
* `
|
|
749
|
+
*
|
|
750
|
+
* Here, family contains the string `"inet"` for IPv4 addresses, and `"inet6"` for IPv6 addresses.
|
|
751
|
+
* In case of error, the function returns nil followed by an error message.
|
|
752
|
+
*
|
|
753
|
+
* @param address - a hostname or an IPv4 or IPv6 address.
|
|
754
|
+
*/
|
|
755
|
+
function getaddrinfo(address: string): LuaMultiReturn<[Record<string | number, unknown> | unknown, string | unknown]>;
|
|
756
|
+
/**
|
|
757
|
+
* Returns the standard host name for the machine as a string.
|
|
758
|
+
*
|
|
759
|
+
* @returns the host name for the machine.
|
|
760
|
+
*/
|
|
761
|
+
function gethostname(): string;
|
|
762
|
+
/**
|
|
763
|
+
* This function converts an address to host name.
|
|
764
|
+
* The supplied address can be an IPv4 or IPv6 address or host name.
|
|
765
|
+
* The function returns a table with all information returned by the resolver:
|
|
766
|
+
*
|
|
767
|
+
* `{
|
|
768
|
+
* [1] = host-name-1,
|
|
769
|
+
* ...
|
|
770
|
+
* [n] = host-name-n,
|
|
771
|
+
* }
|
|
772
|
+
* `
|
|
773
|
+
*
|
|
774
|
+
* @param address - a hostname or an IPv4 or IPv6 address.
|
|
775
|
+
*/
|
|
776
|
+
function getnameinfo(address: string): LuaMultiReturn<[Record<string | number, unknown> | unknown, string | unknown]>;
|
|
777
|
+
/**
|
|
778
|
+
* This function converts from an IPv4 address to host name.
|
|
779
|
+
* The address can be an IPv4 address or a host name.
|
|
780
|
+
*
|
|
781
|
+
* @param address - an IPv4 address or host name.
|
|
782
|
+
*/
|
|
783
|
+
function tohostname(address: string): LuaMultiReturn<[string | unknown, Record<string | number, unknown> | string]>;
|
|
784
|
+
/**
|
|
785
|
+
* This function converts a host name to IPv4 address.
|
|
786
|
+
* The address can be an IP address or a host name.
|
|
787
|
+
*
|
|
788
|
+
* @param address - a hostname or an IP address.
|
|
789
|
+
*/
|
|
790
|
+
function toip(address: string): LuaMultiReturn<[string | unknown, Record<string | number, unknown> | string]>;
|
|
791
|
+
}
|
|
167
792
|
}
|
|
168
793
|
}
|
|
169
794
|
|