@honeybbq/teamspeak 0.0.1 → 1.0.0-beta.7
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/LICENSE +21 -0
- package/README.md +726 -2
- package/dist/client/abort.d.ts +5 -0
- package/dist/client/abort.d.ts.map +1 -0
- package/dist/client/abort.js +23 -0
- package/dist/client/abort.js.map +1 -0
- package/dist/client/address.d.ts +17 -0
- package/dist/client/address.d.ts.map +1 -0
- package/dist/client/address.js +66 -0
- package/dist/client/address.js.map +1 -0
- package/dist/client/api/voice.d.ts +24 -0
- package/dist/client/api/voice.d.ts.map +1 -0
- package/dist/client/api/voice.js +33 -0
- package/dist/client/api/voice.js.map +1 -0
- package/dist/client/capabilities.d.ts +68 -0
- package/dist/client/capabilities.d.ts.map +1 -0
- package/dist/client/capabilities.js +59 -0
- package/dist/client/capabilities.js.map +1 -0
- package/dist/client/client.d.ts +196 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +1523 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/commands.d.ts +66 -0
- package/dist/client/commands.d.ts.map +1 -0
- package/dist/client/commands.js +162 -0
- package/dist/client/commands.js.map +1 -0
- package/dist/client/crypto/crypt-ops.d.ts +7 -0
- package/dist/client/crypto/crypt-ops.d.ts.map +1 -0
- package/dist/client/crypto/crypt-ops.js +2 -0
- package/dist/client/crypto/crypt-ops.js.map +1 -0
- package/dist/client/crypto/crypt.d.ts +37 -0
- package/dist/client/crypto/crypt.d.ts.map +1 -0
- package/dist/client/crypto/crypt.js +203 -0
- package/dist/client/crypto/crypt.js.map +1 -0
- package/dist/client/crypto/eax.d.ts +12 -0
- package/dist/client/crypto/eax.d.ts.map +1 -0
- package/dist/client/crypto/eax.js +118 -0
- package/dist/client/crypto/eax.js.map +1 -0
- package/dist/client/crypto/identity.d.ts +97 -0
- package/dist/client/crypto/identity.d.ts.map +1 -0
- package/dist/client/crypto/identity.js +412 -0
- package/dist/client/crypto/identity.js.map +1 -0
- package/dist/client/crypto/index.d.ts +7 -0
- package/dist/client/crypto/index.d.ts.map +1 -0
- package/dist/client/crypto/index.js +5 -0
- package/dist/client/crypto/index.js.map +1 -0
- package/dist/client/crypto/primitives.d.ts +43 -0
- package/dist/client/crypto/primitives.d.ts.map +1 -0
- package/dist/client/crypto/primitives.js +116 -0
- package/dist/client/crypto/primitives.js.map +1 -0
- package/dist/client/diagnostics.d.ts +45 -0
- package/dist/client/diagnostics.d.ts.map +1 -0
- package/dist/client/diagnostics.js +30 -0
- package/dist/client/diagnostics.js.map +1 -0
- package/dist/client/discovery/index.d.ts +2 -0
- package/dist/client/discovery/index.d.ts.map +1 -0
- package/dist/client/discovery/index.js +2 -0
- package/dist/client/discovery/index.js.map +1 -0
- package/dist/client/discovery/resolver.d.ts +26 -0
- package/dist/client/discovery/resolver.d.ts.map +1 -0
- package/dist/client/discovery/resolver.js +275 -0
- package/dist/client/discovery/resolver.js.map +1 -0
- package/dist/client/errors.d.ts +82 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +201 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/events.d.ts +3 -0
- package/dist/client/events.d.ts.map +1 -0
- package/dist/client/events.js +8 -0
- package/dist/client/events.js.map +1 -0
- package/dist/client/handshake/crypt-handshake.d.ts +17 -0
- package/dist/client/handshake/crypt-handshake.d.ts.map +1 -0
- package/dist/client/handshake/crypt-handshake.js +128 -0
- package/dist/client/handshake/crypt-handshake.js.map +1 -0
- package/dist/client/handshake/crypt-init2.d.ts +7 -0
- package/dist/client/handshake/crypt-init2.d.ts.map +1 -0
- package/dist/client/handshake/crypt-init2.js +37 -0
- package/dist/client/handshake/crypt-init2.js.map +1 -0
- package/dist/client/handshake/index.d.ts +4 -0
- package/dist/client/handshake/index.d.ts.map +1 -0
- package/dist/client/handshake/index.js +4 -0
- package/dist/client/handshake/index.js.map +1 -0
- package/dist/client/handshake/license.d.ts +35 -0
- package/dist/client/handshake/license.d.ts.map +1 -0
- package/dist/client/handshake/license.js +169 -0
- package/dist/client/handshake/license.js.map +1 -0
- package/dist/client/handshake.d.ts +27 -0
- package/dist/client/handshake.d.ts.map +1 -0
- package/dist/client/handshake.js +126 -0
- package/dist/client/handshake.js.map +1 -0
- package/dist/client/helpers.d.ts +6 -0
- package/dist/client/helpers.d.ts.map +1 -0
- package/dist/client/helpers.js +13 -0
- package/dist/client/helpers.js.map +1 -0
- package/dist/client/hooks.d.ts +7 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +28 -0
- package/dist/client/hooks.js.map +1 -0
- package/dist/client/index.d.ts +26 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +28 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/reconnect.d.ts +12 -0
- package/dist/client/reconnect.d.ts.map +1 -0
- package/dist/client/reconnect.js +44 -0
- package/dist/client/reconnect.js.map +1 -0
- package/dist/client/throttle.d.ts +20 -0
- package/dist/client/throttle.d.ts.map +1 -0
- package/dist/client/throttle.js +83 -0
- package/dist/client/throttle.js.map +1 -0
- package/dist/client/trace.d.ts +223 -0
- package/dist/client/trace.d.ts.map +1 -0
- package/dist/client/trace.js +13 -0
- package/dist/client/trace.js.map +1 -0
- package/dist/client/transfer.d.ts +111 -0
- package/dist/client/transfer.d.ts.map +1 -0
- package/dist/client/transfer.js +243 -0
- package/dist/client/transfer.js.map +1 -0
- package/dist/client/transport/generation-window.d.ts +30 -0
- package/dist/client/transport/generation-window.d.ts.map +1 -0
- package/dist/client/transport/generation-window.js +97 -0
- package/dist/client/transport/generation-window.js.map +1 -0
- package/dist/client/transport/handler.d.ts +61 -0
- package/dist/client/transport/handler.d.ts.map +1 -0
- package/dist/client/transport/handler.js +793 -0
- package/dist/client/transport/handler.js.map +1 -0
- package/dist/client/transport/index.d.ts +6 -0
- package/dist/client/transport/index.d.ts.map +1 -0
- package/dist/client/transport/index.js +5 -0
- package/dist/client/transport/index.js.map +1 -0
- package/dist/client/transport/packet.d.ts +36 -0
- package/dist/client/transport/packet.d.ts.map +1 -0
- package/dist/client/transport/packet.js +55 -0
- package/dist/client/transport/packet.js.map +1 -0
- package/dist/client/transport/quicklz.d.ts +24 -0
- package/dist/client/transport/quicklz.d.ts.map +1 -0
- package/dist/client/transport/quicklz.js +179 -0
- package/dist/client/transport/quicklz.js.map +1 -0
- package/dist/client/types.d.ts +226 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +39 -0
- package/dist/client/types.js.map +1 -0
- package/dist/core/api/channels.d.ts +182 -0
- package/dist/core/api/channels.d.ts.map +1 -0
- package/dist/core/api/channels.js +155 -0
- package/dist/core/api/channels.js.map +1 -0
- package/dist/core/api/clients.d.ts +304 -0
- package/dist/core/api/clients.d.ts.map +1 -0
- package/dist/core/api/clients.js +260 -0
- package/dist/core/api/clients.js.map +1 -0
- package/dist/core/api/command.d.ts +305 -0
- package/dist/core/api/command.d.ts.map +1 -0
- package/dist/core/api/command.js +363 -0
- package/dist/core/api/command.js.map +1 -0
- package/dist/core/api/files.d.ts +153 -0
- package/dist/core/api/files.d.ts.map +1 -0
- package/dist/core/api/files.js +181 -0
- package/dist/core/api/files.js.map +1 -0
- package/dist/core/api/groups.d.ts +248 -0
- package/dist/core/api/groups.d.ts.map +1 -0
- package/dist/core/api/groups.js +271 -0
- package/dist/core/api/groups.js.map +1 -0
- package/dist/core/api/moderation.d.ts +205 -0
- package/dist/core/api/moderation.d.ts.map +1 -0
- package/dist/core/api/moderation.js +209 -0
- package/dist/core/api/moderation.js.map +1 -0
- package/dist/core/api/parse.d.ts +16 -0
- package/dist/core/api/parse.d.ts.map +1 -0
- package/dist/core/api/parse.js +40 -0
- package/dist/core/api/parse.js.map +1 -0
- package/dist/core/api/server.d.ts +310 -0
- package/dist/core/api/server.d.ts.map +1 -0
- package/dist/core/api/server.js +290 -0
- package/dist/core/api/server.js.map +1 -0
- package/dist/core/command/command.d.ts +20 -0
- package/dist/core/command/command.d.ts.map +1 -0
- package/dist/core/command/command.js +112 -0
- package/dist/core/command/command.js.map +1 -0
- package/dist/core/command/ids.d.ts +125 -0
- package/dist/core/command/ids.d.ts.map +1 -0
- package/dist/core/command/ids.js +85 -0
- package/dist/core/command/ids.js.map +1 -0
- package/dist/core/command/parser.d.ts +17 -0
- package/dist/core/command/parser.d.ts.map +1 -0
- package/dist/core/command/parser.js +65 -0
- package/dist/core/command/parser.js.map +1 -0
- package/dist/core/command/request.d.ts +61 -0
- package/dist/core/command/request.d.ts.map +1 -0
- package/dist/core/command/request.js +64 -0
- package/dist/core/command/request.js.map +1 -0
- package/dist/core/command/responses.d.ts +59 -0
- package/dist/core/command/responses.d.ts.map +1 -0
- package/dist/core/command/responses.js +74 -0
- package/dist/core/command/responses.js.map +1 -0
- package/dist/core/command-name.d.ts +333 -0
- package/dist/core/command-name.d.ts.map +1 -0
- package/dist/core/command-name.js +331 -0
- package/dist/core/command-name.js.map +1 -0
- package/dist/core/enums.d.ts +146 -0
- package/dist/core/enums.d.ts.map +1 -0
- package/dist/core/enums.js +132 -0
- package/dist/core/enums.js.map +1 -0
- package/dist/core/errorcode.d.ts +413 -0
- package/dist/core/errorcode.d.ts.map +1 -0
- package/dist/core/errorcode.js +410 -0
- package/dist/core/errorcode.js.map +1 -0
- package/dist/core/errors.d.ts +111 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +233 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events.d.ts +207 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +6 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/helpers.d.ts +42 -0
- package/dist/core/helpers.d.ts.map +1 -0
- package/dist/core/helpers.js +156 -0
- package/dist/core/helpers.js.map +1 -0
- package/dist/core/index.d.ts +35 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +34 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +23 -0
- package/dist/core/internal.d.ts.map +1 -0
- package/dist/core/internal.js +20 -0
- package/dist/core/internal.js.map +1 -0
- package/dist/core/middleware.d.ts +14 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/middleware.js +18 -0
- package/dist/core/middleware.js.map +1 -0
- package/dist/core/notification-name.d.ts +154 -0
- package/dist/core/notification-name.d.ts.map +1 -0
- package/dist/core/notification-name.js +152 -0
- package/dist/core/notification-name.js.map +1 -0
- package/dist/core/notifications.d.ts +43 -0
- package/dist/core/notifications.d.ts.map +1 -0
- package/dist/core/notifications.js +116 -0
- package/dist/core/notifications.js.map +1 -0
- package/dist/core/permission-name.d.ts +533 -0
- package/dist/core/permission-name.d.ts.map +1 -0
- package/dist/core/permission-name.js +531 -0
- package/dist/core/permission-name.js.map +1 -0
- package/dist/core/permission.d.ts +31 -0
- package/dist/core/permission.d.ts.map +1 -0
- package/dist/core/permission.js +20 -0
- package/dist/core/permission.js.map +1 -0
- package/dist/core/property-name.d.ts +403 -0
- package/dist/core/property-name.d.ts.map +1 -0
- package/dist/core/property-name.js +405 -0
- package/dist/core/property-name.js.map +1 -0
- package/dist/core/reason.d.ts +39 -0
- package/dist/core/reason.d.ts.map +1 -0
- package/dist/core/reason.js +36 -0
- package/dist/core/reason.js.map +1 -0
- package/dist/core/reconnect.d.ts +59 -0
- package/dist/core/reconnect.d.ts.map +1 -0
- package/dist/core/reconnect.js +55 -0
- package/dist/core/reconnect.js.map +1 -0
- package/dist/core/types.d.ts +110 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +27 -0
- package/dist/core/types.js.map +1 -0
- package/dist/query/client.d.ts +194 -0
- package/dist/query/client.d.ts.map +1 -0
- package/dist/query/client.js +967 -0
- package/dist/query/client.js.map +1 -0
- package/dist/query/errors.d.ts +61 -0
- package/dist/query/errors.d.ts.map +1 -0
- package/dist/query/errors.js +100 -0
- package/dist/query/errors.js.map +1 -0
- package/dist/query/index.d.ts +36 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +34 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/knownhosts.d.ts +61 -0
- package/dist/query/knownhosts.d.ts.map +1 -0
- package/dist/query/knownhosts.js +223 -0
- package/dist/query/knownhosts.js.map +1 -0
- package/dist/query/lines.d.ts +14 -0
- package/dist/query/lines.d.ts.map +1 -0
- package/dist/query/lines.js +29 -0
- package/dist/query/lines.js.map +1 -0
- package/dist/query/options.d.ts +187 -0
- package/dist/query/options.d.ts.map +1 -0
- package/dist/query/options.js +213 -0
- package/dist/query/options.js.map +1 -0
- package/dist/query/reconnect.d.ts +29 -0
- package/dist/query/reconnect.d.ts.map +1 -0
- package/dist/query/reconnect.js +87 -0
- package/dist/query/reconnect.js.map +1 -0
- package/dist/query/ssh.d.ts +345 -0
- package/dist/query/ssh.d.ts.map +1 -0
- package/dist/query/ssh.js +241 -0
- package/dist/query/ssh.js.map +1 -0
- package/dist/query/stream.d.ts +38 -0
- package/dist/query/stream.d.ts.map +1 -0
- package/dist/query/stream.js +70 -0
- package/dist/query/stream.js.map +1 -0
- package/dist/query/tcp.d.ts +38 -0
- package/dist/query/tcp.d.ts.map +1 -0
- package/dist/query/tcp.js +53 -0
- package/dist/query/tcp.js.map +1 -0
- package/dist/query/transport.d.ts +36 -0
- package/dist/query/transport.d.ts.map +1 -0
- package/dist/query/transport.js +2 -0
- package/dist/query/transport.js.map +1 -0
- package/dist/query/web.d.ts +54 -0
- package/dist/query/web.d.ts.map +1 -0
- package/dist/query/web.js +146 -0
- package/dist/query/web.js.map +1 -0
- package/dist/versions/index.d.ts +3094 -0
- package/dist/versions/index.d.ts.map +1 -0
- package/dist/versions/index.js +9237 -0
- package/dist/versions/index.js.map +1 -0
- package/package.json +118 -4
- package/src/client/abort.ts +24 -0
- package/src/client/address.ts +74 -0
- package/src/client/api/voice.ts +61 -0
- package/src/client/capabilities.ts +106 -0
- package/src/client/client.ts +1809 -0
- package/src/client/commands.ts +193 -0
- package/src/client/crypto/crypt-ops.ts +6 -0
- package/src/client/crypto/crypt.ts +275 -0
- package/src/client/crypto/eax.ts +152 -0
- package/src/client/crypto/identity.ts +484 -0
- package/src/client/crypto/index.ts +21 -0
- package/src/client/crypto/primitives.ts +141 -0
- package/src/client/diagnostics.ts +58 -0
- package/src/client/discovery/index.ts +1 -0
- package/src/client/discovery/resolver.ts +325 -0
- package/src/client/errors.ts +217 -0
- package/src/client/events.ts +12 -0
- package/src/client/handshake/crypt-handshake.ts +157 -0
- package/src/client/handshake/crypt-init2.ts +48 -0
- package/src/client/handshake/index.ts +3 -0
- package/src/client/handshake/license.ts +208 -0
- package/src/client/handshake.ts +150 -0
- package/src/client/helpers.ts +10 -0
- package/src/client/hooks.ts +30 -0
- package/src/client/index.ts +93 -0
- package/src/client/reconnect.ts +43 -0
- package/src/client/throttle.ts +92 -0
- package/src/client/trace.ts +237 -0
- package/src/client/transfer.ts +436 -0
- package/src/client/transport/generation-window.ts +108 -0
- package/src/client/transport/handler.ts +926 -0
- package/src/client/transport/index.ts +14 -0
- package/src/client/transport/packet.ts +69 -0
- package/src/client/transport/quicklz.ts +209 -0
- package/src/client/types.ts +268 -0
- package/src/core/api/channels.ts +396 -0
- package/src/core/api/clients.ts +654 -0
- package/src/core/api/command.ts +563 -0
- package/src/core/api/files.ts +405 -0
- package/src/core/api/groups.ts +622 -0
- package/src/core/api/moderation.ts +525 -0
- package/src/core/api/parse.ts +52 -0
- package/src/core/api/server.ts +709 -0
- package/src/core/command/command.ts +125 -0
- package/src/core/command/ids.ts +149 -0
- package/src/core/command/parser.ts +68 -0
- package/src/core/command/request.ts +119 -0
- package/src/core/command/responses.ts +114 -0
- package/src/core/command-name.ts +334 -0
- package/src/core/enums.ts +167 -0
- package/src/core/errorcode.ts +412 -0
- package/src/core/errors.ts +258 -0
- package/src/core/events.ts +219 -0
- package/src/core/helpers.ts +161 -0
- package/src/core/index.ts +126 -0
- package/src/core/internal.ts +23 -0
- package/src/core/middleware.ts +24 -0
- package/src/core/notification-name.ts +155 -0
- package/src/core/notifications.ts +157 -0
- package/src/core/permission-name.ts +538 -0
- package/src/core/permission.ts +34 -0
- package/src/core/property-name.ts +411 -0
- package/src/core/reason.ts +38 -0
- package/src/core/reconnect.ts +98 -0
- package/src/core/types.ts +138 -0
- package/src/query/client.ts +1132 -0
- package/src/query/errors.ts +108 -0
- package/src/query/index.ts +65 -0
- package/src/query/knownhosts.ts +257 -0
- package/src/query/lines.ts +28 -0
- package/src/query/options.ts +388 -0
- package/src/query/reconnect.ts +84 -0
- package/src/query/ssh.ts +614 -0
- package/src/query/stream.ts +91 -0
- package/src/query/tcp.ts +85 -0
- package/src/query/transport.ts +35 -0
- package/src/query/web.ts +195 -0
- package/src/versions/index.ts +10774 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { PacketHandler } from "./handler.js";
|
|
2
|
+
export {
|
|
3
|
+
PacketType,
|
|
4
|
+
PacketFlags,
|
|
5
|
+
packetType,
|
|
6
|
+
packetFlags,
|
|
7
|
+
isUnencrypted,
|
|
8
|
+
buildC2SHeader,
|
|
9
|
+
parseS2CHeader,
|
|
10
|
+
parseC2SHeader,
|
|
11
|
+
} from "./packet.js";
|
|
12
|
+
export type { Packet } from "./packet.js";
|
|
13
|
+
export { GenerationWindow } from "./generation-window.js";
|
|
14
|
+
export { Qlz } from "./quicklz.js";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const enum PacketType {
|
|
2
|
+
Voice = 0,
|
|
3
|
+
VoiceWhisper = 1,
|
|
4
|
+
Command = 2,
|
|
5
|
+
CommandLow = 3,
|
|
6
|
+
Ping = 4,
|
|
7
|
+
Pong = 5,
|
|
8
|
+
Ack = 6,
|
|
9
|
+
AckLow = 7,
|
|
10
|
+
Init1 = 8,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const enum PacketFlags {
|
|
14
|
+
Fragmented = 0x10,
|
|
15
|
+
NewProtocol = 0x20,
|
|
16
|
+
Compressed = 0x40,
|
|
17
|
+
Unencrypted = 0x80,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Packet {
|
|
21
|
+
/** Type byte combined with flags (low nibble = type, high nibble = flags). */
|
|
22
|
+
typeFlagged: number;
|
|
23
|
+
id: number;
|
|
24
|
+
clientID: number;
|
|
25
|
+
generationID: number;
|
|
26
|
+
data: Uint8Array;
|
|
27
|
+
receivedAt: number; // performance.now(), a monotonic clock
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function packetType(p: Packet): PacketType {
|
|
31
|
+
return p.typeFlagged & 0x0f;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function packetFlags(p: Packet): number {
|
|
35
|
+
return p.typeFlagged & 0xf0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function isUnencrypted(p: Packet): boolean {
|
|
39
|
+
return (packetFlags(p) & PacketFlags.Unencrypted) !== 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Build the 5-byte client-to-server header: [packetID(2), clientID(2), typeFlagged(1)]. */
|
|
43
|
+
export function buildC2SHeader(p: Packet): Uint8Array {
|
|
44
|
+
const header = new Uint8Array(5);
|
|
45
|
+
const view = new DataView(header.buffer);
|
|
46
|
+
view.setUint16(0, p.id, false);
|
|
47
|
+
view.setUint16(2, p.clientID, false);
|
|
48
|
+
header[4] = p.typeFlagged;
|
|
49
|
+
return header;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Parse a 3-byte server-to-client header. */
|
|
53
|
+
export function parseS2CHeader(raw: Uint8Array): Pick<Packet, "id" | "typeFlagged"> {
|
|
54
|
+
const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
|
|
55
|
+
return {
|
|
56
|
+
id: view.getUint16(0, false),
|
|
57
|
+
typeFlagged: raw[2]!,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Parse a 5-byte client-to-server header. */
|
|
62
|
+
export function parseC2SHeader(raw: Uint8Array): Pick<Packet, "id" | "clientID" | "typeFlagged"> {
|
|
63
|
+
const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
|
|
64
|
+
return {
|
|
65
|
+
id: view.getUint16(0, false),
|
|
66
|
+
clientID: view.getUint16(2, false),
|
|
67
|
+
typeFlagged: raw[4]!,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
const TABLE_SIZE = 4096;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The largest decompressed command accepted. A command is reassembled from at
|
|
5
|
+
* most a receive window of fragments, and the largest real answers (a full
|
|
6
|
+
* permission list, the welcome channel list of a big server) are a few
|
|
7
|
+
* hundred kilobytes; a header declaring more is refused before anything is
|
|
8
|
+
* allocated.
|
|
9
|
+
*/
|
|
10
|
+
export const MAX_DECOMPRESSED_SIZE: number = 1 << 20;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* How much larger than its compressed bytes a level-1 block can be. The most
|
|
14
|
+
* a 3-byte back-reference yields is 255 bytes, and every 32 entries also cost
|
|
15
|
+
* a 4-byte control word, which bounds the ratio at about 82; a block declaring
|
|
16
|
+
* more cannot be honest, and is refused before its output is allocated.
|
|
17
|
+
*/
|
|
18
|
+
const MAX_EXPANSION = 128;
|
|
19
|
+
|
|
20
|
+
interface QlzState {
|
|
21
|
+
control: number;
|
|
22
|
+
sourcePos: number;
|
|
23
|
+
destPos: number;
|
|
24
|
+
nextHashed: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A QuickLZ block that cannot be decompressed: truncated, oversized or inconsistent. */
|
|
28
|
+
export class QuickLZError extends Error {
|
|
29
|
+
constructor(message: string) {
|
|
30
|
+
super(`QuickLZ: ${message}`);
|
|
31
|
+
this.name = "QuickLZError";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* QuickLZ level 1 decompression, as the server compresses large commands.
|
|
37
|
+
*
|
|
38
|
+
* The input comes from the network, so every read and every back-reference is
|
|
39
|
+
* checked, and malformed input throws a QuickLZError rather than reading out
|
|
40
|
+
* of range or producing a partly filled buffer.
|
|
41
|
+
*/
|
|
42
|
+
export class Qlz {
|
|
43
|
+
#hashtable = new Int32Array(TABLE_SIZE);
|
|
44
|
+
|
|
45
|
+
decompress(data: Uint8Array): Uint8Array {
|
|
46
|
+
const { headerLen, decompressedSize, flags } = parseQlzHeader(data);
|
|
47
|
+
|
|
48
|
+
if ((flags & 0x01) === 0) {
|
|
49
|
+
if (headerLen + decompressedSize > data.length) {
|
|
50
|
+
throw new QuickLZError("stored block is shorter than its declared size");
|
|
51
|
+
}
|
|
52
|
+
return data.slice(headerLen, headerLen + decompressedSize);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (decompressedSize > (data.length - headerLen) * MAX_EXPANSION) {
|
|
56
|
+
throw new QuickLZError(
|
|
57
|
+
`declared size ${decompressedSize} is more than ${data.length - headerLen} bytes can expand to`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const dest = new Uint8Array(decompressedSize);
|
|
61
|
+
this.#hashtable.fill(0);
|
|
62
|
+
|
|
63
|
+
const state: QlzState = {
|
|
64
|
+
control: 1,
|
|
65
|
+
sourcePos: headerLen,
|
|
66
|
+
destPos: 0,
|
|
67
|
+
nextHashed: 0,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
while (state.destPos < decompressedSize) {
|
|
71
|
+
this.#ensureControl(data, state);
|
|
72
|
+
if ((state.control & 1) !== 0) {
|
|
73
|
+
this.#processReference(data, dest, state);
|
|
74
|
+
} else if (this.#processLiteral(data, dest, decompressedSize, state)) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (state.destPos !== decompressedSize) throw new QuickLZError("block ends early");
|
|
80
|
+
return dest;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#ensureControl(data: Uint8Array, st: QlzState): void {
|
|
84
|
+
if (st.control !== 1) return;
|
|
85
|
+
if (st.sourcePos + 4 > data.length) throw new QuickLZError("block ends early");
|
|
86
|
+
st.control =
|
|
87
|
+
(data[st.sourcePos]! |
|
|
88
|
+
(data[st.sourcePos + 1]! << 8) |
|
|
89
|
+
(data[st.sourcePos + 2]! << 16) |
|
|
90
|
+
(data[st.sourcePos + 3]! << 24)) >>>
|
|
91
|
+
0;
|
|
92
|
+
st.sourcePos += 4;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#processReference(data: Uint8Array, dest: Uint8Array, st: QlzState): void {
|
|
96
|
+
st.control = (st.control >>> 1) >>> 0;
|
|
97
|
+
if (st.sourcePos + 2 > data.length) throw new QuickLZError("block ends early");
|
|
98
|
+
|
|
99
|
+
const b1 = data[st.sourcePos]!;
|
|
100
|
+
const b2 = data[st.sourcePos + 1]!;
|
|
101
|
+
st.sourcePos += 2;
|
|
102
|
+
|
|
103
|
+
const hash = (b1 >> 4) | (b2 << 4);
|
|
104
|
+
let matchlen = b1 & 0x0f;
|
|
105
|
+
if (matchlen !== 0) {
|
|
106
|
+
matchlen += 2;
|
|
107
|
+
} else {
|
|
108
|
+
if (st.sourcePos >= data.length) throw new QuickLZError("block ends early");
|
|
109
|
+
matchlen = data[st.sourcePos]!;
|
|
110
|
+
st.sourcePos++;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const offset = this.#hashtable[hash]!;
|
|
114
|
+
// The copy may overlap its own output, so only its start must precede it.
|
|
115
|
+
if (offset >= st.destPos) throw new QuickLZError("back-reference points ahead of the output");
|
|
116
|
+
if (st.destPos + matchlen > dest.length) {
|
|
117
|
+
throw new QuickLZError("back-reference overruns the declared size");
|
|
118
|
+
}
|
|
119
|
+
for (let i = 0; i < matchlen; i++) {
|
|
120
|
+
dest[st.destPos] = dest[offset + i]!;
|
|
121
|
+
st.destPos++;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const end = st.destPos + 1 - matchlen;
|
|
125
|
+
this.#updateHashtable(dest, st, end);
|
|
126
|
+
st.nextHashed = st.destPos;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Copy literals; returns true once the tail of the block has been copied. */
|
|
130
|
+
#processLiteral(
|
|
131
|
+
data: Uint8Array,
|
|
132
|
+
dest: Uint8Array,
|
|
133
|
+
decompressedSize: number,
|
|
134
|
+
st: QlzState,
|
|
135
|
+
): boolean {
|
|
136
|
+
const threshold = Math.max(decompressedSize, 10) - 10;
|
|
137
|
+
if (st.destPos >= threshold) {
|
|
138
|
+
while (st.destPos < decompressedSize) {
|
|
139
|
+
if (st.control === 1) {
|
|
140
|
+
if (st.sourcePos + 4 > data.length) throw new QuickLZError("block ends early");
|
|
141
|
+
st.control =
|
|
142
|
+
(data[st.sourcePos]! |
|
|
143
|
+
(data[st.sourcePos + 1]! << 8) |
|
|
144
|
+
(data[st.sourcePos + 2]! << 16) |
|
|
145
|
+
(data[st.sourcePos + 3]! << 24)) >>>
|
|
146
|
+
0;
|
|
147
|
+
st.sourcePos += 4;
|
|
148
|
+
}
|
|
149
|
+
if (st.sourcePos >= data.length) throw new QuickLZError("block ends early");
|
|
150
|
+
dest[st.destPos++] = data[st.sourcePos++]!;
|
|
151
|
+
st.control = (st.control >>> 1) >>> 0;
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (st.sourcePos >= data.length) throw new QuickLZError("block ends early");
|
|
157
|
+
|
|
158
|
+
dest[st.destPos++] = data[st.sourcePos++]!;
|
|
159
|
+
st.control = (st.control >>> 1) >>> 0;
|
|
160
|
+
|
|
161
|
+
const end = Math.max(st.destPos - 2, 0);
|
|
162
|
+
this.#updateHashtable(dest, st, end);
|
|
163
|
+
if (st.nextHashed < end) st.nextHashed = end;
|
|
164
|
+
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#updateHashtable(dest: Uint8Array, st: QlzState, end: number): void {
|
|
169
|
+
while (st.nextHashed < end) {
|
|
170
|
+
if (st.nextHashed + 3 > dest.length) break;
|
|
171
|
+
const v =
|
|
172
|
+
(dest[st.nextHashed]! |
|
|
173
|
+
(dest[st.nextHashed + 1]! << 8) |
|
|
174
|
+
(dest[st.nextHashed + 2]! << 16)) >>>
|
|
175
|
+
0;
|
|
176
|
+
const hash = ((v >> 12) ^ v) & 0xfff;
|
|
177
|
+
this.#hashtable[hash] = st.nextHashed;
|
|
178
|
+
st.nextHashed++;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function parseQlzHeader(data: Uint8Array): {
|
|
184
|
+
headerLen: number;
|
|
185
|
+
decompressedSize: number;
|
|
186
|
+
flags: number;
|
|
187
|
+
} {
|
|
188
|
+
if (data.length < 3) throw new QuickLZError("data too short");
|
|
189
|
+
|
|
190
|
+
const flags = data[0]!;
|
|
191
|
+
const level = (flags >> 2) & 0x03;
|
|
192
|
+
if (level !== 1) throw new QuickLZError("only level 1 is supported");
|
|
193
|
+
|
|
194
|
+
const long = (flags & 0x02) !== 0;
|
|
195
|
+
const headerLen = long ? 9 : 3;
|
|
196
|
+
if (data.length < headerLen) throw new QuickLZError("data too short for header");
|
|
197
|
+
|
|
198
|
+
// The header also carries the compressed size, which the reads below make
|
|
199
|
+
// redundant: each one is checked against the data itself.
|
|
200
|
+
const decompressedSize = long
|
|
201
|
+
? (data[5]! | (data[6]! << 8) | (data[7]! << 16) | (data[8]! << 24)) >>> 0
|
|
202
|
+
: data[2]!;
|
|
203
|
+
|
|
204
|
+
if (decompressedSize > MAX_DECOMPRESSED_SIZE) {
|
|
205
|
+
throw new QuickLZError(`declared size ${decompressedSize} exceeds ${MAX_DECOMPRESSED_SIZE}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return { headerLen, decompressedSize, flags };
|
|
209
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ClientID,
|
|
3
|
+
ClientVersion,
|
|
4
|
+
CommandMiddleware,
|
|
5
|
+
Logger,
|
|
6
|
+
PokeEvent,
|
|
7
|
+
ReconnectOptions,
|
|
8
|
+
ServerEventMap,
|
|
9
|
+
SessionEventMap,
|
|
10
|
+
VoiceDataEvent,
|
|
11
|
+
} from "@honeybbq/teamspeak";
|
|
12
|
+
import type { Duplex } from "node:stream";
|
|
13
|
+
import type { ClientTrace } from "./trace.js";
|
|
14
|
+
|
|
15
|
+
// ---- Events ---------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The events `Client.on()` takes, and what each delivers.
|
|
19
|
+
*
|
|
20
|
+
* The typed events here are the first of the two layers a notification
|
|
21
|
+
* reaches; the second is `notification`, which carries every notification the
|
|
22
|
+
* server sends, the ones with an event here among them, after that event. So a
|
|
23
|
+
* typed event is only ever added, never removed, and adding one takes nothing
|
|
24
|
+
* away from the catch-all. May gain events in a minor release; code that
|
|
25
|
+
* handles every event generically should expect names it does not know.
|
|
26
|
+
*/
|
|
27
|
+
export interface EventMap extends ServerEventMap, SessionEventMap {
|
|
28
|
+
/** This client being poked. */
|
|
29
|
+
poked: PokeEvent;
|
|
30
|
+
/**
|
|
31
|
+
* Audio from another client. Only decoded with a listener or event
|
|
32
|
+
* middleware. Voice is dropped, counted and reported in a warning at most
|
|
33
|
+
* every ten seconds, while more than 256 deliveries are waiting: a listener
|
|
34
|
+
* that cannot keep up loses audio rather than memory.
|
|
35
|
+
*/
|
|
36
|
+
voiceData: VoiceDataEvent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Who `sendWhisper` sends to. The whisper framing the client writes carries
|
|
41
|
+
* client ids only, so there is no field for channels yet; one can be added
|
|
42
|
+
* without changing a call that names `clients`.
|
|
43
|
+
*/
|
|
44
|
+
export interface WhisperTargets {
|
|
45
|
+
/** The clients to whisper to: at least one and at most 32. */
|
|
46
|
+
readonly clients?: readonly ClientID[] | undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** What `sendVoice` can be told. Reserved: it has no fields yet. */
|
|
50
|
+
export interface VoiceOptions {}
|
|
51
|
+
|
|
52
|
+
/** The values of the table below, before freezing. */
|
|
53
|
+
const eventNameValues = {
|
|
54
|
+
/** A text message to this client, its channel or the server. */
|
|
55
|
+
TextMessage: "textMessage",
|
|
56
|
+
/** A client coming into view, including every client already there on connecting. */
|
|
57
|
+
ClientEnter: "clientEnter",
|
|
58
|
+
/** A client going out of view. */
|
|
59
|
+
ClientLeave: "clientLeave",
|
|
60
|
+
/** A client changing channel. */
|
|
61
|
+
ClientMoved: "clientMoved",
|
|
62
|
+
/** This client being poked. */
|
|
63
|
+
Poked: "poked",
|
|
64
|
+
/** Audio from another client. Only decoded with a listener or event middleware. */
|
|
65
|
+
VoiceData: "voiceData",
|
|
66
|
+
/**
|
|
67
|
+
* Every notification the server sends, modelled or not, after any event it
|
|
68
|
+
* produces; one with a typed event arrives here as well, not only there.
|
|
69
|
+
*/
|
|
70
|
+
Notification: "notification",
|
|
71
|
+
/** The handshake completing, on `connect()` and on every reconnection. */
|
|
72
|
+
Connected: "connected",
|
|
73
|
+
/** The connection ending, with its cause and whether a reconnection follows. */
|
|
74
|
+
Disconnected: "disconnected",
|
|
75
|
+
/** A kick from the server, which also ends the connection. */
|
|
76
|
+
Kicked: "kicked",
|
|
77
|
+
} as const;
|
|
78
|
+
/**
|
|
79
|
+
* The names of the events `Client.on()` takes, as constants. `on(EventName.TextMessage, ...)`
|
|
80
|
+
* and `on("textMessage", ...)` are the same call, and both give the listener
|
|
81
|
+
* the same payload type.
|
|
82
|
+
*/
|
|
83
|
+
export const EventName: typeof eventNameValues = /* @__PURE__ */ Object.freeze(eventNameValues);
|
|
84
|
+
/**
|
|
85
|
+
* One of {@link EventName}, and so a key of {@link EventMap}. May gain members
|
|
86
|
+
* in a minor release: a `switch` over it needs a default case.
|
|
87
|
+
*/
|
|
88
|
+
export type EventName = (typeof EventName)[keyof typeof EventName];
|
|
89
|
+
|
|
90
|
+
// Each direction fails to compile when `EventMap` and `EventName` drift: an
|
|
91
|
+
// event without a name, and a name that is not an event.
|
|
92
|
+
const eventNamesCoverEventMap: [Exclude<keyof EventMap, EventName>] extends [never] ? true : never =
|
|
93
|
+
true;
|
|
94
|
+
const eventMapCoversEventNames: [Exclude<EventName, keyof EventMap>] extends [never]
|
|
95
|
+
? true
|
|
96
|
+
: never = true;
|
|
97
|
+
void eventNamesCoverEventMap;
|
|
98
|
+
void eventMapCoversEventNames;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The events that come from the server, and so pass through event middleware.
|
|
102
|
+
* May gain members in a minor release: a `switch` over an event's name needs
|
|
103
|
+
* a default case.
|
|
104
|
+
*/
|
|
105
|
+
export type ServerEventName =
|
|
106
|
+
| "textMessage"
|
|
107
|
+
| "clientEnter"
|
|
108
|
+
| "clientLeave"
|
|
109
|
+
| "clientMoved"
|
|
110
|
+
| "poked"
|
|
111
|
+
| "voiceData"
|
|
112
|
+
| "notification";
|
|
113
|
+
|
|
114
|
+
/** A server event as event middleware sees it. */
|
|
115
|
+
export type ServerEvent = {
|
|
116
|
+
[K in ServerEventName]: { readonly name: K; readonly payload: EventMap[K] };
|
|
117
|
+
}[ServerEventName];
|
|
118
|
+
|
|
119
|
+
// ---- Transport seam ---------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The part of a UDP socket the client uses. A `node:dgram` socket is one; so
|
|
123
|
+
* is anything else with these methods, such as a tunnel or a test double.
|
|
124
|
+
*
|
|
125
|
+
* Should a later release use more of a socket, the new members will be
|
|
126
|
+
* optional here, so an implementation of this interface keeps compiling.
|
|
127
|
+
*/
|
|
128
|
+
export interface DatagramSocket {
|
|
129
|
+
/** Fix the peer, then call `callback`; failure is reported as an `error` event. */
|
|
130
|
+
connect(port: number, address: string, callback: () => void): void;
|
|
131
|
+
/** Send one datagram to the peer. */
|
|
132
|
+
send(data: Uint8Array, callback: (error: Error | null) => void): void;
|
|
133
|
+
/** Close the socket; it then emits `close`. */
|
|
134
|
+
close(): void;
|
|
135
|
+
/** Listen for each datagram received. */
|
|
136
|
+
on(event: "message", listener: (message: Uint8Array) => void): unknown;
|
|
137
|
+
/** Listen for a failure, which ends the connection. */
|
|
138
|
+
on(event: "error", listener: (error: Error) => void): unknown;
|
|
139
|
+
/** Listen for the socket closing. */
|
|
140
|
+
on(event: "close", listener: () => void): unknown;
|
|
141
|
+
/** Listen for the next failure only, while connecting. */
|
|
142
|
+
once(event: "error", listener: (error: Error) => void): unknown;
|
|
143
|
+
/** Stop listening for failures. */
|
|
144
|
+
off(event: "error", listener: (error: Error) => void): unknown;
|
|
145
|
+
/**
|
|
146
|
+
* The local end of the socket, for a trace to report. Optional: a socket that
|
|
147
|
+
* cannot say is reported with an empty local address.
|
|
148
|
+
*/
|
|
149
|
+
address?(): { readonly address: string; readonly port: number };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Creates the UDP socket the client talks through, for the given address family. */
|
|
153
|
+
export type SocketFactory = (family: 4 | 6) => DatagramSocket;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Opens the connection a file transfer runs over, to `host:port`. A
|
|
157
|
+
* `node:net` socket is one, as is the socket a SOCKS or HTTP proxy library
|
|
158
|
+
* returns. It may still be connecting when returned: the transfer waits for
|
|
159
|
+
* it.
|
|
160
|
+
*/
|
|
161
|
+
export type FileTransferSocketFactory = (host: string, port: number) => Duplex;
|
|
162
|
+
|
|
163
|
+
/** Wraps the delivery of server events; it may observe, alter or drop them. */
|
|
164
|
+
export type EventMiddleware = (next: (event: ServerEvent) => void) => (event: ServerEvent) => void;
|
|
165
|
+
|
|
166
|
+
// ---- Resolved address (from discovery) --------------------------------------
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* An address a server's name resolved to. Only `addr` is needed to connect;
|
|
170
|
+
* the rest describes the answer.
|
|
171
|
+
*/
|
|
172
|
+
export interface ResolvedAddr {
|
|
173
|
+
/** The endpoint, as `host:port`. */
|
|
174
|
+
readonly addr: string;
|
|
175
|
+
/** How it was found, such as `SRV`, `TSDNS-SRV`, `TSDNS-Direct` or `Direct`. */
|
|
176
|
+
readonly source?: string | undefined;
|
|
177
|
+
/** When the answer stops being valid; unset for no stated lifetime. */
|
|
178
|
+
readonly expiry?: Date | undefined;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ---- AddrResolver interface -------------------------------------------------
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Turns the address a client was given — a host, `host:port`, or a TeamSpeak
|
|
185
|
+
* name — into endpoints to connect to. The default follows SRV records and
|
|
186
|
+
* TSDNS, as the TeamSpeak application does.
|
|
187
|
+
*/
|
|
188
|
+
export interface AddrResolver {
|
|
189
|
+
/**
|
|
190
|
+
* The endpoints for `addr`, best first. An empty answer falls back to `addr`
|
|
191
|
+
* itself. `signal` aborts when the connection attempt is given up, or once
|
|
192
|
+
* resolution has taken 10 seconds, after which the client connects to
|
|
193
|
+
* `addr` as given; a resolver that ignores it is abandoned all the same.
|
|
194
|
+
*/
|
|
195
|
+
resolve(
|
|
196
|
+
addr: string,
|
|
197
|
+
options?: { readonly signal?: AbortSignal | undefined },
|
|
198
|
+
): Promise<readonly ResolvedAddr[]>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ---- ClientOptions ----------------------------------------------------------
|
|
202
|
+
|
|
203
|
+
/** How a `Client` connects, logs and behaves; every field is optional. */
|
|
204
|
+
export interface ClientOptions {
|
|
205
|
+
/** Where the client logs. Silent unless set: a library has no business writing to the console. */
|
|
206
|
+
readonly logger?: Logger | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Creates the UDP socket the client talks through, given the address family
|
|
209
|
+
* the server's address resolved to.
|
|
210
|
+
*
|
|
211
|
+
* Supplying one lets an application route traffic through a proxy or tunnel,
|
|
212
|
+
* or drive the client from something other than a real socket. It is the only
|
|
213
|
+
* seam into the transport: without it the SDK always creates its own.
|
|
214
|
+
*/
|
|
215
|
+
readonly socketFactory?: SocketFactory | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Reconnect after a dropped connection.
|
|
218
|
+
*
|
|
219
|
+
* Off by default: a silent reconnect makes an outage look like an ordinary
|
|
220
|
+
* session. An explicit `disconnect()` never reconnects regardless.
|
|
221
|
+
*/
|
|
222
|
+
readonly reconnect?: ReconnectOptions | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Hooks called at each milestone of every connection attempt, for timing,
|
|
225
|
+
* metrics and progress. The object is copied when the client is made, so
|
|
226
|
+
* changing it afterwards has no effect. See {@link ClientTrace} for the
|
|
227
|
+
* rules a hook follows.
|
|
228
|
+
*/
|
|
229
|
+
readonly trace?: ClientTrace | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Creates the TCP socket a file transfer runs over.
|
|
232
|
+
*
|
|
233
|
+
* Separate from `socketFactory` because file transfer dials its own
|
|
234
|
+
* connection to a different port, on demand. Set both to route everything
|
|
235
|
+
* through a proxy.
|
|
236
|
+
*/
|
|
237
|
+
readonly fileTransferSocketFactory?: FileTransferSocketFactory | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Look a dot-less address up as a server nickname at named.myteamspeak.com,
|
|
240
|
+
* as the TeamSpeak application does. Off by default, since it sends the name
|
|
241
|
+
* to a third party; without it a dot-less name is resolved like any host.
|
|
242
|
+
* Ignored with a custom `resolver`.
|
|
243
|
+
*/
|
|
244
|
+
readonly nicknameLookup?: boolean | undefined;
|
|
245
|
+
/** Replaces the SRV and TSDNS resolution `connect()` performs. */
|
|
246
|
+
readonly resolver?: AddrResolver | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Wraps every typed command, outermost first; see `CommandMiddleware`. Raw
|
|
249
|
+
* lines sent with `exec` and `execNoWait` do not pass through it. Fixed for
|
|
250
|
+
* the client's life.
|
|
251
|
+
*/
|
|
252
|
+
readonly commandMiddleware?: readonly CommandMiddleware[] | undefined;
|
|
253
|
+
/** Wraps the delivery of every server event, outermost first. Fixed for the client's life. */
|
|
254
|
+
readonly eventMiddleware?: readonly EventMiddleware[] | undefined;
|
|
255
|
+
/**
|
|
256
|
+
* The platform, version and signature `clientinit` sends. Default: a recent
|
|
257
|
+
* Windows build. Pick another from `@honeybbq/teamspeak/versions`; a version
|
|
258
|
+
* the server does not know, or a build below its minimum, is refused when
|
|
259
|
+
* connecting. A bad value throws when the client is made.
|
|
260
|
+
*/
|
|
261
|
+
readonly version?: ClientVersion | undefined;
|
|
262
|
+
/** Server password sent during the initial `clientinit` handshake. */
|
|
263
|
+
readonly serverPassword?: string | undefined;
|
|
264
|
+
/** Default channel name to join during the initial `clientinit` handshake. */
|
|
265
|
+
readonly defaultChannel?: string | undefined;
|
|
266
|
+
/** Password for `defaultChannel`, sent during the initial `clientinit` handshake. */
|
|
267
|
+
readonly defaultChannelPassword?: string | undefined;
|
|
268
|
+
}
|