@amritk/nish-aarch64-darwin 0.35.0 → 0.37.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.
Files changed (128) hide show
  1. package/INSTALL.md +73 -59
  2. package/bin/nish +0 -0
  3. package/docs/AI.md +50 -4
  4. package/package.json +1 -1
  5. package/runtime/async.d.mts +2 -0
  6. package/runtime/async.mjs +7 -0
  7. package/runtime/nish.d.ts +4849 -430
  8. package/runtime/nish.h +25 -0
  9. package/runtime/page.d.ts +53 -0
  10. package/runtime/page.mjs +146 -0
  11. package/runtime/runtime-async.c +557 -0
  12. package/runtime/runtime-wasm.c +63 -7
  13. package/runtime/vite.d.ts +30 -0
  14. package/runtime/vite.mjs +150 -0
  15. package/scripts/build.sh +252 -15
  16. package/std/README.md +107 -82
  17. package/std/base64.ts +34 -5
  18. package/std/bytes.ts +279 -59
  19. package/std/cli-args.ts +296 -70
  20. package/std/cli-flags.ts +184 -19
  21. package/std/cli.ts +475 -54
  22. package/std/collections.ts +121 -23
  23. package/std/compress/checksum.ts +44 -14
  24. package/std/compress/deflate.ts +224 -111
  25. package/std/compress/gzip.ts +217 -53
  26. package/std/compress/zlib.ts +63 -7
  27. package/std/crypto/aes.ts +128 -52
  28. package/std/crypto/base64url.ts +29 -5
  29. package/std/crypto/bcrypt-batch.ts +101 -34
  30. package/std/crypto/bcrypt.ts +93 -27
  31. package/std/crypto/chacha20poly1305.ts +69 -14
  32. package/std/crypto/ct.ts +32 -13
  33. package/std/crypto/ed25519.ts +66 -16
  34. package/std/crypto/hkdf.ts +198 -13
  35. package/std/crypto/hmac.ts +242 -37
  36. package/std/crypto/jwt.ts +204 -72
  37. package/std/crypto/p256.ts +222 -72
  38. package/std/crypto/p384.ts +51 -23
  39. package/std/crypto/pki-roots.ts +32 -2
  40. package/std/crypto/pki.ts +99 -30
  41. package/std/crypto/rsa.ts +56 -22
  42. package/std/crypto/sha1.ts +3 -0
  43. package/std/crypto/sha256.ts +24 -1
  44. package/std/crypto/sha512.ts +99 -14
  45. package/std/crypto/x25519.ts +163 -24
  46. package/std/crypto/x509-random.ts +10 -0
  47. package/std/crypto/x509.ts +133 -66
  48. package/std/host/ring.ts +124 -0
  49. package/std/json-equal.ts +31 -11
  50. package/std/json-format.ts +112 -13
  51. package/std/json-number.ts +76 -26
  52. package/std/json-pointer.ts +23 -1
  53. package/std/json-tokenizer.ts +126 -51
  54. package/std/json-typed.ts +757 -96
  55. package/std/json-value.ts +438 -157
  56. package/std/json.ts +170 -38
  57. package/std/map.ts +25 -7
  58. package/std/math.ts +36 -4
  59. package/std/net/buffer-pool.ts +42 -11
  60. package/std/net/dns-config.ts +109 -23
  61. package/std/net/dns-message.ts +62 -7
  62. package/std/net/dns-resolver.ts +247 -53
  63. package/std/net/dns.ts +203 -35
  64. package/std/net/fetch.ts +1267 -290
  65. package/std/net/handler.ts +296 -80
  66. package/std/net/hpack.ts +290 -77
  67. package/std/net/http-compress.ts +152 -36
  68. package/std/net/http-fields.ts +85 -9
  69. package/std/net/http1-client-codec.ts +129 -44
  70. package/std/net/http1-codec.ts +279 -114
  71. package/std/net/http1-server.ts +409 -139
  72. package/std/net/http2-frame.ts +289 -51
  73. package/std/net/http2-tls.ts +152 -49
  74. package/std/net/http2.ts +314 -160
  75. package/std/net/http3-frame.ts +165 -27
  76. package/std/net/http3-server.ts +282 -131
  77. package/std/net/http3.ts +377 -173
  78. package/std/net/outbound.ts +37 -3
  79. package/std/net/postgres-carrier.ts +144 -8
  80. package/std/net/postgres.ts +898 -260
  81. package/std/net/prefork.ts +202 -65
  82. package/std/net/qpack.ts +120 -32
  83. package/std/net/quic-conn-ack.ts +60 -12
  84. package/std/net/quic-conn-cid.ts +135 -27
  85. package/std/net/quic-conn-params.ts +109 -22
  86. package/std/net/quic-datagram.ts +50 -3
  87. package/std/net/quic-frame.ts +333 -23
  88. package/std/net/quic-listener.ts +161 -75
  89. package/std/net/quic-packet.ts +373 -73
  90. package/std/net/quic-recovery.ts +287 -65
  91. package/std/net/quic-stream.ts +436 -146
  92. package/std/net/quic.ts +693 -323
  93. package/std/net/router.ts +87 -40
  94. package/std/net/tls/client.ts +167 -51
  95. package/std/net/tls/codec.ts +494 -68
  96. package/std/net/tls/record-client.ts +140 -73
  97. package/std/net/tls/record-server.ts +233 -105
  98. package/std/net/tls/record.ts +142 -36
  99. package/std/net/tls/schedule.ts +235 -26
  100. package/std/net/tls/ticket.ts +161 -40
  101. package/std/net/tls/verify.ts +57 -10
  102. package/std/net/tls-tcp.ts +308 -95
  103. package/std/net/tls.ts +276 -102
  104. package/std/net/upstream.ts +81 -45
  105. package/std/net/url.ts +109 -22
  106. package/std/net/websocket.ts +140 -26
  107. package/std/net/webtransport.ts +243 -106
  108. package/std/pair.ts +10 -2
  109. package/std/random.ts +42 -15
  110. package/std/regex.ts +422 -257
  111. package/std/region.ts +70 -15
  112. package/std/secret.ts +52 -11
  113. package/std/sort.ts +17 -2
  114. package/std/sqlite.ts +256 -35
  115. package/std/sync/ring.ts +229 -56
  116. package/std/sync/shm.ts +203 -23
  117. package/std/term-io.ts +154 -78
  118. package/std/term-pixels.ts +144 -19
  119. package/std/term-probe.ts +77 -35
  120. package/std/term-rate.ts +199 -118
  121. package/std/term.ts +400 -175
  122. package/std/testing.ts +130 -32
  123. package/std/text.ts +84 -17
  124. package/std/threads.ts +248 -56
  125. package/std/yaml-json.ts +111 -97
  126. package/std/yaml-lines.ts +47 -15
  127. package/std/yaml-write.ts +45 -30
  128. package/std/yaml.ts +764 -384
@@ -5,24 +5,42 @@
5
5
  * server, so a bad `Http2Config` is refused there; every other slot's is built
6
6
  * on the first accept into it.
7
7
  *
8
- * const listener = tcpListen("0.0.0.0", 8443, 128);
9
- * const server = new Http2TlsServer(tlsConfig, new Http2Config(), listener, 64);
10
- * // tlsConfig.alpn holds "h2"
11
- * // when the listener is readable:
12
- * const slot: i32 = server.accept(serverRandom, ephemeralKey);
13
- * if (slot >= 0) { pollAdd(loop, server.fd(slot), 1, slot); }
14
- * // when a connection's token comes back:
15
- * let wants: i32 = (events & 5) !== 0 ? server.readable(slot) : server.writable(slot);
16
- * if ((wants & TLS_RECORD_SIGN) !== 0) { server.signP256(slot, leafKey); }
17
- * let event: i32 = server.next(slot);
18
- * while (event !== H2_NEED_MORE && event !== H2_ERROR) {
19
- * const conn: Http2Connection = server.connection(slot);
20
- * // H2_REQUEST: conn.respond(conn.stream, 200, names, values, false) ...
21
- * event = server.next(slot);
22
- * }
23
- * wants = server.flush(slot);
24
- * if ((wants & TLS_RECORD_DONE) !== 0) { server.close(slot); }
25
- * else { pollModify(loop, server.fd(slot), wants & 3, slot); }
8
+ * import { Secret } from "nish:secret";
9
+ * import { pollAdd, pollModify, tcpListen } from "nish:net";
10
+ * import { H2_ERROR, H2_NEED_MORE, H2_REQUEST, Http2Config, Http2Connection } from "nish/net/http2";
11
+ * import { Http2TlsServer } from "nish/net/http2-tls";
12
+ * import { TlsServerConfig } from "nish/net/tls";
13
+ * import { TLS_RECORD_DONE, TLS_RECORD_SIGN } from "nish/net/tls/record-server";
14
+ *
15
+ * // `tlsConfig.alpn` holds `H2_ALPN`; `loop` is the program's, from `pollCreate`.
16
+ * const LISTENER: i32 = 64; // past every slot's token
17
+ * const start = (loop: i32, tlsConfig: TlsServerConfig): Http2TlsServer => {
18
+ * const listener: i32 = tcpListen("0.0.0.0", 8443, 128);
19
+ * pollAdd(loop, listener, 1, LISTENER);
20
+ * return new Http2TlsServer(tlsConfig, new Http2Config(), listener, 64);
21
+ * };
22
+ * // When the listener's token comes back:
23
+ * const admit = (loop: i32, server: Http2TlsServer, random: u8[], key: u8[]): void => {
24
+ * crypto.getRandomValues(random);
25
+ * crypto.getRandomValues(key);
26
+ * const slot: i32 = server.accept(random, key);
27
+ * if (slot >= 0) { pollAdd(loop, server.fd(slot), 1, slot); }
28
+ * };
29
+ * // When a slot's token comes back with `events`:
30
+ * const serve = (loop: i32, server: Http2TlsServer, slot: i32, events: i32, key: Secret<u8[]>): void => {
31
+ * let wants: i32 = (events & 5) !== 0 ? server.readable(slot) : server.writable(slot);
32
+ * if ((wants & TLS_RECORD_SIGN) !== 0) { wants = server.signP256(slot, key); }
33
+ * const none: u8[][] = [];
34
+ * let event: i32 = server.next(slot);
35
+ * while (event !== H2_NEED_MORE && event !== H2_ERROR) {
36
+ * const conn: Http2Connection = server.connection(slot);
37
+ * if (event === H2_REQUEST) { conn.respond(conn.stream, 200, none, none, true); }
38
+ * event = server.next(slot);
39
+ * }
40
+ * wants = server.flush(slot);
41
+ * if ((wants & TLS_RECORD_DONE) !== 0) { server.close(slot); }
42
+ * else { pollModify(loop, server.fd(slot), wants & 3, slot); }
43
+ * };
26
44
  *
27
45
  * It is `nish/net/tls-tcp`'s loop with one step added: `next` moves what TLS
28
46
  * has decrypted into the slot's connection and answers the connection's next
@@ -38,23 +56,25 @@
38
56
  * configuration offers `h2` (and may offer `http/1.1` beside it, for a
39
57
  * program that serves both and calls `alpn(slot)` itself).
40
58
  *
41
- * **Slots, a cap; buffers, borrowed.** The constructor makes the TLS pool
42
- * and slot 0's connection, but no other slot's and no frame buffer: a slot's
59
+ * **Slots, a cap; buffers, borrowed.** The constructor makes the TLS pool and
60
+ * slot 0's connection, but no other slot's and no frame buffer: a slot's
43
61
  * connection is made by the first `accept` into it and kept, so a pool sized
44
62
  * for its peak costs at start-up only what does not depend on the size, and
45
- * holds at most `size` connections once the peak has come. A connection
46
- * borrows its input, output and header-block buffers from the
47
- * server's `Http2Pools` when it first needs each, and gives each back once it
48
- * is empty and when the slot closes, so a free or idle slot holds none. A
49
- * slot whose handshake is not done holds one output buffer, its SETTINGS
50
- * written and waiting on TLS, until the handshake ends or the slot closes:
51
- * one client that stalls its handshake keeps one buffer, as it kept a whole
52
- * slot before (`docs/security/tls.md`, TLS-4). Each pool's ceiling is the
53
- * slot count, so a borrow never fails. `accept` resets
54
- * the slot's connection, and once the pools are warm nothing a connection
55
- * does allocates but a header block's HPACK decoding (`docs/security/http2.md`,
56
- * H2-1). The caps are the `Http2Config`'s, one for every slot, so a program
57
- * sets them once.
63
+ * holds at most `size` connections once the peak has come.
64
+ *
65
+ * A connection borrows its input, output and header-block buffers from the
66
+ * server's `Http2Pools` when it first needs each, and gives each back once it
67
+ * is empty and when the slot closes, so a free or idle slot holds none. A slot
68
+ * whose handshake is not done holds one output buffer, its SETTINGS written and
69
+ * waiting on TLS, until the handshake ends or the slot closes: one client that
70
+ * stalls its handshake keeps one buffer, as it kept a whole slot before
71
+ * (`docs/security/tls.md`, TLS-4). Each pool's ceiling is the slot count, so a
72
+ * borrow never fails.
73
+ *
74
+ * `accept` resets the slot's connection, and once the pools are warm nothing a
75
+ * connection does allocates but a header block's HPACK decoding
76
+ * (`docs/security/http2.md`, H2-1). The caps are the `Http2Config`'s, one for
77
+ * every slot, so a program sets them once.
58
78
  *
59
79
  * **The Date.** Every final response carries one `date` field (RFC 9110
60
80
  * §6.6.1) from the pool's `HttpDate`, which formats the IMF-fixdate at most
@@ -82,9 +102,15 @@ export const H2_ALPN: string = "h2"
82
102
  * `TlsTcpServer`'s, and `connection(slot)` is the HTTP/2 side of each.
83
103
  */
84
104
  export class Http2TlsServer {
105
+ /**
106
+ * The TLS pool under this server, slot for slot, for what this class does not wrap, such as session
107
+ * tickets (`enableTickets`, `issue`, `resume`). Accept through this class's `accept`: a slot accepted on
108
+ * `tls` itself gets no fresh HTTP/2 connection, so `next` and `flush` may treat it as free or run it on
109
+ * the state of the slot's last peer.
110
+ */
85
111
  tls: TlsTcpServer
86
112
  /** The caps every slot's connection is made under. */
87
- config: Http2Config
113
+ private config: Http2Config
88
114
  /**
89
115
  * The connections made so far, slot `k`'s at `k`: slot 0's, made by the
90
116
  * constructor, and one for each slot accepted into since.
@@ -105,6 +131,12 @@ export class Http2TlsServer {
105
131
  * here, so a config it refuses panics now, with its words; every other
106
132
  * slot's is made by the first `accept` into it and kept. Frame buffers are
107
133
  * borrowed from `pools` as a connection needs them.
134
+ *
135
+ * @param tlsConfig What TLS serves on every slot: the certificate chain, the ALPN list (which must offer
136
+ * `h2`) and the rest; every slot shares it.
137
+ * @param config The caps every slot's connection is made under; kept, and shared by every slot.
138
+ * @param listener The listening socket from `tcpListen`; the program still owns it and closes it.
139
+ * @param size How many connections may be open at once; anything below 1 is taken as 1.
108
140
  */
109
141
  constructor(tlsConfig: TlsServerConfig, config: Http2Config, listener: i32, size: i32) {
110
142
  this.tls = new TlsTcpServer(tlsConfig, listener, size)
@@ -121,7 +153,7 @@ export class Http2TlsServer {
121
153
  }
122
154
 
123
155
  /** Makes the next slot's connection, on this pool's buffers and `date`. */
124
- build(): void {
156
+ private build(): void {
125
157
  const conn: Http2Connection = new Http2Connection(this.config)
126
158
  conn.date = this.date.current()
127
159
  conn.pools = this.pools
@@ -129,26 +161,45 @@ export class Http2TlsServer {
129
161
  }
130
162
 
131
163
  /** Whether `slot` holds a connection and its HTTP/2 side has been made. */
132
- live(slot: i32): boolean {
164
+ private live(slot: i32): boolean {
133
165
  return this.tls.holds(slot) && slot < toI32(this.connections.length)
134
166
  }
135
167
 
136
- /** How many slots the pool has, made or not. */
168
+ /**
169
+ * How many slots the pool has, made or not.
170
+ *
171
+ * @returns The slot count the TLS pool settled on, at least 1.
172
+ */
137
173
  size(): i32 {
138
174
  return this.tls.size()
139
175
  }
140
176
 
141
- /** How many slots hold a connection. */
177
+ /**
178
+ * How many slots hold a connection.
179
+ *
180
+ * @returns Slots with an open descriptor, lingering ones included; 0 to `size()`.
181
+ */
142
182
  busy(): i32 {
143
183
  return this.tls.busy()
144
184
  }
145
185
 
146
- /** Whether `slot` holds a connection. */
186
+ /**
187
+ * Whether `slot` holds a connection.
188
+ *
189
+ * @param slot A slot number, as `accept` answered it; any value is safe to ask about.
190
+ * @returns True when `slot` is in range and holds a descriptor, lingering or live.
191
+ */
147
192
  holds(slot: i32): boolean {
148
193
  return this.tls.holds(slot)
149
194
  }
150
195
 
151
- /** The descriptor of `slot`, for `pollAdd`; -1 for a free one. */
196
+ /**
197
+ * The descriptor of `slot`, for `pollAdd`.
198
+ *
199
+ * @param slot A slot number, as `accept` answered it.
200
+ * @returns The socket descriptor, which the pool still owns and closes in `close`; -1 when `slot` holds
201
+ * none.
202
+ */
152
203
  fd(slot: i32): i32 {
153
204
  return this.tls.fd(slot)
154
205
  }
@@ -156,6 +207,10 @@ export class Http2TlsServer {
156
207
  /**
157
208
  * The HTTP/2 connection of `slot`, its `date` brought up to now. A slot
158
209
  * never accepted into, or out of range, names slot 0's, which may be live.
210
+ *
211
+ * @param slot A slot number, as `accept` answered it.
212
+ * @returns The slot's connection, to read events from and answer on; the server keeps it and restarts
213
+ * it for the slot's next peer.
159
214
  */
160
215
  connection(slot: i32): Http2Connection {
161
216
  this.date.current()
@@ -163,7 +218,13 @@ export class Http2TlsServer {
163
218
  return this.connections[at]
164
219
  }
165
220
 
166
- /** The ALPN protocol `slot`'s handshake chose, or empty. */
221
+ /**
222
+ * The ALPN protocol `slot`'s handshake chose.
223
+ *
224
+ * @param slot A slot number, as `accept` answered it.
225
+ * @returns The protocol chosen, empty when none was or the handshake is not that far; a free slot
226
+ * answers its last connection's, and a slot out of range slot 0's.
227
+ */
167
228
  alpn(slot: i32): string {
168
229
  return this.tls.connection(slot).tls.alpn
169
230
  }
@@ -174,6 +235,13 @@ export class Http2TlsServer {
174
235
  * SETTINGS go out once the handshake is done: the slot's own, restarted,
175
236
  * or one made now if this is the first accept into it. Answers the slot,
176
237
  * or what `TlsTcpServer.accept` answers.
238
+ *
239
+ * @param serverRandom 32 fresh random bytes for the ServerHello's random; copied, not kept.
240
+ * @param ephemeralPrivate 32 fresh random bytes for this handshake's key share; when a slot is answered it
241
+ * has been copied into the slot and this array wiped.
242
+ * @returns The slot, 0 or more, that now holds the connection; or, taking none, -11 when no connection is
243
+ * waiting, `TLS_TCP_POOL_FULL` when every slot is busy (the connection is closed), `tcpAccept`'s own
244
+ * failure, or `TLS_RECORD_INVALID` (-22) for a random or key that is not 32 bytes.
177
245
  */
178
246
  accept(serverRandom: u8[], ephemeralPrivate: u8[]): i32 {
179
247
  const slot: i32 = this.tls.accept(serverRandom, ephemeralPrivate)
@@ -189,7 +257,12 @@ export class Http2TlsServer {
189
257
  return slot
190
258
  }
191
259
 
192
- /** The socket of `slot` is readable: TLS reads it, and what HTTP/2 has to send goes after. Answers the interest. */
260
+ /**
261
+ * The socket of `slot` is readable: TLS reads it, and what HTTP/2 has to send goes after.
262
+ *
263
+ * @param slot The slot whose socket `pollWait` reported readable, or hung up.
264
+ * @returns The slot's interest, as `flush` answers it; `TLS_RECORD_DONE` for a free slot.
265
+ */
193
266
  readable(slot: i32): i32 {
194
267
  this.tls.readable(slot)
195
268
  const wants: i32 = this.flush(slot)
@@ -197,7 +270,12 @@ export class Http2TlsServer {
197
270
  return wants
198
271
  }
199
272
 
200
- /** The socket of `slot` is writable. Answers the interest. */
273
+ /**
274
+ * The socket of `slot` is writable: what TLS and HTTP/2 hold goes out.
275
+ *
276
+ * @param slot The slot whose socket `pollWait` reported writable.
277
+ * @returns The slot's interest, as `flush` answers it; `TLS_RECORD_DONE` for a free slot.
278
+ */
201
279
  writable(slot: i32): i32 {
202
280
  this.tls.writable(slot)
203
281
  const wants: i32 = this.flush(slot)
@@ -205,7 +283,13 @@ export class Http2TlsServer {
205
283
  return wants
206
284
  }
207
285
 
208
- /** Signs `slot`'s CertificateVerify with `key`, as `TlsTcpServer.signP256` does. Answers the interest. */
286
+ /**
287
+ * Signs `slot`'s CertificateVerify with `key`, as `TlsTcpServer.signP256` does.
288
+ *
289
+ * @param slot The slot whose interest says `TLS_RECORD_SIGN`.
290
+ * @param key The certificate's P-256 private key; borrowed for the call, still the caller's to wipe.
291
+ * @returns The slot's interest, as `flush` answers it; `TLS_RECORD_DONE` for a free slot.
292
+ */
209
293
  signP256(slot: i32, key: Secret<u8[]>): i32 {
210
294
  this.tls.signP256(slot, key)
211
295
  const wants: i32 = this.flush(slot)
@@ -214,7 +298,7 @@ export class Http2TlsServer {
214
298
  }
215
299
 
216
300
  /** Whether `slot`'s handshake is done and chose anything but `h2`. */
217
- refused(slot: i32): boolean {
301
+ private refused(slot: i32): boolean {
218
302
  return this.tls.connection(slot).state === TLS_RECORD_STATE_OPEN && this.alpn(slot) !== H2_ALPN
219
303
  }
220
304
 
@@ -222,6 +306,12 @@ export class Http2TlsServer {
222
306
  * Moves what TLS has decrypted for `slot` into its connection, as far as
223
307
  * the connection has room, and answers the connection's next event. A free
224
308
  * slot, or one whose ALPN was not `h2`, answers `H2_ERROR`.
309
+ *
310
+ * @param slot The slot to read, as `accept` answered it.
311
+ * @returns The connection's next event, `H2_REQUEST` to `H2_GOAWAY` of `nish/net/http2`, read from
312
+ * `connection(slot)`; `H2_NEED_MORE` once it needs more input or its output to drain, after the
313
+ * output has gone to TLS; or `H2_ERROR` for a connection that failed, a free slot, a slot
314
+ * whose HTTP/2 connection was never made, or one whose ALPN was not `h2`.
225
315
  */
226
316
  next(slot: i32): i32 {
227
317
  if (!this.live(slot) || this.refused(slot)) {
@@ -258,9 +348,16 @@ export class Http2TlsServer {
258
348
 
259
349
  /**
260
350
  * Writes what `slot`'s connection holds into TLS, as far as TLS takes it,
261
- * and sends it; shuts TLS down once the connection is over, the peer's
262
- * stream has ended, or ALPN chose another protocol. Answers the interest,
263
- * with the write bit while the connection still holds bytes.
351
+ * and sends it; shuts TLS down once the connection is over (everything is
352
+ * sent, and it failed, or no stream is left after a GOAWAY or after the
353
+ * peer's byte stream ended), or ALPN chose another protocol. Answers the
354
+ * interest, with the write bit while the connection still holds bytes.
355
+ *
356
+ * @param slot The slot whose output to send, as `accept` answered it.
357
+ * @returns The slot's `TLS_RECORD_*` interest, whose low two bits are the events for `pollModify`;
358
+ * once TLS is shut down, its interest until the `close_notify` is sent and the client has hung up,
359
+ * then `TLS_RECORD_DONE`; `TLS_RECORD_DONE` for a free slot or one whose HTTP/2 connection was never
360
+ * made.
264
361
  */
265
362
  flush(slot: i32): i32 {
266
363
  if (!this.live(slot)) {
@@ -287,6 +384,8 @@ export class Http2TlsServer {
287
384
  /**
288
385
  * Ends `slot`'s connection and frees the slot at once, as
289
386
  * `TlsTcpServer.close` does; the connection gives back every buffer it holds.
387
+ *
388
+ * @param slot The slot to free; for a free or unknown slot nothing is sent or closed.
290
389
  */
291
390
  close(slot: i32): void {
292
391
  if (slot >= 0 && slot < toI32(this.connections.length)) {
@@ -295,7 +394,11 @@ export class Http2TlsServer {
295
394
  this.tls.close(slot)
296
395
  }
297
396
 
298
- /** Gives back the buffers `slot`'s connection holds and has emptied, so an idle slot holds none. */
397
+ /**
398
+ * Gives back the buffers `slot`'s connection holds and has emptied, so an idle slot holds none.
399
+ *
400
+ * @param slot A slot number; a slot never accepted into, or out of range, is left alone.
401
+ */
299
402
  rest(slot: i32): void {
300
403
  if (slot >= 0 && slot < toI32(this.connections.length)) {
301
404
  this.connections[slot].rest()