@honeybbq/teamspeak-client 1.0.0-beta.2 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -8
- package/dist/capabilities.d.ts +13 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/client.d.ts +17 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/discovery/resolver.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/handshake/crypt-handshake.d.ts +9 -1
- package/dist/handshake/crypt-handshake.d.ts.map +1 -1
- package/dist/handshake.d.ts.map +1 -1
- package/dist/hooks.d.ts +7 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +762 -185
- package/dist/index.js.map +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.d.ts.map +1 -1
- package/dist/trace.d.ts +223 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/transfer.d.ts +80 -1
- package/dist/transfer.d.ts.map +1 -1
- package/dist/transport/handler.d.ts +2 -0
- package/dist/transport/handler.d.ts.map +1 -1
- package/dist/types.d.ts +17 -110
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -5
- package/src/capabilities.ts +23 -2
- package/src/client.ts +392 -54
- package/src/crypto/crypt.ts +5 -5
- package/src/discovery/resolver.ts +56 -3
- package/src/errors.ts +92 -11
- package/src/handshake/crypt-handshake.ts +26 -5
- package/src/handshake/crypt-init2.ts +5 -5
- package/src/handshake.ts +3 -1
- package/src/hooks.ts +30 -0
- package/src/index.ts +30 -10
- package/src/notifications.ts +1 -1
- package/src/throttle.ts +2 -2
- package/src/trace.ts +238 -0
- package/src/transfer.ts +334 -25
- package/src/transport/handler.ts +13 -9
- package/src/transport/packet.ts +1 -1
- package/src/types.ts +21 -123
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ Works with TeamSpeak 3 and TeamSpeak 6 servers. No proprietary SDK, no copied co
|
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
+
**[API reference](https://honeybbq.github.io/teamspeak-js/)**
|
|
19
|
+
|
|
18
20
|
Upgrading from 0.x? See the [migration guide](https://github.com/HoneyBBQ/teamspeak-js/blob/main/docs/migrating-to-1.0.md).
|
|
19
21
|
|
|
20
22
|
## Features
|
|
@@ -46,7 +48,7 @@ npm install @honeybbq/teamspeak-client@beta
|
|
|
46
48
|
pnpm add @honeybbq/teamspeak-client@beta
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
Everything in this README is the 1.0 API. You need Node.js
|
|
51
|
+
Everything in this README is the 1.0 API. You need Node.js 22.12 or newer.
|
|
50
52
|
|
|
51
53
|
## Quick Start
|
|
52
54
|
|
|
@@ -148,7 +150,11 @@ deliveries are waiting, voice frames are dropped (and counted in a warning at
|
|
|
148
150
|
most every ten seconds) rather than queued without bound.
|
|
149
151
|
|
|
150
152
|
`events(name, { signal })` is the same as an async iterator, buffering events
|
|
151
|
-
that arrive while the loop body runs
|
|
153
|
+
that arrive while the loop body runs. The buffer is unbounded (voice excepted,
|
|
154
|
+
as above), so stop iterating when you stop reading. Aborting `signal` stops
|
|
155
|
+
listening and makes the pending and later `next()` calls reject with the
|
|
156
|
+
signal's reason, as Node's `events.on` does; `break`ing out of the loop, or a
|
|
157
|
+
disconnect, ends it normally:
|
|
152
158
|
|
|
153
159
|
```typescript
|
|
154
160
|
for await (const msg of client.events("textMessage", { signal })) {
|
|
@@ -277,12 +283,26 @@ await client.uploadFileData(host, info, Readable.from([data]));
|
|
|
277
283
|
An upload does not replace a file already at the path unless passed
|
|
278
284
|
`{ overwrite: true }`.
|
|
279
285
|
|
|
280
|
-
| Function
|
|
281
|
-
|
|
|
282
|
-
| `initFileUpload(client, ...)`
|
|
283
|
-
| `initFileDownload(client, ...)`
|
|
284
|
-
| `client.uploadFileData(host, info, data,
|
|
285
|
-
| `client.downloadFileData(host, info, out,
|
|
286
|
+
| Function | Description |
|
|
287
|
+
| ---------------------------------------------------- | --------------------------------- |
|
|
288
|
+
| `initFileUpload(client, ...)` | Negotiate an upload |
|
|
289
|
+
| `initFileDownload(client, ...)` | Negotiate a download |
|
|
290
|
+
| `client.uploadFileData(host, info, data, options?)` | Transfer file data to the server |
|
|
291
|
+
| `client.downloadFileData(host, info, out, options?)` | Receive file data from the server |
|
|
292
|
+
|
|
293
|
+
The transfer functions take `FileTransferOptions`:
|
|
294
|
+
|
|
295
|
+
| Option | Description |
|
|
296
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
297
|
+
| `signal` | An `AbortSignal` that abandons the transfer; it rejects with the signal's reason |
|
|
298
|
+
| `socketFactory` | Opens the connection instead of a direct TCP dial, to route it through a proxy or tunnel |
|
|
299
|
+
| `trace` | Hooks called at each milestone of the transfer (`dialStart`, `dialDone`, `progress`, `done`, `failed`); none sees the transfer key |
|
|
300
|
+
| `idleTimeoutMs` | The longest, in milliseconds, a transfer may go without moving a byte, the key write included. Default 30 000; `0` disables it |
|
|
301
|
+
|
|
302
|
+
A transfer that goes idle for `idleTimeoutMs` fails with a `FileTransferError`
|
|
303
|
+
whose `cause` is a `TimeoutError`, and its connection is destroyed. A download
|
|
304
|
+
that sends more bytes than the negotiated size, or ends short of it, fails with
|
|
305
|
+
a `FileTransferError` too; bytes past the announced size are never written.
|
|
286
306
|
|
|
287
307
|
### Identity
|
|
288
308
|
|
|
@@ -352,6 +372,39 @@ Connection auth options:
|
|
|
352
372
|
- `defaultChannel`: default channel name requested during `clientinit`
|
|
353
373
|
- `defaultChannelPassword`: plain-text password for `defaultChannel`; sent as the TeamSpeak protocol hash
|
|
354
374
|
|
|
375
|
+
### Tracing
|
|
376
|
+
|
|
377
|
+
`trace` takes hooks that are called at each milestone of the client's life, for timing, metrics, logs or a progress display. For each connection attempt, the one `connect()` starts and each one the reconnect loop makes, the milestones come in this order: `resolveStart`, `resolveDone`, `connectStart`, `connectDone`, `handshakeDone`, `sessionStart`, `welcomeDone`. An attempt that never gets a session ends with `attemptFailed` instead, which says in which phase (`"open"`, `"handshake"` or `"join"`) and why. When a session ends, `sessionEnd` is called with the cause (`undefined` after `disconnect()`), preceded on a `disconnect()` by `disconnectStart` and `disconnectDone`, which says whether the server acknowledged the goodbye. `reconnectScheduled` fires when the reconnect loop is about to wait for its next attempt, and `reconnectStopped` when it ends without a session. Every attempt ends with exactly one of `sessionStart` and `attemptFailed`, and every session with exactly one `sessionEnd`.
|
|
378
|
+
|
|
379
|
+
The infos carry what each milestone knows: the resolver's candidates, the local address, the RSA puzzle's level and how long it took, how many packets were sent again, the server's public key (to pin a server's identity), the nickname the server accepted, the server's `initserver` parameters without any secret, and where the client landed with how many channels and clients the welcome delivered. Durations are in milliseconds.
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
const client = new Client(identity, "ts.example.com", "Bot", {
|
|
383
|
+
trace: {
|
|
384
|
+
resolveDone: (i) => console.log(`resolved to ${i.target} in ${i.durationMs.toFixed(0)} ms`),
|
|
385
|
+
handshakeDone: (i) =>
|
|
386
|
+
console.log(`encrypted after ${i.durationMs.toFixed(0)} ms, ${i.resends} resends`),
|
|
387
|
+
sessionStart: (i) => console.log(`joined as ${i.nickname} after ${i.durationMs.toFixed(0)} ms`),
|
|
388
|
+
welcomeDone: (i) => console.log(`${i.channels} channels, ${i.clients} clients in view`),
|
|
389
|
+
attemptFailed: (i) => console.log(`attempt ${i.attempt} failed while ${i.phase}:`, i.error),
|
|
390
|
+
sessionEnd: (i) => console.log(`session over after ${(i.durationMs / 1000).toFixed(0)} s`),
|
|
391
|
+
reconnectScheduled: (i) => console.log(`retry ${i.attempt} in ${i.delayMs} ms`),
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
A file transfer has a trace of its own, given in the options of `uploadFileData`, `downloadFileData` and `dialFileTransfer` (and of the client's methods that forward to them): `dialStart`, `dialDone`, `progress` (at most once per 64 KiB, and once more at the end with the final count), then exactly one of `done` and `failed`, which names the stage (`"dial"` or `"transfer"`). The transfer key never appears in any of it.
|
|
397
|
+
|
|
398
|
+
The rules for a hook, in both traces:
|
|
399
|
+
|
|
400
|
+
- It runs synchronously, at the moment of the milestone, and the client waits for it. Keep it quick and hand slow work to your own task.
|
|
401
|
+
- What it returns is ignored. A promise it returns is not awaited.
|
|
402
|
+
- It must not call `connect()` or `disconnect()`. To give up on an attempt, abort the signal you passed to `connect()`; to leave once connected, call `disconnect()` from a `connected` listener.
|
|
403
|
+
- It may read `client.status`, `client.clientID` and the like. `sessionStart` runs before `connect()` resolves and before `connected` is delivered, and `sessionEnd` before `disconnected`.
|
|
404
|
+
- If it throws, or the promise it returns rejects, the error is reported the way a throwing event listener's is, as an uncaught exception, and the client carries on as if nothing happened.
|
|
405
|
+
|
|
406
|
+
The object is copied when the client is made (or the transfer call starts), so changing it afterwards has no effect.
|
|
407
|
+
|
|
355
408
|
### Diagnostics
|
|
356
409
|
|
|
357
410
|
The client logs nothing unless given a `logger`. For tracing, it publishes on
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* its name, icon, banner and welcome message — so reading it costs no extra
|
|
12
12
|
* round trip.
|
|
13
13
|
*/
|
|
14
|
-
import type
|
|
14
|
+
import { type IconID, type ServerID } from "@honeybbq/teamspeak-core";
|
|
15
15
|
import { type UIDAlgorithm } from "./crypto/identity.js";
|
|
16
16
|
/**
|
|
17
17
|
* The server generation a version string belongs to. May gain members in a
|
|
@@ -46,6 +46,18 @@ export interface ServerCapabilities {
|
|
|
46
46
|
readonly hostBannerImageURL: string | undefined;
|
|
47
47
|
/** The welcome message shown on connecting (`virtualserver_welcomemessage`). */
|
|
48
48
|
readonly welcomeMessage: string;
|
|
49
|
+
/** The virtual server's ID (`virtualserver_id`); 0 when the server did not send it. */
|
|
50
|
+
readonly serverID: ServerID;
|
|
51
|
+
/** The virtual server's unique identifier (`virtualserver_unique_identifier`); empty when not sent. */
|
|
52
|
+
readonly serverUID: string;
|
|
53
|
+
/** The host message (`virtualserver_hostmessage`) the server wants shown on connecting. */
|
|
54
|
+
readonly hostMessage: string;
|
|
55
|
+
/**
|
|
56
|
+
* How the host message is to be shown (`virtualserver_hostmessage_mode`):
|
|
57
|
+
* 0 not at all, 1 in the chat log, 2 as a modal dialog, 3 as a modal dialog
|
|
58
|
+
* after which the client is disconnected.
|
|
59
|
+
*/
|
|
60
|
+
readonly hostMessageMode: number;
|
|
49
61
|
}
|
|
50
62
|
/**
|
|
51
63
|
* Read what a server says about itself in `initserver`, or a version string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAc,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;AAErD,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,uFAAuF;IACvF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,uGAAuG;IACvG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACpD,kBAAkB,CAyBpB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type EventMap, type ClientOptions, type Listener, type Unsubscribe, ClientStatus } from "./types.js";
|
|
2
2
|
import { type ChannelID, type ClientID, type Codec, type CommandOptions, type UID } from "@honeybbq/teamspeak-core";
|
|
3
3
|
import { Identity } from "./crypto/index.js";
|
|
4
|
+
import { type FileTransferOptions } from "./transfer.js";
|
|
4
5
|
import type { CommandExecutor, CommandRequest } from "@honeybbq/teamspeak-core";
|
|
5
6
|
import type { FileUploadInfo, FileDownloadInfo } from "@honeybbq/teamspeak-core";
|
|
6
7
|
import type { Readable, Writable } from "node:stream";
|
|
@@ -125,11 +126,20 @@ export declare class Client implements CommandExecutor, AsyncDisposable {
|
|
|
125
126
|
* ```
|
|
126
127
|
*
|
|
127
128
|
* Events that arrive while the loop body runs are buffered, so none is
|
|
128
|
-
* missed
|
|
129
|
-
*
|
|
130
|
-
* `signal`
|
|
131
|
-
*
|
|
132
|
-
*
|
|
129
|
+
* missed. The buffer is unbounded: an iterator that is not consumed as fast
|
|
130
|
+
* as events arrive holds every one of them in memory until it is read, so
|
|
131
|
+
* stop iterating (or abort `signal`) when you stop reading. Voice is the
|
|
132
|
+
* exception: at most 256 `voiceData` frames are buffered, and the rest are
|
|
133
|
+
* dropped, as for a listener that falls behind.
|
|
134
|
+
*
|
|
135
|
+
* Iteration ends when the loop exits early (`break`, `return`, a throw), and
|
|
136
|
+
* — for every event but `disconnected` — when the client disconnects. When
|
|
137
|
+
* `signal` aborts, listening stops at once, whatever is buffered is
|
|
138
|
+
* discarded, and the pending and every later `next()` reject with the
|
|
139
|
+
* signal's reason, as `events.on` in Node does.
|
|
140
|
+
*
|
|
141
|
+
* `next()` may be called again before an earlier call has settled; the calls
|
|
142
|
+
* are answered in order.
|
|
133
143
|
*/
|
|
134
144
|
events<K extends keyof EventMap>(event: K, options?: {
|
|
135
145
|
readonly signal?: AbortSignal | undefined;
|
|
@@ -167,15 +177,11 @@ export declare class Client implements CommandExecutor, AsyncDisposable {
|
|
|
167
177
|
* Upload `data` over a negotiated transfer, through the client's
|
|
168
178
|
* `fileTransferSocketFactory` if it has one.
|
|
169
179
|
*/
|
|
170
|
-
uploadFileData(host: string, info: FileUploadInfo, data: Readable, options?:
|
|
171
|
-
readonly signal?: AbortSignal | undefined;
|
|
172
|
-
}): Promise<void>;
|
|
180
|
+
uploadFileData(host: string, info: FileUploadInfo, data: Readable, options?: Pick<FileTransferOptions, "signal" | "trace">): Promise<void>;
|
|
173
181
|
/**
|
|
174
182
|
* Download a negotiated transfer into `dest`, through the client's
|
|
175
183
|
* `fileTransferSocketFactory` if it has one.
|
|
176
184
|
*/
|
|
177
|
-
downloadFileData(host: string, info: FileDownloadInfo, dest: Writable, options?:
|
|
178
|
-
readonly signal?: AbortSignal | undefined;
|
|
179
|
-
}): Promise<void>;
|
|
185
|
+
downloadFileData(host: string, info: FileDownloadInfo, dest: Writable, options?: Pick<FileTransferOptions, "signal" | "trace">): Promise<void>;
|
|
180
186
|
}
|
|
181
187
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAKlB,KAAK,QAAQ,EAGb,KAAK,WAAW,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAKlB,KAAK,QAAQ,EAGb,KAAK,WAAW,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,QAAQ,EACb,KAAK,KAAK,EAGV,KAAK,cAAc,EACnB,KAAK,GAAG,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAC;AAOpD,OAAO,EAAoC,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAS3F,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAMhF,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjF,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAA6B,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAUvF,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;CAC7C;AA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GAAG,OAAO,CAAM,GAC1D,OAAO,CAAC,IAAI,CAAC,CAKf;CAqsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/discovery/resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/discovery/resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkBhD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAiB,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjD;AAED,qBAAa,QAAQ;;IAInB,YAAY,OAAO,GAAE,eAAoB,EAExC;IAED;;;;;OAKG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAO,GAC1D,OAAO,CAAC,YAAY,EAAE,CAAC,CAYzB;CAgHF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare class FileTransferError extends TeamspeakError {
|
|
|
49
49
|
* Init1 step, public key, license or proof. `connect()` rejects with it, the
|
|
50
50
|
* underlying failure as its `cause`.
|
|
51
51
|
*/
|
|
52
|
-
export declare class
|
|
52
|
+
export declare class HandshakeError extends TeamspeakError {
|
|
53
53
|
/** {@inheritDoc TeamspeakError.kind} */
|
|
54
54
|
static readonly kind: string;
|
|
55
55
|
constructor(message: string, options?: ErrorOptions);
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],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AAED,wDAAwD;AACxD,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAA0B;IAY/D,YAAY,OAAO,SAA4B,EAAE,OAAO,CAAC,EAAE,YAAY,EAEtE;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAA4B;IAYjE,cAEC;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAAkB;IAYvD,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,YAAY,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAQrE;CACF"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { Crypt } from "../crypto/crypt.js";
|
|
2
2
|
export declare const INIT_VERSION = 1566914096;
|
|
3
|
+
/**
|
|
4
|
+
* The RSA puzzle `crypt`'s attempt solved: the level the server demanded and
|
|
5
|
+
* the milliseconds spent on it. Level 0 and no time when the server sent none.
|
|
6
|
+
*/
|
|
7
|
+
export declare function puzzleOf(crypt: Crypt): {
|
|
8
|
+
readonly level: number;
|
|
9
|
+
readonly durationMs: number;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Handle the TS3INIT1 handshake steps.
|
|
5
13
|
* Returns the response bytes to send, or null if nothing should be sent.
|
|
6
|
-
* Throws a
|
|
14
|
+
* Throws a HandshakeError for a step that cannot be answered.
|
|
7
15
|
*/
|
|
8
16
|
export declare function processInit1(crypt: Crypt, data: Uint8Array | null): Uint8Array | null;
|
|
9
17
|
//# sourceMappingURL=crypt-handshake.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypt-handshake.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-handshake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,eAAO,MAAM,YAAY,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"crypt-handshake.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-handshake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,eAAO,MAAM,YAAY,aAAa,CAAC;AAiBvC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAG9F;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAkBrF"}
|
package/dist/handshake.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../src/handshake.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mEAAmE;AACnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI,
|
|
1
|
+
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../src/handshake.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mEAAmE;AACnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI,CAUN;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI,CAaN;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA0B9F;AAwBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAG5D"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call a trace hook, if there is one, and never let it touch what called it:
|
|
3
|
+
* a throw, or the rejection of a promise it returns, is reported as a
|
|
4
|
+
* throwing listener's is. The info is built only when there is a hook.
|
|
5
|
+
*/
|
|
6
|
+
export declare function callHook<I>(hook: ((info: I) => unknown) | undefined, owner: object | undefined, info: () => I): void;
|
|
7
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,SAAS,EACxC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,CAAC,GACZ,IAAI,CAUN"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export * from "@honeybbq/teamspeak-core";
|
|
9
9
|
export { Client, ClientStatus } from "./client.js";
|
|
10
|
-
export type {
|
|
11
|
-
export { AlreadyConnectedError, FileTransferError,
|
|
10
|
+
export type { EventMap, EventMiddleware, Listener, ServerEvent, ServerEventName, Unsubscribe, AddrResolver, ClientOptions, ResolvedAddr, DatagramSocket, SocketFactory, FileTransferSocketFactory, } from "./types.js";
|
|
11
|
+
export { AlreadyConnectedError, FileTransferError, HandshakeError, InvalidAddressError, InvalidIdentityError, RemovedError, ConnectionTimeoutError, } from "./errors.js";
|
|
12
12
|
export * from "./api/voice.js";
|
|
13
13
|
export { dialFileTransfer, uploadFileData, downloadFileData } from "./transfer.js";
|
|
14
|
-
export type { FileTransferOptions } from "./transfer.js";
|
|
14
|
+
export type { FileTransferOptions, FileTransferTrace, FileTransferStage, FileTransferDialStartInfo, FileTransferDialDoneInfo, FileTransferProgressInfo, FileTransferDoneInfo, FileTransferFailedInfo, } from "./transfer.js";
|
|
15
|
+
export { ConnectPhase } from "./trace.js";
|
|
16
|
+
export type { ClientTrace, ResolveStartInfo, ResolveDoneInfo, ConnectStartInfo, ConnectDoneInfo, HandshakeDoneInfo, SessionStartInfo, WelcomeDoneInfo, AttemptFailedInfo, ReconnectScheduledInfo, DisconnectStartInfo, DisconnectDoneInfo, SessionEndInfo, ReconnectStoppedInfo, } from "./trace.js";
|
|
15
17
|
export { unknownServerCapabilities } from "./capabilities.js";
|
|
16
18
|
export type { ServerCapabilities, ServerFamily } from "./capabilities.js";
|
|
17
19
|
export { commandChannel, packetChannel } from "./diagnostics.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,0BAA0B,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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