commit 22fe85bb92c0ce40bae757552192c1aa504008d9 Author: Meghdad <61308304+MeghdadFadaee@users.noreply.github.com> Date: Sun Nov 1 19:43:03 2026 +0330 init diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f4021e1 --- /dev/null +++ b/.env.example @@ -0,0 +1,18 @@ +# Deployment/operator settings only. Enter TeamSpeak connections in the signed-in app. +APP_ORIGIN=http://localhost:3000 +# Optional reserved owner login; preserve an existing value. Generate with npm run owner:hash. +OWNER_PASSWORD_HASH= +# Public signup: 1 enables registration; 0 closes signup without disabling existing accounts. +ALLOW_REGISTRATION=1 +# Generate once: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" +SESSION_SECRET= +# Required in production: one complete owner-controlled Redis REST credential pair. +UPSTASH_REDIS_REST_URL= +UPSTASH_REDIS_REST_TOKEN= +# Vercel Marketplace KV_REST_API_URL + KV_REST_API_TOKEN are also supported. +# Development only; rejected in production. Redis is required for persistence. +ALLOW_LOCAL_MEMORY_STORE=1 +# Generate once with npm run identity:key. Preserve across redeployments. +IDENTITY_ENCRYPTION_KEY= +# Only during explicit key rotation; see docs/IDENTITY.md. +IDENTITY_PREVIOUS_ENCRYPTION_KEY= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9bc077 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Private configuration and runtime data +.env* +!.env.example +.local/ +.vercel/ +.idea/ +.vscode/ +*.code-workspace +.DS_Store +*.log +coverage/ +evidence/ +docs/verification/ +# Reproducible dependencies and builds +**/node_modules/ +**/target/ +native/bin/ +# Upstream editor/CI metadata is not needed to build vendored libraries +native/vendor/**/.* diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..ab560d6 --- /dev/null +++ b/.vercelignore @@ -0,0 +1,15 @@ +.git/ +.env* +!.env.example +.local/ +.idea/ +.vscode/ +node_modules/ +native/target/ +native/bin/ +tests/ +docs/verification/ +coverage/ +evidence/ +*.log +.DS_Store diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d2396f4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,119 @@ +# VoxHarbor agent guide + +## Git and GitHub: strictly read-only + +Use Git and GitHub only to inspect information. Leave project file changes uncommitted. + +- Allowed: read status, diffs, logs, commits, branches, tags, remotes, pull requests, issues, releases, and Actions runs/checks/logs. +- Never stage, commit, push, pull, fetch, merge, rebase, reset, restore, clean, stash, switch branches, create/delete branches or tags, manage worktrees, change Git configuration, or modify Git metadata directly. +- Never create, edit, close, merge, approve, comment on, or delete GitHub resources. Never trigger, rerun, cancel, or modify GitHub workflows or deployments. +- `gh api` may perform read operations only. GraphQL queries are allowed; mutations are forbidden. HTTP POST is allowed only for a read-only GraphQL query. +- Do not bypass these restrictions through scripts, libraries, integrations, or the browser. If prohibited work is necessary, explain the manual step for the user. + +A source upload to the operator's existing Vercel project is separate from GitHub operations. Perform it only within the user's deployment authorization. + +## Start with the existing project + +Continue the existing implementation; do not restart it, replace it with a scaffold, or overwrite unrelated work. Inspect current files and read: + +1. `IMPLEMENTATION_PLAN.md` and `README.md`. +2. `docs/FEASIBILITY.md` and `docs/AUDIO.md`. +3. `docs/MANUAL_DEPLOYMENT.md` before packaging or deployment. +4. The relevant detailed documents: `docs/ARCHITECTURE.md`, `docs/MULTIUSER.md`, `docs/WORKSPACE.md`, `docs/DESIGN_IMPLEMENTATION.md`, `docs/FEATURE_MATRIX.md`, and `docs/TESTING.md`. + +Use source code and current checks to establish behavior. Documentation and old deployment reports can describe historical results; do not turn them into claims that the current release was tested. Keep the implementation plan and feature matrix honest about unfinished work. + +## Product and architecture + +VoxHarbor is an experimental, self-hosted TeamSpeak 3 browser client with separate application accounts. Each account owns its identity, nickname, encrypted connections/bookmarks, preferences, and protocol lease. Application accounts are distinct from TeamSpeak identities and vendor accounts. One active native server session per account is supported; server permissions remain authoritative. + +Application compute belongs in the operator's Vercel deployment, with durable operator-controlled Redis storage. Preserve the full-client TS3 protocol architecture. ServerQuery alone is not a voice client. Do not silently introduce a VPS, vendor gateway, desktop companion, or shared central account service. + +| Location | Responsibility | +| --- | --- | +| `api/server.mjs` | Deployment entry point | +| `src/http-adapter.mjs` | HTTP routes, static asset allowlist, security headers, WebSocket upgrades | +| `src/auth/` | Accounts, password hashing, sessions, storage, authenticated user context | +| `src/identity/vault.mjs`, `src/preferences.mjs` | Encrypted identities, connections and bookmarks | +| `src/protocol/`, `src/platform/`, `src/transport/` | Typed commands/events, native sessions, leases and destination policy | +| `native/src/` | Rust full-client protocol adapter | +| `native/vendor/` | Pinned upstream sources and notices | +| `public/app.mjs` | Authentication and diagnostic export | +| `public/workspace.mjs`, `public/workspace-model.mjs` | Page navigation, destinations, channels, participants and conversations | +| `public/protocol.mjs`, `public/protocol-connection.mjs` | Browser protocol integration, commands and bounded reconnection | +| `public/voice*.mjs`, `public/audio-recovery.mjs`, `public/jitter-buffer.mjs` | Capture/playback, Opus workers/worklets and audio recovery | +| `tests/`, `scripts/` | Automated tests, synthetic fixtures, development and packaging utilities | + +Use the existing vanilla HTML/CSS/browser ES module stack and Node.js 22 backend. Match nearby JavaScript conventions: `.mjs`, two-space indentation, single quotes and semicolons. Follow existing Rust conventions. Keep protocol logic separate from interface rendering. TeamSpeak channel ordering uses the preceding sibling ID; reuse `public/channel-order.mjs` instead of sorting the order field as a numeric rank. Preserve third-party licenses and record vendor patches explicitly. + +## Account, storage and privacy invariants + +- Derive workspace ownership from the authenticated session, never from a browser-supplied account ID. Preserve account-scoped storage keys, encryption associated data, leases and rate limits. +- Preserve the reserved legacy `owner` account and its original encrypted records. Do not migrate or replace them merely to change the interface. +- Keep HTTP/WebSocket authentication, origin validation, CSRF checks, secure cookies, destination validation and bounded inputs/queues intact. +- Connections and credentials belong on the backend. Reconnect using an opaque saved-settings ID. Never hardcode real servers, channels, nicknames, passwords, UIDs, or account data into source or product examples. +- Ordinary responses redact passwords and private identity material. Blank saved passwords preserve credentials only for the same destination; explicit clearing removes them. Distinguish current-connection recovery credentials from optional bookmark password storage. +- Preserve existing environment values, Redis data and identities. Never regenerate an identity after a storage/decryption error or rotate encryption/session secrets as routine troubleshooting. +- `.env.local`, `.local/`, identity exports, credentials, cookies, private screenshots/logs and recordings must stay outside public source and upload packages. Never print secret values or copy private evidence into documentation. +- Render server names, participant names and messages as literal text. Keep drafts separated by conversation. Preserve recipient ID/UID checks and asynchronous account/generation guards. Never automatically resend unconfirmed messages or commands. + +Read `SECURITY.md`, `docs/PUBLICATION.md` and `THIRD_PARTY_NOTICES.md` when changing security, distribution or dependencies. + +## UX and design requirements + +Implement the supplied design's page structure, sectioning and interactions, not just its colors and typography. Follow `docs/DESIGN_IMPLEMENTATION.md` and inspect the relevant design screens before interface changes. + +- Connections is the starting page after sign-in. Saved destinations need visible, direct connection and editing actions. +- Keep the complete connection form together. Save returns to the list; Save & connect saves first and opens the console. Protect unsaved edits and preserve clear password semantics. +- The console represents the actual joined room. Its recent-room strip is capped at four; never squeeze the full server hierarchy into horizontal tabs. +- The Channels page provides hierarchy, parent paths, occupancy, room/participant search and a separate preview/join flow. Previewing must not move the user or redirect channel messages. +- Private conversations, identity, audio, presence and diagnostics are separate pages. Use dialogs for short confirmations and pokes, not as the main page architecture. +- Page navigation must preserve the live connection and audio choices. Keep connection/transmission state understandable outside the console. Browser Back/Forward and Skip to content must work without unexpected navigation or data loss. +- Adapt phone workflows, not just widths: complete form before save actions, usable channel previews, bounded lists, compact participants and accessible voice controls. +- Use genuine account/server data in product flows. Keep simulated people, destinations and messages confined to clearly identified test fixtures. Do not add controls for unimplemented capabilities. + +New public modules, fonts and icons require explicit routes in `src/http-adapter.mjs`. Keep its content security policy consistent with `vercel.json`; prefer local assets and retain their licenses. Verify actual page transitions and representative desktop/phone layouts in the browser. + +## Audio and recovery invariants + +New sessions start with listening and microphone off. Listening may resume after automatic recovery if previously enabled; microphone recovery requires explicit opt-in and a previously enabled microphone. Choices live only in the signed-in page and clear on reload/sign-out. Never restore a held push-to-talk press. + +Hidden pages, device loss and sign-out stop transmission. Successful channel changes turn audio off; a denied join preserves the current channel/audio. Pending permission or initialization work must not resurrect a stopped audio instance. Preserve codec validation, per-speaker volume bounds, jitter buffering and backpressure. + +The native session cap is currently 240 seconds, inside a 300-second Function limit. Periodic reconnects can therefore be intentional. Use bounded, privacy-filtered diagnostics to distinguish session caps, transport loss, heartbeat timeouts and server errors. Do not log credentials, destinations, identities, message contents or media. + +## Development and verification + +| Command | Purpose | +| --- | --- | +| `npm ci` | Install locked JavaScript dependencies | +| `npm run native:build` | Prepare audio assets and build the native adapter | +| `npm run dev` | Start local development using existing `.env.local` | +| `npm run check` | JavaScript syntax checks; not a formatter, type checker or full verification | +| `npm test` | Node's built-in test suite | +| `npm run audio:qa` | Separate silent browser audio fixture | +| `npm run publication:check` | Audit public-source candidates without changing Git state | +| `npm run deployment:package` | Create an audited clean deployment folder | +| `npm run publication:package` | Create an audited public-source folder; does not push | + +`owner:setup` and `identity:key` are installation/bootstrap tools. Do not run them against an existing setup as ordinary development preparation. The development memory store is volatile; never treat its accounts or identities as durable production records. + +Use `node:test` in `tests/*.test.mjs` with synthetic secrets, temporary files, local sockets and simulated adapters. Add meaningful coverage for changed behavior. Run syntax checks and relevant tests for code changes, native builds for native changes, and browser/audio checks when those flows change. Documentation-only edits need reference/content checks rather than an unrelated full build. Report actual results, not a remembered test count. + +For UX work, verify populated and empty states, large channel lists, long/untrusted names, direct connect/edit/save flows, denied actions, private/channel draft separation, reconnection, keyboard navigation and phone layouts as applicable. Keep local fixtures separate from private production configuration. + +Generated Opus exchange, simulated UI tests and a successful deployment do not certify actual microphone conversations, audible playback, browser/device compatibility, concurrent multi-user voice capacity, Function-kill recovery or server restart recovery. Treat timeouts as inconclusive. Live server/audio tests require an authorized destination and consenting participants; never broadcast test tones or record others without authorization. + +## Deployment and handoff + +Follow `docs/MANUAL_DEPLOYMENT.md` and `docs/DEPLOYMENT.md`: + +1. Finish the authorized changes and appropriate checks. +2. Run `npm run deployment:package`; upload only its printed clean folder. Exclude private files, dependencies, Git metadata and local native binaries. Build native code for Linux on Vercel. +3. Reuse the intended existing project and preserve its private production configuration. Do not download environment values into the source package or expose authentication tokens in output. +4. Verify the production alias, current release assets, security gates and affected signed-in flows. Check identity and saved-connection continuity without recreating data. Test additional accounts when account isolation changes; do not manufacture unnecessary production test data for unrelated edits. +5. Distinguish local, simulated, deployed and real-server verification. Keep private deployment IDs, evidence and account details in excluded local records. + +Respect explicit browser/tool access denials. Do not bypass them or repeat permission-reset troubleshooting loops. Use authorized supported tools when available, and report concrete blockers when necessary. + +Leave changes uncommitted. In the handoff, state what changed, what was verified, whether it is deployed, and any remaining material limits. Do not claim the overall implementation plan is complete while its required milestones remain open. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a00801e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +Read README.md, IMPLEMENTATION_PLAN.md and docs/FEATURE_MATRIX.md. Keep implemented, verified, simulated and planned behavior distinct. Use synthetic fixtures and reserved example names in tests; live destinations and identities belong in private owner settings, never source. + +Run `npm run check`, `npm test` and `npm run publication:check` for changes. Build the native adapter for native/identity changes and use the silent browser fixture for audio changes. Test real servers only with authorization and consenting participants; never create channels, alter permissions, upload files or broadcast messages/audio as an incidental test. + +Preserve origin/CSRF/session checks, destination pinning, queue/rate bounds, encrypted storage and fail-closed behavior. Never log keys, session tokens, passwords, private messages or voice contents. Retain upstream licenses/provenance and record vendor modifications as explicit patches. Changes to original project code are MIT licensed; third-party licenses remain separate. + +Keep generated outputs, evidence, editor settings, dependencies, binaries and private configuration out of contributions. Publication and Git/GitHub operations are performed by the owner; no automatic commit/push workflow is included. diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md new file mode 100644 index 0000000..6a4f19b --- /dev/null +++ b/IMPLEMENTATION_PLAN.md @@ -0,0 +1,180 @@ +# VoxHarbor — Implementation Plan + +Build VoxHarbor, a polished, self-hosted TeamSpeak web client. An operator can deploy an independent instance in their Vercel account and enable public registration. Every user has a private workspace and retains their own TeamSpeak identity, connections and nickname across sessions, redeployments and devices. + +## Current scope + +The experimental core implements account-isolated authentication with public registration, encrypted identity/settings/bookmark storage, full-client TS3 synchronization, Opus audio and bounded session recovery. Private deployment observations are summarized in docs/FEASIBILITY.md without account, destination, identity or private evidence details. Connections are stored on the backend. The multi-user production rollout passed two-account identity/settings/authentication/logout checks on 2026-11-01 while preserving the legacy owner. Real concurrent multi-user TeamSpeak/voice capacity remains unverified. + +The plan remains unfinished. Actual microphone/device/browser verification, Function-kill/server-restart behavior, administration, file transfer, whisper, rich profiles, history and concurrent servers remain open. A private server denied messaging for the verification identities; permissions were not changed. Simulated fixtures never constitute a successful live interoperability test. See docs/FEATURE_MATRIX.md. + +Act as a senior engineer responsible for architecture, implementation, security, interface design, and verification. Deliver working software, not a mockup or architecture proposal. + +## Product requirements + +- One deployment belongs to an operator; each registered account has its own private workspace. +- Each user connects to existing, unmodified TeamSpeak servers using their address, port, nickname, identity, and any required passwords. +- Support TeamSpeak 3 first. Treat compatibility with newer TeamSpeak servers and their additional features as separately verified capabilities. +- Aim for comprehensive feature coverage comparable to the official client, within the permissions granted by the server. +- No shared vendor-operated gateway, mandatory central account, analytics, or advertising. +- All application compute must run within the owner's Vercel deployment. Durable storage may use an owner-controlled integration supported by Vercel. +- Do not silently introduce a VPS, external protocol gateway, or required desktop companion. + +## First milestone: prove Vercel feasibility + +Do this before investing in the full interface. + +Inspect current official Vercel documentation and build a minimal deployable experiment using an appropriate runtime. Verify on an actual Vercel deployment: + +1. Bidirectional binary WebSocket communication with the browser. +2. Outbound UDP with validated responses from a non-DNS endpoint. +3. A real TeamSpeak protocol handshake and authenticated connection to an authorized test server. +4. Channel and participant synchronization. +5. Actual two-way voice with another client. +6. Connection behavior near the Function execution limit, including reconnection and recovery. +7. Whether the chosen protocol library and any native dependencies build and run in Vercel's production environment. + +Local execution does not prove Vercel compatibility. A successful UDP send does not prove a response was received. A DNS-only UDP test does not establish TeamSpeak compatibility. + +Document the exact deployment, runtime, configuration, test results, and remaining uncertainty. Treat timeouts as inconclusive until investigated. + +If a hard platform limitation prevents the required architecture, report the evidence clearly. Do not claim the project meets the requirements, fabricate a successful test, or silently move compute elsewhere. Complete useful independent work and identify the smallest decision needed from the owner. + +## Protocol core + +Evaluate existing open-source full-client protocol implementations, including TS3J and tsclientlib and relevant maintained forks. Choose based on demonstrated compatibility, correctness, maintainability, licensing, and Vercel execution. + +ServerQuery alone is not sufficient for a voice client. + +Keep the protocol implementation independent of the UI. Separate: + +- Identity management. +- Address resolution and connection establishment. +- Protocol transport, cryptography, packet ordering, acknowledgements, and reconnect behavior. +- Server session state and event processing. +- Commands, permissions, and capability detection. +- Voice processing and routing. +- File transfer. +- Platform-specific adapters. + +Expose typed commands and events to the frontend. Keep authoritative server state synchronized through actual protocol events. + +Do not invent cryptography or implement an incomplete protocol merely to avoid using a suitable library. Do not pretend a successful connection means full compatibility. + +## Feature coverage + +Maintain a feature matrix with these statuses: implemented and verified, implemented but unverified, planned, unsupported by the selected server/protocol, or blocked by the browser/platform. + +Cover at least: + +- Persistent identities, identity import/export, and required identity security levels. +- Server and channel passwords. +- Server bookmarks and connection history. +- Channel hierarchy, subscriptions, participant lists, and speaking indicators. +- Voice send/receive, push-to-talk, voice activation, microphone/output mute, and per-user volume. +- Whisper targets and lists. +- Private, channel, and server text messages. +- Poke, away status, nickname, descriptions, avatars, badges, and icons where supported. +- Channel creation, editing, ordering, deletion, and password handling. +- User movement, kick, ban, complaints, and ban management. +- Server groups, channel groups, privilege keys, and detailed permission management. +- Channel file browsing, upload, download, folders, and deletion. +- Connection quality, latency, packet loss, and actionable errors. +- Multiple server sessions with explicit active microphone and audio routing. +- Server information and editable settings permitted by the owner's identity. + +Respect server-side permissions. Never imply that a custom client grants additional privileges. + +Investigate video, screen sharing, newer TeamSpeak features, and proprietary account services separately. Do not confuse GreenTeaSpeak extensions with standard TeamSpeak capabilities. Clearly document unsupported functionality rather than creating nonfunctional controls. + +## Audio requirements + +Build a real audio pipeline with codec support appropriate to the compatibility target. + +Include bounded queues, jitter buffering, packet-loss handling, per-speaker decoding and mixing, and protection against runaway latency. + +Implement microphone permissions, device changes, echo cancellation and noise suppression where supported, and clear transmission indicators. + +State browser limitations honestly: global push-to-talk shortcuts, background execution, output selection, and mobile behavior must be tested rather than assumed. + +## Accounts and authentication + +The operator controls registration; each user accesses only their own workspace. The requested multi-user scope supersedes the earlier owner-only requirement. See docs/MULTIUSER.md. + +- Provide a secure, documented owner bootstrap process. +- Support username/password registration and login, with an operator switch to close new registrations. Preserve the reserved legacy owner account without migrating its encrypted records. +- Use server-enforced authentication for every sensitive HTTP route, WebSocket upgrade, file operation, and protocol action. +- Use secure, HttpOnly session cookies, appropriate SameSite settings, origin validation, and CSRF protection. +- Never rely solely on a hidden URL, frontend checks, or an obscure deployment address. +- Do not put credentials or bearer tokens in URLs. +- Handle expiration, logout, and session revocation. +- Protect any public deployment with a setup/authentication gate from its first request. + +Because the backend makes network connections on the owner's behalf, validate destinations and prevent unauthenticated proxy use. Block internal and metadata-service destinations by default; make any intentional private-network support explicit. + +## Durable TeamSpeak identity + +The same identity must survive browser restarts, Function replacement, redeployment, and signing in from another device. + +- Generate a proper TeamSpeak identity once and persist it. +- Support compatible import and owner-initiated export. +- Never regenerate an identity silently after a storage or decryption error. +- Encrypt private identity material at rest using authenticated encryption. +- Keep the encryption secret separate from stored ciphertext, using deployment secrets or an appropriate managed key facility. +- Do not store plaintext private keys or server passwords in browser localStorage. +- Do not expose private keys through ordinary API responses. +- Explain where signing occurs and which owner-controlled backend components can access decrypted material. +- Exclude keys, passwords, privilege tokens, voice contents, and private messages from logs. +- Provide documented backup, recovery, and key-rotation behavior. + +Use durable storage, not the Function filesystem or process memory, for identity persistence. Store preferences and bookmarks appropriately, encrypting sensitive fields. + +## Interface and experience + +The user-approved Console design now supplies the page structure: destinations first, a unified connection editor, the voice console, searchable channel browser with preview, private conversation workspace, and separate identity/audio/presence/diagnostics pages. The console room strip contains a bounded recent-room list, not the full server hierarchy. See docs/DESIGN_IMPLEMENTATION.md for implemented flows and verification. + +Create a distinctive, professional communication app with a calm visual style, excellent typography, restrained color, accessible contrast, and polished interaction states. + +Suggested layout: + +- Server connections and bookmarks on the left. +- A clear, searchable channel and participant tree. +- Conversation and activity views in the main area. +- A persistent voice control bar showing connection, microphone, output, and active transmission. +- Contextual user/channel actions and focused settings panels. + +Support responsive desktop and mobile layouts, keyboard navigation, light/dark themes, and accessible controls. + +Make connection progress, permission errors, reconnecting, unsupported codecs, unavailable features, and identity/storage failures understandable. + +Use genuine server data in working flows. Keep any demonstration data explicitly separate. + +## Vercel deployment and lifecycle + +Provide a straightforward deployment process, ideally a Deploy to Vercel button when the repository is ready. + +Document required secrets, owner authentication setup, durable storage integration, runtime configuration, region selection, and relevant account features. + +Treat Function termination as a real operational boundary. Saving a snapshot in a database does not preserve a live UDP socket or an authenticated TeamSpeak session. Implement and verify reconnection accordingly, and disclose any unavoidable audio interruption. + +Avoid a design that only works because a developer process remains running locally. + +## Validation and delivery + +Test the areas that can invalidate the product: + +- Account isolation, authenticated HTTP/WebSocket access, registration controls, legacy owner continuity and independent logout. +- Identity persistence through redeployment and different browser sessions. +- Real TeamSpeak connection and two-way audio. +- Password-protected channels and insufficient permissions. +- Reconnection, server restart, and Function termination. +- Multiple speakers, jitter, and bounded audio queues. +- File-transfer authorization and destination validation. +- Malformed server packets and untrusted chat content. +- Current Chrome, Firefox, and Safari, with documented results. + +Deliver the source, lockfiles, environment-variable template, deployment instructions, architecture notes, feature matrix, and reproducible verification evidence. + +Work incrementally through verified milestones. Do not stop at a scaffold. Distinguish demonstrated behavior from assumptions and remaining work. + +Do not create, modify, or delete GitHub resources, or commit, push, or change Git state automatically. Leave project changes uncommitted unless separately authorized. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9ef4933 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 MeghdadFadaee + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b40861 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# VoxHarbor + +A self-hosted TeamSpeak 3 web client with private user accounts. Anyone can register on an open instance; each user keeps their own encrypted identity, nickname, connections and bookmarks. Application compute runs in the operator’s Vercel deployment and uses their Redis database. + +**Experimental software.** Native TS3 synchronization, generated two-way Opus audio, identity persistence and session recovery have been demonstrated in a private deployment. Actual microphone/device compatibility, uninterrupted conversation and comprehensive official-client feature coverage are not certified. See the [feature matrix](docs/FEATURE_MATRIX.md). + +## Run locally + +Requires Node.js 22, npm and a Rust toolchain for the native adapter. + +```sh +npm ci +npm run owner:setup +npm run identity:key +npm run native:build +npm run dev +``` + +Open the local address printed by the development server and create an account, or sign in as `owner` with the password from owner setup. Open **Identity** to create or import your TeamSpeak identity, then enter your server, voice port, nickname and optional channel/passwords in **Connection**. There is no built-in server or account. + +**Connect saves the connection encrypted on the backend first.** Reconnects send only its saved-settings ID; the backend loads the address and credentials. Bookmarks also keep credentials on the backend. Ordinary API responses redact passwords, and secrets are never stored in browser storage. Audio starts muted. Automatic recovery remembers listening; microphone recovery requires an explicit opt-in in Audio settings. Choices last for the signed-in page. See [audio behavior and connection logs](docs/AUDIO.md). + +The default development memory store is volatile: accounts, identities, connections and sessions disappear when that development process stops. Configure your own Redis credentials and disable the memory-store setting for local persistence. Production always requires Redis. Keep encryption keys stable and back up your identity securely. + +## Deploy your own instance + +Follow [deployment setup](docs/DEPLOYMENT.md). Configure the application origin, session secret, Redis credentials and separate identity encryption key as private environment variables. Public signup is enabled by default; set `ALLOW_REGISTRATION=0` to close signup. Existing `owner` credentials and records are preserved. See [accounts and rollout](docs/MULTIUSER.md). Configure TeamSpeak connections through the signed-in app, not source code or deployment variables. + +```sh +npm run deployment:package +``` + +Upload only the printed clean folder. It excludes environment files, identities, local evidence, dependencies, Git metadata and build outputs. Native code builds for the deployment platform. A successful local build is not proof that another deployment/account works. + +## Development and verification + +```sh +npm run check +npm test +npm run audio:qa +npm run publication:check +npm run publication:package +``` + +Tests use synthetic secrets, local sockets and fixtures. They do not connect to public TeamSpeak servers. Build the native adapter before testing its identity endpoints. The separate audio QA page uses generated sound with silent local output; it requests no microphone. See [testing](docs/TESTING.md) and [audio behavior](docs/AUDIO.md). + +Implemented: registration/login, account-isolated HTTP/WebSocket access, encrypted identities/settings/bookmarks, live channel/participant state and search, channel movement, nickname/away/subscription controls, typed text/poke actions, experimental Opus/PTT/VAD and bounded automatic recovery. Server permissions apply; a private server denied messaging during verification, so successful live messaging remains unverified. + +Pending: administration and detailed permissions, file transfer, whisper, richer profiles, history, concurrent servers, and broader hardware/browser testing. The [implementation plan](IMPLEMENTATION_PLAN.md) remains open. + +## Public source and licensing + +Target repository: [MeghdadFadaee/VoxHarbor](https://github.com/MeghdadFadaee/VoxHarbor). Original code is [MIT licensed](LICENSE); preserve the [third-party notices](THIRD_PARTY_NOTICES.md). + +Before your first commit or public upload, read [publication preparation](docs/PUBLICATION.md). Private development records are intentionally excluded. Never commit actual environment values, identity backups, connection exports, cookies, screenshots of private accounts, or voice/chat recordings. See [security reporting](SECURITY.md) and [contributing](CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..2137402 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security + +VoxHarbor is experimental operator-hosted software with private user workspaces and optional public registration. The operator controls the deployment, Redis and encryption keys. All sensitive HTTP operations and WebSocket upgrades require account authentication; writes/controls also check origin and CSRF. Keep the exact HTTPS app origin configured. The app blocks private/reserved network destinations by default. + +Keep `.env.local`, `.local`, Redis values, identity backups, deployment screenshots, HAR files, cookies, voice/chat contents and connection exports private. `.gitignore` is a convenience, not a secret manager. Run `npm run publication:check` before committing and inspect the files you stage. Do not bypass its findings by force-adding excluded material. + +Preserve the separate identity encryption key and encrypted Redis records. Incorrect keys/corrupt records fail closed; do not generate a replacement identity to hide a recovery error. See [identity recovery](docs/IDENTITY.md). Saved connection/bookmark passwords are encrypted and never included in ordinary metadata responses. Runtime diagnostics must not contain credentials or private content. + +Report vulnerabilities through GitHub's private security reporting for the intended repository if available. Otherwise ask the maintainer for a private reporting channel without posting exploit details or secrets publicly. Do not include real keys, tokens, private server/channel addresses, identities or recordings. If a secret was already published, revoke/rotate it and review repository history before making further public releases; deleting the working file alone does not remove it from history. + +Known limits include finite Function lifetime, one simultaneous native session per account, audio restarting muted after recovery and incomplete hardware/browser/feature verification. See the feature matrix. No automated scan guarantees that publication is safe; review the publication report and source manifest before you push. + +Registration is enabled by default and can be closed with `ALLOW_REGISTRATION=0`. New accounts cannot access the legacy owner or another account’s records. The operator remains trusted with encryption keys and backend signing. Password recovery, MFA and capacity certification are not included in this milestone; see [accounts](docs/MULTIUSER.md). diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..fbb9184 --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,15 @@ +# Third-party software + +The root MIT license covers VoxHarbor's original code. Third-party code retains its own copyright and license terms. + +| Component | Version / provenance | License and retained notices | +| --- | --- | --- | +| ReSpeak tsclientlib, tsproto and bookkeeping/declaration sources | Exact revisions and source archive digests in `native/vendor/provenance.json`; local patches recorded there | MIT OR Apache-2.0; retain `native/vendor/tsclientlib/LICENSE-MIT`, `LICENSE-APACHE`, and declaration license files | +| libopus-wasm | 0.3.0, pinned in `package-lock.json` | MIT wrapper license at `public/vendor/opus/LICENSE`; upstream notices at `public/vendor/opus/THIRD_PARTY_NOTICES.md` | +| libopus compiled into the bundled WASM | 1.6.1, as documented by libopus-wasm 0.3.0 | BSD-style copyright, redistribution and patent notices retained in `public/vendor/opus/COPYING.libopus` | +| IBM Plex Sans and IBM Plex Mono | Official Google Fonts distribution; original fonts © IBM Corp. | SIL Open Font License 1.1 at `public/fonts/OFL.txt`; locally hosted font files are unmodified | +| ws, ipaddr.js and build dependencies | Pinned Node/Cargo lockfiles | Original package notices are supplied by their distributions; dependencies/build outputs are not vendored into this source export | + +The libopus notice is copied from the [versioned upstream COPYING file](https://github.com/xiph/opus/blob/v1.6.1/COPYING). Build preparation preserves it alongside the generated browser codec. Vendored Rust sources are kept intact apart from the separately recorded patches. Upstream source references are not endorsements of VoxHarbor. + +If you distribute compiled artifacts, preserve the notices required by all linked dependencies as well as these source notices. TeamSpeak names and marks belong to their respective owners; this project is independent. diff --git a/api/server.mjs b/api/server.mjs new file mode 100644 index 0000000..4168f01 --- /dev/null +++ b/api/server.mjs @@ -0,0 +1,6 @@ +import { readConfig } from '../src/config.mjs'; +import { createApp } from '../src/http-adapter.mjs'; + +// Invalid configuration fails before any sensitive endpoint can be served. +const { server } = createApp(readConfig()); +export default server; diff --git a/docs/APP_ICONS.md b/docs/APP_ICONS.md new file mode 100644 index 0000000..7ea68d3 --- /dev/null +++ b/docs/APP_ICONS.md @@ -0,0 +1,18 @@ +# App icons + +VoxHarbor's orange waveform mark is provided as local assets for browser tabs, bookmarks and home-screen shortcuts: + +- `/favicon.svg`: scalable browser favicon. +- `/favicon.ico`: 16, 32 and 48 pixel fallback images. +- `/favicon-16x16.png` and `/favicon-32x32.png`: PNG favicon fallbacks. +- `/apple-touch-icon.png`: opaque 180 pixel Apple touch icon. +- `/icons/app-192.png` and `/icons/app-512.png`: standard app icons. +- `/icons/app-maskable-512.png`: opaque icon with extra padding for platform masks. +- `/icons/safari-pinned-tab.svg`: monochrome pinned-tab mark. +- `/site.webmanifest`: application name, launch location, colors and home-screen icons. + +The assets are linked from the document head and explicitly served by the HTTP adapter. Both application and deployment content policies allow the same-origin manifest. They require no sign-in or external asset requests. + +Regenerate the artwork with `npm run icons:build`. The generator uses Node built-ins and the same waveform geometry for its SVG, PNG and ICO outputs. Generated assets are checked into the source tree as project files, so deployment does not require an image-processing dependency. + +The manifest supplies shortcut/standalone presentation metadata; it does not add offline support, a service worker or a guarantee of installability on every browser. Accounts, identities and connections retain their existing backend ownership and storage rules. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..c08c9f0 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,25 @@ +# Architecture + +- `public/`: account workspace, session/recovery controller, AudioWorklets and Opus worker. No default destination, account, private key or server password is bundled. +- `src/http-adapter.mjs`: account-isolated HTTP/WebSocket boundary, origin/CSRF checks, limits and fail-closed session revalidation. +- `src/auth/`: atomic username registration, scrypt verification, account-bound expiring cookies, Redis account/session records and server-selected workspace scoping. +- `src/preferences.mjs`: encrypted backend connection/bookmark settings, metadata redaction and revision checks. +- `src/identity/`: authenticated encryption, create-if-absent identity persistence and explicit import/export/rewrap. +- `src/protocol/`: typed controls/events, per-account lease, server acknowledgements and audio gates. +- `src/transport/destination.mjs`: public-address validation and DNS pinning. +- `src/platform/`: bounded private stdio supervision. Native children receive no deployment-secret environment variables. +- `native/`: pinned Rust tsclientlib bridge. The native child signs/encrypts the actual full TS3 protocol; ServerQuery is not used as a voice substitute. + +`api/server.mjs` exports the Node server for Vercel; `scripts/dev.mjs` binds locally. Production uses the owner's Redis REST integration and rejects volatile memory. Cookies are HttpOnly/SameSite=Strict, Secure and `__Host-` scoped on HTTPS. WebSocket upgrades require account auth and exact origin; controls require CSRF. Revocation/storage failures close active transports. Frames, rates, state, audio queues and pending commands are bounded. + +Connection settings are encrypted before a connect command. A socket references an opaque settings ID; the backend retrieves credentials and pins the public destination. Settings changes from another session for the same account cannot redirect a stale reconnect silently. The native session rotates at 240 seconds within the configured 300-second Function boundary. A renewed Redis lease limits overlapping identity use; abandoned leases expire after 35 seconds. Recovering a socket does not preserve UDP state or audio capture. + +## Protocol source + +The selected adapter is ReSpeak/tsclientlib, pinned by source archive revision/digest in `native/vendor/provenance.json` with Cargo lockfiles. Source and declaration snapshots are retained with their licenses. TS3J was considered but would require an independently proven JVM runtime/package. No claim is made that selecting a library establishes full feature parity. + +Recorded vendor patches expose encoded audio while retaining transport crypto/permission behavior, and use bounded 2048-ID command reordering with duplicate suppression. The original archive digests and patches distinguish this source from unmodified upstream. The codec stays in the browser; native libopus/OpenSSL codec defaults are disabled. + +See [verification scope](FEASIBILITY.md), [audio constraints](AUDIO.md), [identity recovery](IDENTITY.md) and [feature matrix](FEATURE_MATRIX.md). Historic private transport/account evidence is intentionally outside the public repository. + +User record prefixes and authenticated encryption associated data both bind records to an account. Legacy owner keys/envelopes remain unchanged. HTTP request bodies never select an account scope. See [multi-user storage and rollout](MULTIUSER.md). diff --git a/docs/AUDIO.md b/docs/AUDIO.md new file mode 100644 index 0000000..1e41c40 --- /dev/null +++ b/docs/AUDIO.md @@ -0,0 +1,21 @@ +# Experimental Opus audio + +The browser uses 48 kHz AudioWorklets and the pinned `libopus-wasm` worker. Opus Voice (4) and Opus Music (5) with 20 ms frames are supported; outgoing capture is mono. Other codecs/frame durations are rejected. No media leaves until the owner explicitly enables listening, enables the microphone, and permits transmission with push-to-talk or voice activation. + +Incoming speakers have independent decoders, 60 ms initial jitter buffering, at most 12 queued packets, FEC/PLC and bounded mixing. Three misses end a talk spurt. There are at most 32 active speakers; idle decoder state expires. Capture credits, worker queues, native stdin, WebSocket backlogs and playback queues are bounded; stale frames are dropped. These are implementation limits, not an end-to-end audio-quality guarantee. TCP/WebSocket head-of-line blocking remains a limitation. + +Input/output start muted on new sessions. Disconnect, logout, hidden pages, input/device loss and suspended audio stop transmission. During automatic reconnection, listening resumes if it was enabled. The microphone resumes only when it was enabled and the user checked “Resume my enabled microphone after automatic reconnect.” These choices live only in the current signed-in page; reload/sign-out clears them. Hiding the page cancels pending recovery and mutes the microphone. Manual disconnect, successful channel changes, device errors and sign-out clear recovery. A denied channel join preserves current audio. Push-to-talk never restores a held press. Browser restrictions can still require a manual audio enable action. Pending permission/initialization work cannot resurrect a stopped instance. Concurrent startup shares codec initialization; participant volume chosen before startup is retained. Per-user gain is bounded from 0 to 2. + +PTT works while the page has focus; it is not a global shortcut. Echo cancellation, noise suppression and gain control are requested from the browser. Output selection depends on `AudioContext.setSinkId`. A browser that cannot provide the required 48 kHz worklet is rejected; resampling is not implemented. Safari, Firefox, Bluetooth, mobile suspension, actual microphone hardware and audible browser playback need separate testing. + +## Verification + +`npm test` covers actual Opus encoding/decoding, independent speaker decoding/mixing, loss and sequence wrapping, malformed frames, bounded queues, PTT release and lifecycle races. Worklet processor tests do not simulate browser scheduling. + +For a silent browser test, run `npm run audio:qa`, open the local address it prints and choose **Run silent pipeline test**. This uses generated audio, real worklets and the actual worker/codec with deliberate losses. It requests no microphone, emits silence to hardware and contacts no TeamSpeak server. Reports are synthetic diagnostics, not a real conversation pass. + +Before cleanup, a private deployment passed generated two-way audio through a real authorized TS3 server and a second native client. Frame counts were bounded-window observations, not loss/latency benchmarks. Real microphone capture, browser speaker audibility, multiple live speakers and official-client conversational interoperability remain unverified. To test them, use an authorized test channel and consenting participants; never record voice contents or broadcast test tones into an unsuspecting channel. + +## Connection diagnostics + +Connection diagnostics → Download JSON (or account settings → Diagnostics) exports the last 1,000 bounded events for this signed-in page. It records native session status (including the current 240-second session cap), socket close codes, connection duration, time since the last message, heartbeat round-trip times, retry delays/attempts, protocol error codes and browser online/visibility changes. The log excludes server addresses, account identifiers, close-reason text, credentials, messages and media. It remains in memory, clears on sign-out/reload, and is never automatically uploaded. Download it after a problem and before reloading. A close code alone does not prove the underlying network or hosting cause. diff --git a/docs/CAPABILITIES_AND_REQUIREMENTS.md b/docs/CAPABILITIES_AND_REQUIREMENTS.md new file mode 100644 index 0000000..64c8e98 --- /dev/null +++ b/docs/CAPABILITIES_AND_REQUIREMENTS.md @@ -0,0 +1,164 @@ +# VoxHarbor — Capabilities and Requirements + +## Product scope + +VoxHarbor is a browser-based TeamSpeak 3 client. Users register on an independently operated instance and connect to existing TeamSpeak servers. Each user has a separate account, TeamSpeak identity, saved connections and nickname. + +VoxHarbor accounts are separate from TeamSpeak identities and vendor accounts. Access to server functions depends on the connected server and the permissions assigned to the user's identity. + +## Current capabilities and functional requirements + +### Accounts and sessions + +- Register with a username, password and password confirmation when registration is enabled. +- Sign in with an existing username and password. +- Sign out and revoke the current application session. +- Keep each account's identity, connections and saved data separate from other accounts. +- Support closed registration while allowing existing users to sign in. +- Preserve the reserved legacy `owner` account. +- Handle invalid credentials, duplicate usernames, registration closure, request limits, expired sessions and unavailable account storage. +- Clear account-specific session data when signing out or changing accounts. + +| Field | Requirement | +| --- | --- | +| Username | 3–32 characters; letters, numbers, underscores or hyphens; starts with a letter or number; case-insensitive | +| Password | 16–256 characters for registration | +| Password confirmation | Must match the registration password | + +Email collection, email verification, password recovery, multi-factor authentication and account deletion are not currently available. + +### TeamSpeak identity + +- Explicitly create a persistent TeamSpeak identity or import an existing identity file. +- Retain the same identity across sign-ins, browser sessions and application deployments. +- Access the identity's public UID and security level. +- Export a private identity backup. +- Preserve an existing identity rather than silently replacing it. +- Support server-required identity security-level increases without changing the identity's UID. +- Distinguish a missing identity from an unreadable identity, failed import, storage failure or unavailable identity service. +- Require an identity before connecting to a TeamSpeak server. + +### Connections and saved destinations + +- Connect to a TeamSpeak server using an address, voice port and nickname. +- Support an optional server password, destination channel ID and channel password. +- Save connection settings and passwords encrypted on the backend for the authenticated account. +- Create, name, edit, select and delete saved connections. +- Retain saved connections and nicknames across sign-ins. +- Preserve saved passwords when no replacement is supplied for the same destination. +- Explicitly remove saved passwords. +- Keep saved passwords from being reused for a different destination after an address or channel change. +- Disconnect an active connection or stop an ongoing connection attempt. +- Support one active TeamSpeak connection per account. Separate accounts have independent connections. +- Restrict destinations to permitted public IPv4 addresses and voice ports from 1024 to 65535. + +### Server, channels and participants + +- Synchronize the connected server's name, channel hierarchy and visible participants. +- Search channels and participants. +- Access channel names, topics, password requirements, subscriptions and codec information. +- Access participant names, channel membership, mute states, away messages and speaking activity where available. +- Distinguish the current user and their current channel. +- Join another channel, including password-protected channels when authorized. +- Subscribe to and unsubscribe from channel updates when permitted. +- Change the current nickname. +- Set an away message and return from away status. +- Retain acknowledged nickname and channel changes in the backend connection settings for recovery. + +### Voice communication + +- Receive and transmit audio in Opus Voice and Opus Music channels. +- Enable and disable listening independently from microphone activation. +- Enable and mute the microphone. +- Support push-to-talk and hands-free voice activation. +- Adjust the voice activation threshold. +- Select an available microphone. +- Select an audio output device where the browser supports it. +- Adjust individual participants' playback volume from 0% to 200%. +- Track local transmission and remote speaking activity. +- Request browser-supported echo cancellation, noise suppression and automatic gain control. +- Handle denied microphone permission, missing devices, device changes, suspended audio and unsupported codecs. +- Start new sessions with listening and the microphone off. +- Stop microphone transmission when the page is hidden, the connection ends, the user signs out or an audio/device failure occurs. +- Restrict push-to-talk keyboard operation to the focused page; no global shortcut is available. + +### Automatic recovery and audio choices + +- Attempt bounded automatic recovery after recoverable connection interruptions. +- Reuse the account's existing identity and backend-saved connection settings. +- Recheck account authentication during recovery. +- Restore listening after automatic reconnection when it was previously enabled. +- Resume a previously enabled microphone only when the user has explicitly opted into automatic microphone recovery. +- Retain transmission mode, threshold and selected devices during automatic recovery within the same signed-in page. +- Cancel pending audio recovery on manual disconnect, sign-out, channel changes, device errors or page hiding. +- Never restore a previously held push-to-talk press. +- Start with audio off after reload or a new sign-in. +- Handle browser restrictions that prevent automatic audio resumption. + +### Text communication and participant contact + +- Send and receive channel, server and private text messages when permitted. +- Send and receive participant pokes when permitted. +- Associate private conversations with the intended participant. +- Distinguish pending actions, confirmed actions, denied actions and unconfirmed results. +- Do not automatically resend messages or participant actions after a timeout or disconnect. +- Keep messages in the current browser session, with a maximum of 200 retained entries. +- Clear messages on sign-out. Durable message history is not available. + +### Connection diagnostics + +- Record connection status changes, native session-limit events, socket close codes, connection duration and retry attempts/delays. +- Record heartbeat round-trip timing, time since the last transport message, protocol error codes and browser network/visibility changes. +- Export diagnostic data as a JSON file. +- Retain up to 1,000 events in memory for the current signed-in page. +- Clear diagnostics on reload or sign-out. +- Exclude server addresses, account identifiers, passwords, private identity material, messages and audio contents. +- Do not automatically upload diagnostic logs. + +## Required operational states + +- Signed out; registering; signing in; authenticated; session expired or revoked. +- Registration available or closed. +- No identity; identity available; identity operation pending; identity operation failed. +- No saved connection; saved connections available; settings being saved; conflicting or stale settings; settings storage failure. +- Disconnected; connecting; connected; reconnecting with a retry delay; network offline; recovery exhausted; connection rejected. +- Connection already active for the account. +- Live server data available; no participants; no search matches; previously received data no longer live. +- Listening off or on; microphone off, ready, idle or transmitting; microphone permission pending or denied. +- Unsupported channel codec; unavailable audio device; audio initialization or recovery failure. +- Action pending, confirmed, denied by server permissions, timed out or interrupted. + +## Privacy and data requirements + +- Require authentication for private account data and server actions. +- Keep private identities and connection credentials encrypted in durable backend storage. +- Keep credentials out of URLs, ordinary account responses and browser local storage. +- Restrict private identity export to an explicit action by the authenticated account. +- Preserve saved identities and connections through application updates. +- Stop account activity when its session expires or is revoked. +- Enforce server permissions for every supported action. +- Treat the instance operator as trusted with backend access; encryption at rest does not prevent operator access. + +## Planned capabilities — not currently available + +| Area | Required capabilities | +| --- | --- | +| Connection history and quality | Durable connection history; connection latency, packet loss and quality information | +| Multiple servers | Concurrent server connections with an explicit active microphone destination and audio routing | +| Advanced voice | Whisper targets, whisper lists and advanced audio routing | +| Channel management | Channel creation, editing, ordering, deletion and password management | +| Moderation | Authorized participant movement, kick, ban, complaints and ban management | +| Groups and permissions | Server groups, channel groups, privilege keys and detailed permission management | +| Files | Channel file browsing, upload, download, folders and deletion | +| Profiles and presence | Descriptions, avatars, badges and icons where supported | +| Server administration | Server information and authorized changes to server settings | + +## Compatibility and verification boundaries + +- TeamSpeak 3 is the current protocol target. +- Video, screen sharing, newer protocols and proprietary account services remain separate investigations. +- Server-side permissions can prevent otherwise supported operations. +- Native sessions currently have a 240-second lifetime before automatic reconnection; uninterrupted audio across that boundary is not guaranteed. +- Generated two-way Opus audio has been demonstrated through a real server. Actual microphone conversations, audible browser playback and microphone recovery still require live verification. +- Private messaging and poke interoperability remain unverified where server permissions prevented testing. +- Concurrent multi-user voice capacity, broad browser/device compatibility and reliable mobile background audio remain unverified. diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md new file mode 100644 index 0000000..c5dea2e --- /dev/null +++ b/docs/DEPLOYMENT.md @@ -0,0 +1,35 @@ +# Deploying an operator-hosted instance + +Use your own Vercel project and Redis REST integration. The application targets Node.js 22, Linux native execution, and a finite Function lifetime. This is experimental; verify the deployed account rather than assuming every platform configuration works. + +## Private deployment settings + +| Variable | Purpose | +| --- | --- | +| `APP_ORIGIN` | Exact HTTPS origin of your application, with no trailing slash/path | +| `OWNER_PASSWORD_HASH` | Optional reserved `owner` login; preserve existing values; generate privately with `npm run owner:hash` | +| `ALLOW_REGISTRATION` | `1` (default) enables signup; `0` closes new signups while existing users can sign in | +| `SESSION_SECRET` | Independent random 32-byte hex secret; keep stable unless revoking all sessions | +| `IDENTITY_ENCRYPTION_KEY` | Independent random 32-byte hex key for identities and connection preferences | +| `UPSTASH_REDIS_REST_URL` + `UPSTASH_REDIS_REST_TOKEN` | A complete owner-controlled Redis REST credential pair | +| `KV_REST_API_URL` + `KV_REST_API_TOKEN` | Alternative Marketplace-provided credential pair; do not mix pairs | +| `IDENTITY_PREVIOUS_ENCRYPTION_KEY` | Only during deliberate encryption-key rotation | + +Do not enable `ALLOW_LOCAL_MEMORY_STORE` in production. There is no TeamSpeak host, channel, identity, owner password or Redis endpoint bundled into the source. Earlier experimental `TS3_SERVER_*`, UDP probe and rotation variables are no longer used; configure connections through the authenticated app. Existing unrelated environment values are not modified by this cleanup. + +## Build and upload + +1. Configure the required private variables. Keep them out of source, issue reports and logs. +2. Run `npm ci`, `npm run check`, `npm test` and `npm run deployment:package` locally. +3. Upload the printed clean source folder to your intended Vercel project. Do not upload the working directory or connect a private evidence folder. +4. Use framework **Other**, Node **22**, and the `vercel.json` build command. The pinned native adapter is built with Cargo's lockfile and packaged for Linux; never upload a local macOS binary. +5. Confirm startup and account isolation on the real URL. Register or sign in, create/import an identity once, then enter and connect to a server you are authorized to use. +6. Confirm the same UID and saved connection survive reload and redeployment. Test audio only in an appropriate authorized channel with consenting participants. + +If your account changes Fluid Compute, WebSocket support, execution duration, region, architecture or networking behavior, re-run deployment checks. The configured Function limit is 300 seconds; native sessions rotate at 240 seconds. Recovery interrupts audio and restarts it muted. A dead transport may require waiting for its 35-second ownership lease to expire. One simultaneous native session per account is supported locally; production concurrency/capacity must be verified. + +## Operations + +Preserve your Redis database and encryption key across redeployments. Do not recreate an identity to hide a decryption/storage error. Account sessions expire after 15 minutes. Restore storage before reconnecting after an outage. See [identity recovery](IDENTITY.md), [workspace storage](WORKSPACE.md) and [testing](TESTING.md). + +Read [multi-user rollout](MULTIUSER.md) before opening signup. Preserve the legacy owner records and verify separate users. Encryption-key rotation must cover every account before retiring the previous key. diff --git a/docs/DESIGN_IMPLEMENTATION.md b/docs/DESIGN_IMPLEMENTATION.md new file mode 100644 index 0000000..e03e2d9 --- /dev/null +++ b/docs/DESIGN_IMPLEMENTATION.md @@ -0,0 +1,27 @@ +# Console workflow implementation + +The client follows the supplied Console / Product UI's page structure using separate hash routes. Only short confirmations and pokes are dialogs. All live transport, identity and encrypted storage operations remain attached to the signed-in account. + +## Pages and transitions + +- **Connections** is the starting page after sign-in. Saved destinations expose nickname, connection status, direct Connect/Open console, Edit and active Disconnect actions. Add opens a complete editor. A backend-saved last connection remains available even without a bookmark. One active server per account is enforced in the interface and backend. +- **Connection editor** keeps name, destination, nickname, optional channel and password handling in one form. Save returns to the destination list. Save & connect saves first and then opens the console. Leaving unsaved edits requires an explicit discard choice. Blank saved passwords retain their existing meaning; the explicit removal control clears them. Delete requires confirmation and never removes the identity. +- **Console** shows the actual current room, participant mixer, conversation and voice panel. The room strip contains only the current and recently visited rooms, capped at four. The complete hierarchy is in All channels. Mixer and compact layouts share playback volume state. +- **Channels** provides ordered hierarchy, parent paths, occupancy, current-room and password labels, and search by room or participant. Selection previews the topic and participants in a separate panel. Previewing does not move the user. A denied join retains current audio; a successful channel change turns audio off. Phone selection brings the preview into view. +- **Private conversations** have a participant/thread list, message pane and recipient playback/poke controls. Selecting a participant binds the recipient to their current ID and UID. Incoming messages have unread counts. Reconnection invalidates recipient bindings; they must be selected again. Returning to the console restores channel conversation scope. Phone participant controls expand separately. +- **Identity** provides distinct creation/import choices for a new account and stored-identity/backup actions once an identity exists. +- **Audio**, **Presence** and **Diagnostics** are individual pages. Navigation does not disconnect the server or reset audio. An active-session ribbon exposes connection/audio state and microphone muting while outside the console. + +Browser Back/Forward follows the page routes. Hashes contain page names only; credentials and destinations are not placed in URLs. Editor secrets clear on leaving the editor. Sign-out clears temporary audio, messages, recipients, unread counts and private fields. Messages remain bounded and are not automatically resent. Drafts are kept separately by conversation in bounded page memory, so a private draft never appears in channel chat. They clear on sign-out or a manual server change. + +## Assets and responsive behavior + +The console palette, locally hosted IBM Plex fonts and exported 22 × 22 microphone/headphone SVGs are retained. Font licenses remain in `public/fonts/OFL.txt`. + +Phone layouts adapt the flows: destination actions stay visible, the complete connection form precedes save actions, channel results have bounded scrolling, participant cards become compact rows, and the console keeps accessible voice controls. Notifications are dismissible. All server, room, participant and account data are dynamic; simulation data is confined to local verification fixtures. + +## Verification limits + +Automated coverage includes large channel lists, hierarchy/participant search, bounded recent-room navigation and route validation, together with the protocol, storage, audio and account regression tests. Browser checks use a disposable simulated backend with 123 channels. They cover direct connections, saving/editing, discard/cancel, channel previews and joins, preserved listening after a denied join, private messaging, audio preferences and phone layouts. + +These UI checks do not establish new real microphone/device or TeamSpeak interoperability results. See `AUDIO.md`, `TESTING.md` and `FEASIBILITY.md` for those limits. diff --git a/docs/FEASIBILITY.md b/docs/FEASIBILITY.md new file mode 100644 index 0000000..7cb329c --- /dev/null +++ b/docs/FEASIBILITY.md @@ -0,0 +1,22 @@ +# Feasibility and verification scope + +A private owner-operated Vercel deployment demonstrated the following before the public-source cleanup. Raw account screenshots, private deployment URLs/IDs, destination details, UIDs and session evidence are kept outside the public source. + +| Area | Observed result | Limits | +| --- | --- | --- | +| Binary WebSocket / outbound UDP | Bidirectional binary transport and validated non-DNS STUN responses | Historical transport experiments; their product endpoints were removed during cleanup | +| Native runtime | Linux x64 Node 22 deployment build and native execution; local macOS build | Re-verify your account/runtime; no universal hosting claim | +| Full TS3 session | Real handshake, authentication, channel and participant synchronization | Existing unmodified authorized TS3 server; newer server features are separate | +| Identity and settings | Same encrypted identity across sign-ins/redeployments; durable encrypted preferences | Production restore/key-rotation drills are not certified | +| Opus | Browser/native peer exchanged generated audio through the real server; nonzero decode/playback energy | No microphone permission requested; local hardware output stayed silent; real capture/browser audibility unverified | +| Recovery | Recovered after the 240-second native cap and deliberate socket loss; identity unchanged and audio off | Roughly 8.5 seconds at cap and 41 seconds after the dropped socket in one final run, including lease expiry; no actual process-kill/server-restart attribution | +| Permissions | Server denied private messages for the test identities | No successful live messaging pass; permissions were preserved | +| Browser rendering | Literal markup-like names/text in an isolated local simulated fixture | Simulation is UI integration evidence, not real messaging interoperability | + +The subsequent public-source cleanup replaces environment-based connection defaults and browser-held reconnect credentials with encrypted backend settings and an opaque settings reference. It also removes the superseded echo/STUN product experiments and production test-tone controls. Its current test results are described in [testing](TESTING.md); changes validated locally are not automatically a new production verification pass. + +The architecture uses an owner-controlled native Function adapter, not ServerQuery, a vendor gateway, a VPS or a desktop companion. No hard platform prohibition was proven in the tested configuration. Finite Function lifetime still interrupts audio. Local source now supports restoring listening and opt-in microphone recovery; deployment and real-device verification of that change are separate. Comprehensive official-client parity, hardware/browser certification and uninterrupted conversation remain unfinished. See the [feature matrix](FEATURE_MATRIX.md). + +Relevant primary platform references: [WebSocket Functions](https://vercel.com/docs/functions/websockets), [Function limitations](https://vercel.com/docs/functions/limitations). Check current documentation and actual account behavior before deploying; historical observations do not override platform changes. + +The subsequent multi-user milestone adds registration, account-bound sessions, per-user encrypted records and independent protocol leases. Local tests include separate real native identity generation/export and simultaneous simulated protocol sessions. A production deployment on 2026-11-01 passed two-account registration, distinct native identity creation, connection/bookmark isolation, authenticated WebSocket heartbeat and independent logout/persistence checks, with legacy owner continuity preserved. Real multi-user voice/capacity remains unverified. See [accounts and rollout](MULTIUSER.md). diff --git a/docs/FEATURE_MATRIX.md b/docs/FEATURE_MATRIX.md new file mode 100644 index 0000000..e655e57 --- /dev/null +++ b/docs/FEATURE_MATRIX.md @@ -0,0 +1,27 @@ +# Feature matrix + +Statuses distinguish implemented code, observed private-deployment results and pending verification. The public-source cleanup changes connection storage and removes old experiment endpoints; it is not automatically a new production certification. + +| Capability | Status / scope | +| --- | --- | +| Registration/login, account isolation, origin/CSRF, revocation | Implemented; local isolation/concurrent simulated session tests and production two-account registration/settings/identity/WebSocket/logout checks; real concurrent native voice/capacity unverified | +| Durable encrypted TS3 identity | Persistence demonstrated across sign-ins/redeployments; import/export/rotation tested locally; official-client restore drill pending | +| Backend connection settings and bookmarks | Implemented; encrypted/redacted, stale-edit and destination isolation tests; cleanup flow verified locally | +| Real TS3 connection / synchronized channels and participants | Demonstrated in a private Vercel deployment | +| Channel/participant search and previews | Implemented; browser checks with real and simulated state | +| Channel movement / subscriptions | Implemented; password-protected self-movement verified; server permissions apply | +| Nickname and away/return | Implemented; previous production server acknowledgements verified | +| Opus send/receive | Generated two-way network audio demonstrated; actual microphone/audible browser conversation unverified | +| PTT, VAD, microphone/output mute, per-user volume | Implemented with codec/worker/lifecycle tests; comprehensive live device verification pending | +| Speaking indicators and bounded queues | Implemented; worker tests and browser integration checks; broader live multi-speaker testing pending | +| Private/channel/server text, poke | Typed acknowledged controls implemented; private live test was server-denied; successful real messaging/poke interoperability remains unverified | +| Responsive workspace and themes | Implemented; partial in-app Chromium narrow/desktop checks; comprehensive accessibility/mobile/browser testing pending | +| Automatic recovery | Native-cap/socket-drop recovery demonstrated; identity retained and audio muted; actual Function kill/server restart unverified | +| Durable connection history / quality metrics | Planned; worker loss counters are not a full TS3 quality dashboard | +| Whisper / advanced routing / concurrent servers | Planned | +| Channel management / moderation / groups / permissions | Planned | +| File browsing/transfer/management | Planned | +| Rich profiles, icons, avatars, badges | Planned | +| Video, screen sharing, newer protocols / proprietary accounts | Separate investigation; no compatibility claim | + +A custom client grants no additional server privileges. No control is represented as verified merely because it builds or passes a simulated fixture. The [implementation plan](../IMPLEMENTATION_PLAN.md) remains unfinished. diff --git a/docs/IDENTITY.md b/docs/IDENTITY.md new file mode 100644 index 0000000..1739e8d --- /dev/null +++ b/docs/IDENTITY.md @@ -0,0 +1,36 @@ +# Persistent TeamSpeak identity + +The native child inside the owner's Node Function uses tsclientlib to generate a real P-256 TeamSpeak identity and security-level offset, and to sign protocol packets. Node persists each private identity in its account-scoped Redis record (the legacy owner retains `voxharbor:identity:v1:owner`), encrypted with AES-256-GCM and a fresh random 96-bit nonce per write. The envelope has a version, key ID, ciphertext and authentication tag. AAD binds the record to its purpose, account and key ID. Legacy owner associated data remains unchanged. + +`IDENTITY_ENCRYPTION_KEY` is a separate 32-byte deployment secret. It is not derived from `SESSION_SECRET`, stored in Redis, inherited by the native child, or sent to the browser. Node decrypts the identity and gives it to the child through private stdin for signing. Those trusted backend components can access private material while active. Ordinary authenticated API responses expose only the signed-in account’s UID, security level and creation time. + +Creation/import requires an explicit authenticated, same-origin, CSRF-protected owner action. Atomic create-if-absent prevents concurrent replacement. Storage errors are distinct from missing records; decryption errors stop the operation without regenerating an identity. Counter upgrades must preserve both the private key and UID. + +One live protocol session per account is allowed in this milestone. An account-scoped Redis lease renews every ten seconds and expires after 35 seconds if abandoned. Socket closure, account logout/expiration, or lease failure stops the child. Sessions have a deliberate 240-second cap before the configured 300-second Function boundary. Automatic full-protocol recovery at that cap and after an abrupt socket drop is verified in production, as is two-way synthetic Opus through the real server. Actual microphone capture remains unverified. Recovery reuses the identity and loads the current encrypted connection record on the backend through an opaque settings ID. It checks account authentication again and keeps audio muted. Changing connection settings invalidates older recovery IDs. The experimental audio pipeline starts muted and requires explicit user actions. + +## Local development + +`npm run identity:key` adds a separate key to `.env.local` once, preserving a valid existing value and refusing to silently replace an invalid one. The development web app uses the explicitly volatile memory store unless configured with Redis; its identity will not survive process replacement in that mode. Production rejects volatile storage. Never upload `.env` or `.local` files. + +## Backup and recovery + +**Export private identity** makes an owner-initiated POST with CSRF and downloads a TeamSpeak-style INI containing a compatible obfuscated identity string. Obfuscation is not encryption; secure that backup. The library export/import round trip preserves UID and level in tests. Direct import into the official client remains unverified. + +For infrastructure recovery, back up Redis ciphertext and its encryption secret separately. Both are required. Keep the encryption secret stable across redeployments, Functions and sign-ins. Rotating the login password/session secret revokes sessions without changing the TeamSpeak identity slot. + +When storage is unavailable, restore it before reconnecting. When decryption fails, restore the correct secret and ciphertext. Do not generate a new identity to hide the failure; the creation route refuses to replace existing records. + +## Deliberate encryption-key rotation + +1. Securely back up the current ciphertext and key. +2. Set the new `IDENTITY_ENCRYPTION_KEY` and old `IDENTITY_PREVIOUS_ENCRYPTION_KEY`, then redeploy. +3. As the authenticated owner, POST `/api/identity/rotate` and `/api/preferences/rotate` with the current CSRF header and exact allowed Origin. These authenticate and atomically re-encrypt each record under the new key, preserving the identity key/UID and saved connections. Keep both encryption keys configured if either operation fails. +4. Repeat rewrapping and verification for every account, including dormant accounts, before retiring an old key. The endpoints affect only the signed-in account. Keep both keys until every identity/preference record is rewrapped. Verify UID, connectivity and reopening saved connections; then remove the previous-key variable, redeploy, and retire older deployments retaining old environment values. + +Rotation is covered locally; production rotation and restore drills remain pending. Raw keys, import/export contents, passwords, private messages and voice contents remain excluded from logs. + +## Saved connection encryption + +The client workspace also encrypts owner preferences, current connection settings and bookmarks with the separate identity encryption key, using independent nonces and purpose-specific associated data. Identity and preference records remain separate. During key rotation, keep `IDENTITY_PREVIOUS_ENCRYPTION_KEY` until both records have been rewrapped and verified: use the existing owner-authenticated identity rotation action and POST `/api/preferences/rotate` with the same session/CSRF protection. Verify identity metadata and reopening saved connections before retiring the old key. Do not remove an old key after rewrapping only the identity. See WORKSPACE.md for bookmark credential access and clearing behavior. + +See [multi-user storage and key rotation](MULTIUSER.md). The trusted operator controls the shared encryption key; user isolation does not imply encryption from that operator. diff --git a/docs/MANUAL_DEPLOYMENT.md b/docs/MANUAL_DEPLOYMENT.md new file mode 100644 index 0000000..5cf19df --- /dev/null +++ b/docs/MANUAL_DEPLOYMENT.md @@ -0,0 +1,13 @@ +# Manual deployment + +Use the complete [deployment guide](DEPLOYMENT.md) for variables and platform constraints. + +```sh +npm run deployment:package +``` + +Upload the generated folder to the intended project in your Vercel account. The allowlist excludes `.env.local`, `.local`, identities, private evidence, editor metadata, dependencies, local binaries and Git metadata. A source manifest records SHA-256 hashes. Build Linux native code on Vercel instead of copying a development binary. + +Preserve existing secrets and encrypted records. Never rotate credentials merely to update source. After deployment, sign in as `owner` with the existing password, verify legacy continuity, then test two separate registered accounts and independent logout. See [multi-user rollout](MULTIUSER.md). In each account, open your backend-saved connection, verify identity continuity and test only an authorized destination. No hardcoded test server, channel, password, UID or account is required. + +Git operations are separate from this upload workflow. See [public repository preparation](PUBLICATION.md) before publishing source. diff --git a/docs/MULTIUSER.md b/docs/MULTIUSER.md new file mode 100644 index 0000000..bf87976 --- /dev/null +++ b/docs/MULTIUSER.md @@ -0,0 +1,31 @@ +# Accounts and private workspaces + +VoxHarbor supports username/password registration on one operator-controlled deployment. Each account has its own TeamSpeak identity, nickname, encrypted current connection, bookmarks, preferences and active protocol lease. Accounts are application accounts, not TeamSpeak/vendor accounts. Server permissions still apply. + +## Sign in or register + +Choose **Create an account**, enter a username and a password, and confirm the password. Usernames contain 3–32 ASCII letters, numbers, underscores or hyphens, starting with a letter or number. They are case-insensitive and stored lowercase. Passwords contain 16–256 characters and are stored as independently salted scrypt hashes. Registration signs in with a fresh opaque HttpOnly session cookie. Create/import a TeamSpeak identity in your private workspace once; the application never silently creates a replacement identity. + +There is no email collection, email verification, password reset, account deletion UI or MFA in this milestone. Keep your password and private identity backup secure. Registration limits and generic login failures follow the principles in the [OWASP authentication guidance](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html). Username availability is observable through registration; usernames are not treated as private email addresses. + +## Existing deployment compatibility + +The reserved username **owner** uses the existing `OWNER_PASSWORD_HASH`. Existing password-only API login requests remain supported for this account; the browser uses an explicit username. Pre-account owner sessions continue to access only the legacy owner workspace. Existing owner identity/settings records keep their original storage keys, encryption associated data and ciphertext; no migration or key change is needed. Registration can never claim `owner`, even when no owner password is configured. The legacy owner login does not gain an application route to other users' records. + +New accounts have random immutable IDs, separate from usernames. Account records are atomically created at `voxharbor:account:v1:`; each contains its ID, canonical username, password hash and creation time. Account IDs are not accepted from browser requests to choose a workspace. Sessions contain the authenticated account ID and username; the account record is checked again on authenticated requests and active WebSocket revalidation. Missing/corrupt account storage fails closed. + +## Storage and encryption boundaries + +New users' application records, leases and authenticated rate counters are prefixed by `voxharbor:user:v1::`. The identity/preference envelope's associated data also includes that account ID, so moving ciphertext between accounts cannot decrypt successfully. A shared deployment encryption key is still required; the trusted operator and backend have access to decrypted material while processing a user's request. This is encryption at rest, not end-to-end encryption from the operator. + +Only authenticated metadata exposes the current user's UID and connection fields; passwords remain backend-only. Export/import/rotation routes always operate on the session's workspace. Connection IDs from another account cannot select its saved settings. Each account can hold one live native session; separate users have separate leases and may connect concurrently. One account's logout revokes only its presented browser session and stops that session's sockets. Replacing a browser login revokes its previous session. Other tabs receive a sign-in-change notification and clear their workspace. + +## Operator configuration and rollout + +`ALLOW_REGISTRATION=1` enables public signup and is the default. Set `ALLOW_REGISTRATION=0` to close new signups while preserving existing accounts' sign-in. Registration also requires `IDENTITY_ENCRYPTION_KEY`. `OWNER_PASSWORD_HASH` is optional for new account-based deployments; preserve it unchanged on existing installations. Production still requires HTTPS, a stable session secret and durable Redis; the development memory store loses all accounts and their data when the process stops. + +This source change does not modify private environment values, touch existing Redis data or deploy automatically. Before rollout, back up existing ciphertext and its encryption key separately. Verify the legacy owner UID and saved connections, register two disposable test accounts, check identity/connection separation, concurrent protocol sessions, independent logout and persistence across replacement of the deployed application. On 2026-11-01, production checks verified two-account registration, separate native identities/settings, authenticated WebSockets, independent logout and persistence after sign-in, while the legacy owner identity/settings matched a private pre-deployment baseline. Real concurrent TeamSpeak/voice sessions and hosting cost/capacity still need separate verification. Previous single-owner protocol verification is not multi-user voice certification. + +Global limits currently allow 10 registration requests and 120 login requests per minute, with a shared per-username limit of 10 authentication requests per minute. Authenticated settings/identity/socket and connect limits are scoped per account. These limits bound an initial rollout; there is no verified capacity guarantee, billing quota system or bot challenge. Closing signup does not disconnect existing accounts. + +For encryption-key rotation, every account's identity and preferences must be rewrapped and verified, including the legacy owner. The existing per-account rotation endpoints affect only the signed-in account. Keep the previous key until **all** records have been rewrapped; rotating only the owner and then removing the old key would strand other accounts. Account password hashes do not use the identity encryption key. Rotating `SESSION_SECRET` revokes all application sessions without changing account records or TS3 identities. diff --git a/docs/PUBLICATION.md b/docs/PUBLICATION.md new file mode 100644 index 0000000..9665133 --- /dev/null +++ b/docs/PUBLICATION.md @@ -0,0 +1,27 @@ +# Preparing a public repository + +Intended destination: [MeghdadFadaee/VoxHarbor](https://github.com/MeghdadFadaee/VoxHarbor). Original project code is MIT licensed; third-party notices remain separate. + +```sh +npm run check +npm test +npm run publication:check +npm run publication:package +``` + +The checker reads current source and Git's tracked/unignored candidates, including staged content. It flags private paths, known local secret values (without printing them), credential/private-key formats, personal filesystem paths, private deployment URLs and files outside the source allowlist. Intentional published upstream crypto fixtures are distinguished from local secrets. The unchanged, hash-pinned upstream Opus artifact contains compiler paths from its original build; its provenance is recorded alongside the artifact. Known local secrets and this project’s filesystem path are still checked in every file, including vendored code. A generated source manifest records hashes for review. + +The exported folder contains no Git history or metadata. Keep `.env.local`, `.local`, editor settings, dependencies, binaries, raw verification records/screenshots and identity backups out of the public repository. The cleanup privately archives old instance-specific material under `.local/private-archive/`; do not upload that directory. Examples and synthetic test fixtures are not real connection settings. + +A scanner is not a guarantee. Review the exact files you stage and any existing Git history. If credentials ever entered history, removing a working file or adding an ignore rule is insufficient: revoke affected credentials and perform a deliberate history cleanup before publication. An empty history avoids that historical exposure, but still inspect the first commit. + +## Owner publication steps + +Git and GitHub operations are intentionally not automated by these scripts. If your workflow requires read-only Git/GitHub access for the coding agent, you must perform the final operations yourself: + +1. Create or verify the intended public GitHub repository. Avoid adding a conflicting initial README/license when the local source is ready. +2. Review `git status`, then stage only reviewed files. Inspect `git diff --cached --stat` and `git diff --cached`; run `npm run publication:check` again so staged bytes are checked too. +3. Commit the reviewed source, set/verify the remote destination, and push it yourself. Do not force-push or rewrite existing history casually. +4. Confirm repository visibility, licensing and that no private configuration/evidence was included. + +The clean export is also suitable for starting a separate fresh publication checkout if desired. It is not a reason to upload private local folders or bypass audit findings. The `private: true` flag in package.json prevents accidental npm-registry publication; it does not make a GitHub repository private. diff --git a/docs/TESTING.md b/docs/TESTING.md new file mode 100644 index 0000000..9c6e8fd --- /dev/null +++ b/docs/TESTING.md @@ -0,0 +1,41 @@ +# Testing + +Run `npm ci`, `npm run native:build`, `npm run check` and `npm test`. Automated tests use synthetic credentials, temporary directories, local sockets and simulated native fixtures; they do not contact public TeamSpeak servers. Native identity endpoint tests require the built executable. Mock fixtures are not real server compatibility evidence. + +`npm run audio:qa` starts a local silent AudioWorklet/Opus test with deliberately missing packets. It requests no microphone, sends no audio to a server and emits silence to local hardware. Close it after testing. + +`node scripts/workspace-render-fixture.mjs` starts a clearly labelled local simulated workspace. Sign in as `owner`; its fixture-only password is in that source. It uses an ephemeral synthetic identity payload, no real TS3 network, and volatile storage. Test message/name markup remains literal text. Enter `quit` to remove its temporary executable and stop it. It is forbidden in production. + +For an authorized deployment, configure the connection through its owner UI first. These optional scripts require an explicit HTTPS origin and hidden owner password: + +```sh +node scripts/verify-public-deployment.mjs https://your-project.vercel.app +node scripts/verify-production-protocol.mjs https://your-project.vercel.app 45 .local/protocol-result.json +node scripts/verify-recovery.mjs https://your-project.vercel.app 350 .local/recovery-result.json +``` + +They use the backend-saved connection, do not create/replace an identity, keep audio muted and revoke their own verification sessions. Results may contain private instance metadata: keep them under `.local`, not in a public issue or commit. Do not run concurrent native verification sessions against the same owner lease. + +Real voice testing needs another authorized client and a suitable channel whose participants expect testing. Record outcomes/counters, not audio/chat contents. Verify microphone permission, audible receive/send, mute/deafen, denied talk power, devices, multiple speakers, background behavior and reconnects separately. Never infer hardware/browser compatibility from codec tests. + +The current cleanup is tested locally; it has not been redeployed automatically. Previous production observations are summarized without private account/destination data in [FEASIBILITY.md](FEASIBILITY.md). + +## Public-source cleanup verification + +On 2026-10-31, JavaScript syntax checks and all 80 automated tests passed, with no skips. The macOS native release build passed. A disposable simulated workspace verified saving and reloading connection metadata while password inputs remained empty and backend-saved password indicators persisted; browser error logs were empty. The silent browser audio test passed with three simulated speakers, nonzero decoded/playback energy, deliberate packet loss handling and stopped transmission after PTT release. These are local checks, not a deployment or real microphone test. + +Account tests cover atomic case-insensitive registration, reserved-owner compatibility, password hashing, session/account binding, ciphertext substitution rejection, independent identity/settings/bookmark/lease/rate scopes, HTTP origin/CSRF, cross-account connection IDs, simultaneous simulated native sessions and independent logout. These do not establish multi-user production capacity. + +## Multi-user milestone verification + +On 2026-11-01, syntax checks and all 90 automated tests passed, with no skips. New registered accounts generated different real native identities; exports restored to the correct account UID. Browser verification in a disposable volatile fixture confirmed registration, separate identities/bookmarks/default nicknames, restoration after sign-in and cross-tab logout cleanup, with no browser errors. No private environment, existing Redis or actual TeamSpeak server was used in these account tests. + +## Production account rollout + +On 2026-11-01, the Linux native release build and public HTTP/WebSocket access gates passed after deployment. Two new test accounts registered, generated distinct native identities, retained isolated connections/bookmarks/nicknames, rejected a cross-account connection reference, used authenticated WebSockets, logged out independently and retained identity/settings after signing in again. The legacy owner UID and saved preference digest matched a private baseline from before deployment. Reports and encrypted test-account credentials remain private under `.local`. These checks made no TeamSpeak server connections and transmitted no audio; real multi-user voice and capacity remain unverified. + +## Audio recovery and connection diagnostics + +The local suite now has 96 passing tests. Recovery tests cover listening/device restoration, microphone opt-in and opt-out, repeated disconnect notifications, muted/background state, cancellation during initialization, automatic-resume failures and diagnostics redaction. Transport fixtures distinguish the native session cap, heartbeat timeout, socket close duration and retry timing. A disposable browser fixture verified the recovery checkbox and sign-out reset without microphone access or TeamSpeak traffic. These are automated and UI checks, not a real microphone recovery pass. + +The audio-recovery update was deployed on 2026-11-01. All six changed browser entry/module assets matched the tested source on the public domain, and public authentication/origin/WebSocket gates passed. Actual microphone recovery remains unverified. diff --git a/docs/WORKSPACE.md b/docs/WORKSPACE.md new file mode 100644 index 0000000..cd83fe7 --- /dev/null +++ b/docs/WORKSPACE.md @@ -0,0 +1,25 @@ +# Workspace and connection storage + +The destinations page opens after sign-in. The console shows the current and recently visited rooms, participant playback controls, conversation scopes and a separate voice panel. The full searchable hierarchy and room previews have a dedicated Channels page. Connection editing, private conversations, identity, presence, diagnostics and audio each have a separate page. There are no demonstration people/messages in the product. The default appearance follows the dark console design, with an explicitly saved light theme still supported. See [design implementation](DESIGN_IMPLEMENTATION.md). + +## Backend-owned connections + +Each user enters a server, voice port, nickname, optional channel and passwords. **Connect** performs an authenticated same-origin CSRF-protected `POST /api/connection`, encrypts the settings, then opens the protocol socket using only the returned opaque connection ID. Native reconnects load those settings from the backend; the browser reconnect controller holds no destination credentials. A stale connection ID cannot silently select settings saved by another session. + +Settings/bookmarks use a per-account Redis namespace. The legacy owner retains `voxharbor:preferences:v1:owner`; new accounts add their immutable account prefix and encryption associated data. See [account isolation](MULTIUSER.md). AES-256-GCM uses the separate identity encryption key, independent random nonces and purpose-specific associated data. Identity and preference ciphertext remain separate. Wrong keys/corruption fail closed; unreadable records are never replaced with defaults. The explicit development memory store is volatile. + +Ordinary metadata includes only password-presence flags. Opening a bookmark fills public connection fields and passes its ID when connecting; bookmark passwords are resolved on the backend and are never returned by a bookmark credential endpoint. Empty password inputs preserve a current password only for the same server/channel, or select the bookmarked credential. Passwords never follow an edited destination to another server. Use the explicit clear-password control to remove current saved credentials. + +Acknowledged nickname/channel changes update the backend connection for recovery. A storage failure after a successful server action is reported separately; the action is not replayed. Bookmark/theme edits use revision checks and preserve omitted secrets. No connection data is stored in localStorage; only the non-sensitive theme is cached there. + +## Commands and safety + +Typed channel join/subscription, nickname, away, text and poke actions have bounded input and correlated server acknowledgements. Arbitrary protocol names/arguments are rejected. Timeouts and disconnects never automatically resend messages/actions. Private recipients are bound to their public UID when available; channel messages are bound to the channel observed by the user, so reused client numbers or a concurrent move cannot redirect a message silently. + +Messages are literal DOM text, bounded to 200 entries in browser memory, and cleared on logout. They are not saved or logged. Diagnostic downloads exclude names, messages, audio, credentials and private keys. Device changes, hidden pages, disconnection and logout stop transmission. Automatic reconnection can restore listening and an explicitly opted-in, previously enabled microphone. Manual disconnect/sign-out clears recovery, and hiding the page cancels pending recovery. Choices live only in the signed-in page; browser restrictions can still require manual audio enablement. See [audio behavior and diagnostics](AUDIO.md). + +## Destination policy + +The backend validates every connection. It resolves only allowed public IPv4 destinations, rejects private/reserved/metadata addresses and mixed DNS answers, and passes a pinned numeric address to native code. A bookmark is not permission to bypass these checks. The current voice-port policy is 1024–65535. The application is authenticated and operator-hosted; it is not an unauthenticated proxy. + +The full [feature matrix](FEATURE_MATRIX.md) remains open. The old production synthetic-tone UI and instance-specific live-test scripts were removed; use the separate silent browser fixture or an authorized two-client manual audio test. diff --git a/native/Cargo.lock b/native/Cargo.lock new file mode 100644 index 0000000..0052c10 --- /dev/null +++ b/native/Cargo.lock @@ -0,0 +1,3883 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloca" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" +dependencies = [ + "cc", +] + +[[package]] +name = "alsa" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d" +dependencies = [ + "alsa-sys", + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "audiopus" +version = "0.3.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab55eb0e56d7c6de3d59f544e5db122d7725ec33be6a276ee8241f3be6473955" +dependencies = [ + "audiopus_sys", +] + +[[package]] +name = "audiopus_sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62314a1546a2064e033665d658e88c620a62904be945f8147e6b16c3db9f8651" +dependencies = [ + "cmake", + "log", + "pkg-config", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "aws-lc-rs" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048006790404103c488e6c5616b3e7e702a71292aadda08e8f7698a9e0d2eb53" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bfbe32ac36b3c428696ce315464181bc4029d689fd58e3f2a4e58c252242f52" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", + "pkg-config", +] + +[[package]] +name = "az" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "clap_lex" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest 0.10.7", +] + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "coreaudio-rs" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58" +dependencies = [ + "bitflags", + "libc", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "cpal" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f02e8d0327b42d3e2e4ab2119af397344eb9fc54a34bf0ddeaa1277af8681f1" +dependencies = [ + "alsa", + "block2", + "coreaudio-rs", + "dasp_sample", + "jni", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "objc2", + "objc2-audio-toolbox", + "objc2-avf-audio", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", + "web-sys", + "windows", + "windows-core", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "criterion" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" +dependencies = [ + "alloca", + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "itertools 0.13.0", + "num-traits", + "oorandom", + "page_size", + "plotters", + "rayon", + "regex", + "serde", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" +dependencies = [ + "cast", + "itertools 0.13.0", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "csv" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde_core", +] + +[[package]] +name = "csv-core" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" +dependencies = [ + "memchr", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "dbl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" +dependencies = [ + "generic-array", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "eax" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9954fabd903b82b9d7a68f65f97dc96dd9ad368e40ccc907a7c19d53e6bfac28" +dependencies = [ + "aead", + "cipher", + "cmac", + "ctr", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "env_filter" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d271a03799a1ee8d1ca9b19893b48ca674a9284fefcfb85f05e74ed314217" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de671bd27a75a797dc9ae289ba1e77276e75e2026408aab65185384e2d5cd3f6" +dependencies = [ + "env_filter", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "git-testament" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a74999c921479f919c87a9d2e6922a79a18683f18105344df8e067149232e51" +dependencies = [ + "git-testament-derive", +] + +[[package]] +name = "git-testament-derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbeac967e71eb3dc1656742fc7521ec7cd3b6b88738face65bf1fddf702bc4c0" +dependencies = [ + "log", + "proc-macro2", + "quote", + "syn 2.0.119", + "time", +] + +[[package]] +name = "gmp-mpfr-sys" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7db155b537cb791b133341f99f68371d86ee7fa4c79aacfbc376d72d23c70531" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hickory-net" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c480823ed7c2c5d0f09c41020cb6b7c28029ce60ec42dc942158dcf22f8e0a4d" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "futures-channel", + "futures-io", + "futures-util", + "hickory-proto", + "idna", + "ipnet", + "jni", + "rand 0.10.3", + "thiserror 2.0.21", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-proto" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b92608f679a6fa515dd1d15c1ff89443026e391200a2c840c7afcba482893d" +dependencies = [ + "data-encoding", + "idna", + "ipnet", + "jni", + "once_cell", + "prefix-trie", + "rand 0.10.3", + "ring", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3da5255c95d5a716857d54b5b8f4e8d67c3484d3beaaaae2ce25063b3ba981" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-net", + "hickory-proto", + "ipconfig", + "ipnet", + "jni", + "moka", + "ndk-context", + "once_cell", + "parking_lot", + "rand 0.10.3", + "resolv-conf", + "smallvec", + "system-configuration", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipconfig" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222" +dependencies = [ + "socket2", + "widestring", + "windows-registry", + "windows-result", + "windows-sys 0.61.2", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" +dependencies = [ + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moka" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4293f18e7567a1caf3c584855554377025c65e0aa445344d04171f5ad63d19b9" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "equivalent", + "parking_lot", + "portable-atomic", + "smallvec", + "tagptr", + "uuid", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-audio-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" +dependencies = [ + "bitflags", + "libc", + "objc2", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-avf-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be" +dependencies = [ + "bitflags", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" +dependencies = [ + "dispatch2", + "objc2", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-audio-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "block2", + "dispatch2", + "libc", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "omnom" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66562a92c66d5937e9d549597c2d3cafe3d2367dd08dc257da730587c2cfc218" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl-probe" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plotters" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" + +[[package]] +name = "plotters-svg" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prefix-trie" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf6e3177f0684016a5c209b00882e15f8bdd3f3bb48f0491df10cd102d0c6e7" +dependencies = [ + "either", + "ipnet", + "num-traits", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quickcheck" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95c589f335db0f6aaa168a7cd27b1fc6920f5e1470c804f814d9cd6e62a0f70b" +dependencies = [ + "env_logger", + "log", + "rand 0.10.3", +] + +[[package]] +name = "quickcheck_macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a28b8493dd664c8b171dd944da82d933f7d456b829bfb236738e1fe06c5ba4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "quicklz" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "750eab265a26a0cd064f2a2b222bf172cc06d7a873e113e5f6d0118cc6e5fbb1" +dependencies = [ + "bit-vec", + "byteorder", + "thiserror 1.0.69", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.3", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "resolv-conf" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rug" +version = "1.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07a8857882aec59d27254b02481c709327c13de6fad1da60bfc4f9783eaaa61e" +dependencies = [ + "az", + "gmp-mpfr-sys", + "libc", + "libm", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simple_asn1" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.21", + "time", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "t4rust-derive" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e411692d6e0c8ce07f65a8210e95dcfb56cc4600940456592a49a3579ef6396" +dependencies = [ + "nom", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ts-bookkeeping" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "criterion", + "heck", + "itertools 0.14.0", + "num-derive", + "num-traits", + "once_cell", + "serde", + "t4rust-derive", + "thiserror 2.0.21", + "time", + "tracing", + "tracing-subscriber", + "tsproto-packets", + "tsproto-structs", + "tsproto-types", +] + +[[package]] +name = "tsclientlib" +version = "0.2.0" +dependencies = [ + "anyhow", + "audiopus", + "base64 0.22.1", + "clap", + "cpal", + "futures", + "git-testament", + "hickory-net", + "hickory-resolver", + "itertools 0.14.0", + "num-traits", + "once_cell", + "pin-utils", + "quickcheck", + "quickcheck_macros", + "rand 0.10.3", + "reqwest", + "thiserror 2.0.21", + "time", + "tokio", + "tokio-stream", + "tracing", + "tracing-subscriber", + "ts-bookkeeping", + "tsproto", + "tsproto-packets", + "tsproto-types", + "url", +] + +[[package]] +name = "tsproto" +version = "0.2.0" +dependencies = [ + "aes", + "anyhow", + "base64 0.22.1", + "clap", + "criterion", + "curve25519-dalek-ng", + "eax", + "futures", + "generic-array", + "git-testament", + "num-bigint", + "num-derive", + "num-traits", + "omnom", + "once_cell", + "pin-project-lite", + "quicklz", + "rand 0.10.3", + "rug", + "serde", + "sha-1", + "sha2", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "tracing-subscriber", + "tsproto-packets", + "tsproto-types", +] + +[[package]] +name = "tsproto-packets" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "bitflags", + "num-derive", + "num-traits", + "omnom", + "self_cell", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "tsproto-structs" +version = "0.2.0" +dependencies = [ + "base64 0.22.1", + "csv", + "heck", + "once_cell", + "serde", + "toml", +] + +[[package]] +name = "tsproto-types" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "bitflags", + "curve25519-dalek-ng", + "elliptic-curve", + "generic-array", + "heck", + "num-bigint", + "num-derive", + "num-traits", + "p256", + "rand 0.8.8", + "ref-cast", + "serde", + "sha-1", + "simple_asn1", + "t4rust-derive", + "thiserror 2.0.21", + "time", + "tsproto-structs", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "voxharbor-protocol" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "futures", + "serde", + "serde_json", + "tokio", + "tsclientlib", + "tsproto", + "tsproto-packets", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/native/Cargo.toml b/native/Cargo.toml new file mode 100644 index 0000000..02192e2 --- /dev/null +++ b/native/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "voxharbor-protocol" +version = "0.1.0" +edition = "2021" +publish = false +license = "MIT" +repository = "https://github.com/MeghdadFadaee/VoxHarbor" + +[workspace] + +[dependencies] +tsclientlib = { path = "vendor/tsclientlib/tsclientlib", default-features = false, features = ["raw-audio"] } +tsproto-packets = { path = "vendor/tsclientlib/utils/tsproto-packets" } +tsproto = { path = "vendor/tsclientlib/tsproto" } +base64 = "0.22" +futures = "0.3" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tokio = { version = "1", features = ["io-std", "io-util", "macros", "rt-multi-thread", "time"] } + +[profile.release] +strip = true +lto = "thin" +codegen-units = 1 diff --git a/native/README.md b/native/README.md new file mode 100644 index 0000000..ba158a1 --- /dev/null +++ b/native/README.md @@ -0,0 +1,15 @@ +# Native TS3 adapter + +This executable implements a bounded private newline-JSON protocol for the owner's Node backend. It uses the pinned ReSpeak tsclientlib client stack for identity signing, handshake, encryption, transport and synchronized state. Identity material passes through private stdin, never deployment-secret environment variables or logs. + +```sh +npm run native:build +``` + +The build uses Cargo's lockfile and release profile, then packages the current platform executable under ignored `native/bin/`. Vercel builds its own Linux executable; do not commit or upload a local binary. Compiler/download setup is in `scripts/build-native.mjs` and `scripts/bootstrap-rust.sh`. No project Git mutation is involved. + +The owner configures the destination and credentials in the signed-in app. The backend decrypts stored settings, validates/pins a public numeric address, and supervises one native session with bounded stdio, timeout and lease ownership. There is no default test server in native code. The adapter does not write server files or private identity backups to disk. + +Vendor provenance, exact source/declaration revisions, archive digests and local patches are in `vendor/provenance.json`. Retain the original MIT/Apache licenses. `raw-audio.patch` exposes encoded packets without native codec defaults. `bounded-reordering.patch` provides bounded 2048-ID command reordering and duplicate suppression while retaining packet authentication/encryption and ordering. Its native regression tests cover burst, duplicates, wraparound and priority isolation. + +A Linux build, full TS3 state and generated two-way Opus were observed in a private deployment before source cleanup. See [feasibility limits](../docs/FEASIBILITY.md). Actual hardware conversation, complete official-client parity and all remaining features are not certified. diff --git a/native/src/main.rs b/native/src/main.rs new file mode 100644 index 0000000..8d64ebf --- /dev/null +++ b/native/src/main.rs @@ -0,0 +1,432 @@ +use base64::{engine::general_purpose::STANDARD, Engine}; +use futures::StreamExt; +use serde::Deserialize; +use serde_json::{json, Value}; +use std::{ + io::{self, Write}, + net::SocketAddr, + time::Duration, +}; +use tokio::io::{AsyncBufReadExt, BufReader}; +use tsclientlib::{Connection, DisconnectOptions, Identity, OutCommandExt, StreamItem}; +use tsclientlib::{ChannelId, ChannelType}; +use tsclientlib::{ClientId, MessageTarget, messages::c2s}; +use tsclientlib::prelude::M2BClientMoveExt; +use std::collections::HashMap; +use tsproto_packets::packets::{ + AudioData, CodecType, Direction, Flags, OutAudio, OutCommand, PacketType, +}; + +#[derive(Deserialize)] +#[serde(tag = "op", rename_all = "snake_case", deny_unknown_fields)] +enum Control { + Disconnect, + Command { request_id: u32, command: ClientCommand }, + AudioState { + input_muted: bool, + output_muted: bool, + }, + Audio { + codec: u8, + data: String, + }, +} + +#[derive(Deserialize)] +#[serde(tag = "type", rename_all = "snake_case", deny_unknown_fields)] +enum ClientCommand { + JoinChannel { channel_id: u64, password: Option }, + Subscribe { channel_id: u64, subscribed: bool }, + Nickname { name: String }, + Away { away: bool, message: String }, + TextMessage { target: String, channel_id: Option, client_id: Option, client_uid: Option, message: String }, + Poke { client_id: u16, client_uid: Option, message: String }, +} + +fn client_command(connection: &mut Connection, action: ClientCommand) -> Result { + let recipient = match &action { + ClientCommand::TextMessage { client_id: Some(id), client_uid: Some(uid), .. } | ClientCommand::Poke { client_id: id, client_uid: Some(uid), .. } => Some((*id, uid)), + _ => None, + }; + if let Some((id, expected)) = recipient { + let state = connection.get_state().map_err(|_| ())?; + if state.clients.get(&ClientId(id)).and_then(|client| client.uid.as_ref()).map(|uid| uid.to_string()).as_ref() != Some(expected) { return Err(()); } + } + let command = match action { + ClientCommand::JoinChannel { channel_id, password } => { + let state = connection.get_state().map_err(|_| ())?; + let own = state.clients.get(&state.own_client).ok_or(())?; + let mut part = own.client_move(ChannelId(channel_id)); + if let Some(ref password) = password { part = part.set_password(password); } + c2s::OutClientMoveMessage::new(&mut std::iter::once(part)) + } + ClientCommand::Subscribe { channel_id, subscribed } => { + let mut command = OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, if subscribed { "channelsubscribe" } else { "channelunsubscribe" }); + command.write_arg("cid", &channel_id); command + } + ClientCommand::Nickname { name } => { + if name.is_empty() || name.chars().count() > 64 { return Err(()); } + let mut command = OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientupdate"); + command.write_arg("client_nickname", &name); command + } + ClientCommand::Away { away, message } => { + let mut command = OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientupdate"); + command.write_arg("client_away", &(away as u8)); command.write_arg("client_away_message", &message); command + } + ClientCommand::TextMessage { target, channel_id, client_id, message, .. } => { + if message.len() > 1000 { return Err(()); } + if target == "channel" { + let state = connection.get_state().map_err(|_| ())?; + if state.clients.get(&state.own_client).map(|client| client.channel.0) != channel_id { return Err(()); } + } + let target = match target.as_str() { "channel" => MessageTarget::Channel, "server" => MessageTarget::Server, "private" => MessageTarget::Client(ClientId(client_id.ok_or(())?)), _ => return Err(()) }; + connection.get_state().map_err(|_| ())?.send_message(target, &message) + } + ClientCommand::Poke { client_id, message, .. } => { + connection.get_state().map_err(|_| ())?.send_message(MessageTarget::Poke(ClientId(client_id)), &message) + } + }; + command.send_with_result(connection).map_err(|_| ()) +} + +fn audio_status(connection: &Connection) -> io::Result<()> { + emit( + json!({"type":"audio_status", "canSend":connection.can_send_audio(), "canReceive":connection.can_receive_audio()}), + ) +} + +fn control(connection: &mut Connection, control: Control, pending: &mut HashMap) -> Result { + match control { + Control::Disconnect => return Ok(false), + Control::Command { request_id, command } => { + if pending.len() >= 64 { emit(json!({"type":"client_command_result","requestId":request_id,"ok":false})).map_err(|_| ())?; } + else { + match client_command(connection, command) { + Ok(handle) => { pending.insert(handle.0, request_id); }, + Err(()) => { emit(json!({"type":"client_command_result","requestId":request_id,"ok":false,"code":"command_not_sent"})).map_err(|_| ())?; }, + } + } + } + Control::AudioState { + input_muted, + output_muted, + } => { + if (input_muted || output_muted) && connection.can_send_audio() { + let _ = connection.send_audio(OutAudio::new(&AudioData::C2S { + id: 0, + codec: CodecType::OpusVoice, + data: &[], + })); + } + let mut command = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "clientupdate", + ); + command.write_arg("client_input_muted", &(input_muted as u8)); + command.write_arg("client_output_muted", &(output_muted as u8)); + command.write_arg("client_input_hardware", &1); + command.write_arg("client_output_hardware", &1); + command.send_with_result(connection).map_err(|_| ())?; + audio_status(connection).map_err(|_| ())?; + } + Control::Audio { codec, data } => { + // The upstream send_audio warns but does not enforce this permission itself. + if !connection.can_send_audio() { + return Ok(true); + } + let codec = match codec { + 4 => CodecType::OpusVoice, + 5 => CodecType::OpusMusic, + _ => return Err(()), + }; + let data = STANDARD.decode(data).map_err(|_| ())?; + if data.len() > 1275 { + return Err(()); + } + let state = connection.get_state().map_err(|_| ())?; + let own = state.clients.get(&state.own_client).ok_or(())?; + let channel = state.channels.get(&own.channel).ok_or(())?; + if channel.codec as u8 != codec as u8 { + return Ok(true); + } + connection + .send_audio(OutAudio::new(&AudioData::C2S { + id: 0, + codec, + data: &data, + })) + .map_err(|_| ())?; + } + } + Ok(true) +} + +#[derive(Deserialize)] +#[serde(tag = "op", rename_all = "snake_case", deny_unknown_fields)] +enum Request { + Generate, + Import { + value: String, + }, + Inspect { + identity: Identity, + }, + Export { + identity: Identity, + }, + Connect { + identity: Identity, + address: SocketAddr, + nickname: String, + password: Option, + channel_id: Option, + channel_password: Option, + seconds: u64, + }, +} + +fn emit(value: Value) -> io::Result<()> { + let mut out = io::stdout().lock(); + serde_json::to_writer(&mut out, &value)?; + out.write_all(b"\n")?; + out.flush() +} +fn metadata(identity: &Identity) -> Value { + json!({"uid": identity.key().to_pub().get_uid(), "level": identity.level()}) +} +fn private_identity(identity: &Identity) -> io::Result<()> { + // Private stdio protocol. The Node adapter must encrypt this and never forward it. + emit(json!({"type":"identity_internal", "identity":identity, "metadata":metadata(identity)})) +} +fn error_code(error: &tsclientlib::Error) -> &'static str { + match error { + tsclientlib::Error::ConnectTs(_) => "server_rejected_connection", + tsclientlib::Error::IdentityLevel(_) => "identity_level_required", + tsclientlib::Error::ServerUidMismatch(_) => "server_identity_changed", + tsclientlib::Error::InitserverTimeout => "server_initialization_timeout", + tsclientlib::Error::ConnectFailed { .. } => "connection_failed", + tsclientlib::Error::CommandError(_) => "server_permission_or_command_error", + tsclientlib::Error::ConnectionFailed(cause) | tsclientlib::Error::SendPacket(cause) => match cause { + tsproto::client::Error::TsProto(cause) => match cause { + tsproto::Error::NotInReceiveWindow { .. } => "packet_receive_window_exceeded", + tsproto::Error::WrongMac { .. } => "packet_authentication_failed", + tsproto::Error::DecompressPacket(_) => "packet_decompression_failed", + tsproto::Error::MaxLengthExceeded("command queue") => "command_reorder_capacity_exceeded", + tsproto::Error::MaxLengthExceeded("fragment queue") => "fragment_capacity_exceeded", + tsproto::Error::MaxLengthExceeded(_) => "packet_capacity_exceeded", + tsproto::Error::Network(_) => "protocol_network_error", + tsproto::Error::PacketParse(_, _) => "packet_parse_failed", + tsproto::Error::WrongClientId(_) => "packet_client_id_mismatch", + tsproto::Error::UnexpectedInitPacket => "unexpected_initialization_packet", + tsproto::Error::UnallowedUnencryptedPacket => "unencrypted_packet_rejected", + _ => "protocol_packet_error", + }, + tsproto::client::Error::ConnectionEnd => "server_connection_ended", + _ => "protocol_connection_failed", + }, + tsclientlib::Error::Io(_) => "protocol_io_error", + tsclientlib::Error::ConnectionGone => "server_connection_ended", + _ => "protocol_error", + } +} +fn snapshot(connection: &Connection, sequence: u64) -> Option { + let state = connection.get_state().ok()?; + if state.channels.len() > 4096 || state.clients.len() > 4096 { + return Some(json!({"type":"error", "code":"server_state_capacity_exceeded"})); + } + let channels: Vec = state + .channels + .values() + .map(|channel| { + json!({ + "id": channel.id.0, "parentId":channel.parent.0, "name":channel.name, + "order": channel.order.0, "subscribed": channel.subscribed, + "codec": channel.codec as u8, + "passwordProtected": channel.has_password, + "temporary": channel.channel_type == ChannelType::Temporary, + "topic": channel.topic, + }) + }) + .collect(); + let participants: Vec = state + .clients + .values() + .map(|client| { + json!({ + "id":client.id.0, "channelId":client.channel.0, "name":client.name, + "uid":client.uid.as_ref().map(|uid| uid.to_string()), + "inputMuted": client.input_muted, "outputMuted":client.output_muted, + "awayMessage": client.away_message, + }) + }) + .collect(); + Some( + json!({"type":"state", "sequence":sequence, "server":{"name":state.server.name}, + "ownClientId":state.own_client.0, "channels":channels, "participants":participants}), + ) +} + +async fn run() -> Result<(), ()> { + let mut input = BufReader::new(tokio::io::stdin()).lines(); + let line = input.next_line().await.map_err(|_| ())?.ok_or(())?; + if line.len() > 65536 { + return Err(()); + } + let request: Request = serde_json::from_str(&line).map_err(|_| ())?; + match request { + Request::Generate => { + let mut identity = Identity::create(); + identity.upgrade_level(16); + private_identity(&identity).map_err(|_| ())?; + } + Request::Import { value } => { + if value.len() > 16384 { + return Err(()); + } + let identity = Identity::new_from_str(&value).map_err(|_| ())?; + private_identity(&identity).map_err(|_| ())?; + } + Request::Inspect { identity } => { + emit(json!({"type":"identity_metadata", "metadata":metadata(&identity)})) + .map_err(|_| ())?; + } + Request::Export { identity } => { + emit(json!({"type":"export_internal", "value":format!("{}V{}",identity.counter(),identity.key().to_ts_obfuscated())})).map_err(|_| ())?; + } + Request::Connect { + identity, + address, + nickname, + password, + channel_id, + channel_password, + seconds, + } => { + if nickname.is_empty() || nickname.chars().count() > 64 || !(1..=240).contains(&seconds) + { + return Err(()); + } + let mut options = Connection::build(address) + .identity(identity) + .name(nickname) + .input_muted(true) + .output_muted(true) + .input_hardware_enabled(false) + .output_hardware_enabled(false) + .log_commands(false) + .log_packets(false) + .log_udp_packets(false); + if let Some(password) = password { + options = options.password(password); + } + if let Some(channel_id) = channel_id { options = options.channel_id(ChannelId(channel_id)); } + if let Some(password) = channel_password { if password.len() > 256 { return Err(()); } options = options.channel_password(password); } + let mut connection = options.connect().map_err(|_| ())?; + emit(json!({"type":"status", "status":"connecting"})).map_err(|_| ())?; + let lifetime = tokio::time::sleep(Duration::from_secs(seconds)); + let handshake = tokio::time::sleep(Duration::from_secs(25)); + tokio::pin!(lifetime, handshake); + let mut connected = false; + let mut sequence = 0u64; + let mut pending_commands = HashMap::new(); + loop { + tokio::select! { + _ = &mut lifetime => { emit(json!({"type":"status","status":"session_limit"})).map_err(|_| ())?; break; } + _ = &mut handshake, if !connected => { emit(json!({"type":"error","code":"handshake_timeout","inconclusive":true})).map_err(|_| ())?; break; } + command = input.next_line() => { + match command { + Ok(Some(line)) if line.len() <= 4096 => { + let command = serde_json::from_str::(&line).map_err(|_| ())?; + if !control(&mut connection, command, &mut pending_commands)? { break; } + } + _ => break, + } + } + event = async { connection.events().next().await } => { + match event { + Some(Ok(StreamItem::BookEvents(events))) => { + if !connected { + connected = true; + // Reconnection never re-enables audio without another owner action. + control(&mut connection, Control::AudioState { input_muted: true, output_muted: true }, &mut pending_commands)?; + emit(json!({"type":"status","status":"connected"})).map_err(|_| ())?; + let subscribe = connection.get_state().map_err(|_| ())?.server.set_subscribed(true); + if subscribe.send(&mut connection).is_err() { + emit(json!({"type":"warning","code":"subscription_unavailable"})).map_err(|_| ())?; + } + } + for event in events { + if let tsclientlib::events::Event::Message { target, invoker, message } = event { + let target_client_id = match target { MessageTarget::Client(id) | MessageTarget::Poke(id) => Some(id.0), _ => None }; + let target_uid = target_client_id.and_then(|id| connection.get_state().ok().and_then(|state| state.clients.get(&ClientId(id)).and_then(|client| client.uid.as_ref()).map(|uid| uid.to_string()))); + let target = match target { MessageTarget::Server => "server", MessageTarget::Channel => "channel", MessageTarget::Client(_) => "private", MessageTarget::Poke(_) => "poke" }; + let channel_id = connection.get_state().ok().and_then(|state| state.clients.get(&state.own_client).map(|client| client.channel.0)); + emit(json!({"type":"message","target":target,"clientId":invoker.id.0,"targetClientId":target_client_id,"uid":invoker.uid.as_ref().map(|uid| uid.to_string()),"targetUid":target_uid,"name":invoker.name,"message":message.chars().take(4096).collect::(),"channelId":channel_id})).map_err(|_| ())?; + } + } + sequence += 1; + if let Some(state) = snapshot(&connection, sequence) { emit(state).map_err(|_| ())?; } + } + Some(Ok(StreamItem::Audio(audio))) => { + let packet = audio.data(); + let data = packet.data(); + let (from, whisper) = match &data { + AudioData::S2C { from, .. } => (*from, false), + AudioData::S2CWhisper { from, .. } => (*from, true), + _ => continue, + }; + if data.data().len() <= 1275 { + emit(json!({"type":"audio", "clientId":from, "sequence":data.id(), "codec":data.codec() as u8, "whisper":whisper, "data":STANDARD.encode(data.data())})).map_err(|_| ())?; + } + } + Some(Ok(StreamItem::AudioChange(_))) => { audio_status(&connection).map_err(|_| ())?; } + Some(Ok(StreamItem::MessageResult(handle, result))) => { + if let Some(request_id) = pending_commands.remove(&handle.0) { + let server_error = result.as_ref().err().map(|error| error.error as u32); + let missing_permission = result.as_ref().err().and_then(|error| error.missing_permission.map(|permission| permission.0)); + emit(json!({"type":"client_command_result", "requestId":request_id, "ok":result.is_ok(), "serverError":server_error,"missingPermission":missing_permission})).map_err(|_| ())?; + } else { emit(json!({"type":"command_result", "requestId":handle.0, "ok":result.is_ok()})).map_err(|_| ())?; } + } + Some(Ok(StreamItem::IdentityLevelIncreasing(level))) => { + emit(json!({"type":"status","status":"identity_level_increasing","requiredLevel":level})).map_err(|_| ())?; + if level > 24 { connection.cancel_identity_level_increase(); break; } + } + Some(Ok(StreamItem::IdentityLevelIncreased)) => { + if let Some(identity) = connection.get_options().get_identity() { private_identity(identity).map_err(|_| ())?; } + } + Some(Ok(StreamItem::DisconnectedTemporarily(_))) => { + connected = false; + emit(json!({"type":"status","status":"reconnecting"})).map_err(|_| ())?; + handshake.as_mut().reset(tokio::time::Instant::now()+Duration::from_secs(25)); + } + Some(Err(error)) => { + emit(json!({"type":"error","code":error_code(&error)})).map_err(|_| ())?; + break; + } + None => break, + _ => {}, + } + } + } + } + if connection.disconnect(DisconnectOptions::new()).is_ok() { + let _ = tokio::time::timeout(Duration::from_secs(1), async { + while connection.events().next().await.is_some() {} + }) + .await; + } + emit(json!({"type":"status","status":"disconnected"})).map_err(|_| ())?; + } + } + Ok(()) +} +#[tokio::main] +async fn main() { + // No tracing subscriber: protocol packets, keys and passwords never enter logs. + if run().await.is_err() { + let _ = emit(json!({"type":"error","code":"invalid_request_or_native_failure"})); + std::process::exit(1); + } +} diff --git a/native/vendor/bounded-reordering.patch b/native/vendor/bounded-reordering.patch new file mode 100644 index 0000000..fb39b4e --- /dev/null +++ b/native/vendor/bounded-reordering.patch @@ -0,0 +1,85 @@ +--- a/tsproto/src/lib.rs ++++ b/tsproto/src/lib.rs +@@ -53,7 +53,9 @@ + + /// The maximum number of packets which are stored, if they are received + /// out-of-order. +-const MAX_QUEUE_LEN: u16 = 200; ++// A high-latency initial channel burst can span more than 200 packet IDs ++// before a missing command is retransmitted. Keep a bounded reorder window. ++const MAX_QUEUE_LEN: u16 = 2048; + + /// The maximum decompressed size of a packet. + #[allow(clippy::unreadable_literal)] +--- a/tsproto/src/packet_codec.rs ++++ b/tsproto/src/packet_codec.rs +@@ -343,7 +343,13 @@ + if (!next_gen && id >= cur_next && id < limit) + || (next_gen && (id >= cur_next || id < limit)) + { +- r_queue.push(packet_data); ++ // Retransmissions must not grow the queue or survive as stale duplicates. ++ if !r_queue.iter().any(|p| InHeader::new(dir, p).packet_id() == id) { ++ if r_queue.len() >= usize::from(MAX_QUEUE_LEN) { ++ return Err(Error::MaxLengthExceeded("command queue")); ++ } ++ r_queue.push(packet_data); ++ } + Ok(vec![]) + } else { + Err(Error::MaxLengthExceeded("command queue")) +@@ -459,3 +465,54 @@ + Ok(packets) + } + } ++ ++#[cfg(test)] ++mod reorder_tests { ++ use super::*; ++ ++ fn packet(id: u16, kind: PacketType) -> Vec { ++ OutPacket::new([0; 8], id, None, Flags::empty(), kind).into_vec() ++ } ++ ++ async fn connection() -> Connection { ++ let socket = tokio::net::UdpSocket::bind("127.0.0.1:0").await.unwrap(); ++ Connection::new(true, "127.0.0.1:9987".parse().unwrap(), Box::new(socket)) ++ } ++ ++ #[tokio::test] ++ async fn burst_waits_for_missing_command_and_drains_in_order() { ++ let mut con = connection().await; ++ for id in (1..MAX_QUEUE_LEN).rev() { ++ assert!(PacketCodec::handle_command_packet(&mut con, packet(id, PacketType::Command)).unwrap().is_empty()); ++ } ++ for _ in 0..100 { ++ PacketCodec::handle_command_packet(&mut con, packet(300, PacketType::Command)).unwrap(); ++ } ++ assert_eq!(con.codec.receive_queue[0].len(), usize::from(MAX_QUEUE_LEN - 1)); ++ assert!(matches!(PacketCodec::handle_command_packet(&mut con, packet(MAX_QUEUE_LEN, PacketType::Command)), Err(Error::MaxLengthExceeded("command queue")))); ++ let packets = PacketCodec::handle_command_packet(&mut con, packet(0, PacketType::Command)).unwrap(); ++ assert_eq!(packets.len(), usize::from(MAX_QUEUE_LEN)); ++ for (id, bytes) in packets.iter().enumerate() { ++ assert_eq!(InHeader::new(Direction::S2C, bytes).packet_id(), id as u16); ++ } ++ assert!(con.codec.receive_queue[0].is_empty()); ++ } ++ ++ #[tokio::test] ++ async fn reorder_window_wraps_and_command_priorities_remain_independent() { ++ let mut con = connection().await; ++ let start = u16::MAX - 100; ++ con.codec.incoming_p_ids[PacketType::Command as usize].packet_id = start; ++ for offset in (1..350u16).rev() { ++ PacketCodec::handle_command_packet(&mut con, packet(start.wrapping_add(offset), PacketType::Command)).unwrap(); ++ } ++ PacketCodec::handle_command_packet(&mut con, packet(1, PacketType::CommandLow)).unwrap(); ++ let packets = PacketCodec::handle_command_packet(&mut con, packet(start, PacketType::Command)).unwrap(); ++ assert_eq!(packets.len(), 350); ++ for (offset, bytes) in packets.iter().enumerate() { ++ assert_eq!(InHeader::new(Direction::S2C, bytes).packet_id(), start.wrapping_add(offset as u16)); ++ } ++ assert_eq!(con.codec.receive_queue[1].len(), 1); ++ assert_eq!(PacketCodec::handle_command_packet(&mut con, packet(0, PacketType::CommandLow)).unwrap().len(), 2); ++ } ++} diff --git a/native/vendor/provenance.json b/native/vendor/provenance.json new file mode 100644 index 0000000..6642336 --- /dev/null +++ b/native/vendor/provenance.json @@ -0,0 +1,24 @@ +[ + { + "project": "ReSpeak/tsclientlib", + "revision": "ee3bc6f45a7137db7793ba5593a321df400d53e5", + "archiveSha256": "65c12cc22758985436242470974d497343df6077c946c8b874ca165f6044b092", + "method": "GitHub source archive; no Git checkout or metadata", + "localPatches": [ + { + "path": "raw-audio.patch", + "purpose": "Expose encoded audio stream variants without the native codec module; preserve existing transport encryption and permission handling" + }, + { + "path": "bounded-reordering.patch", + "purpose": "Bounded 2048-packet command reordering with duplicate suppression for high-latency synchronization bursts; encryption and authentication unchanged; includes ordered-drain and sequence-wrap tests" + } + ] + }, + { + "project": "ReSpeak/tsdeclarations", + "revision": "83cb8a94b65021bb8ec4beb339e5bfbdd93df60f", + "archiveSha256": "3dcfb83b8474a851723a30e8baa2a22d8f44de9c130386c6a4501516edfded66", + "method": "GitHub source archive; no Git checkout or metadata" + } +] diff --git a/native/vendor/raw-audio.patch b/native/vendor/raw-audio.patch new file mode 100644 index 0000000..985ddf3 --- /dev/null +++ b/native/vendor/raw-audio.patch @@ -0,0 +1,78 @@ +--- a/tsclientlib/src/lib.rs ++++ b/tsclientlib/src/lib.rs +@@ -38,7 +38,7 @@ + use tsproto::connection::StreamItem as ProtoStreamItem; + use tsproto::resend::ResenderState; + use tsproto_packets::commands::{CommandItem, CommandParser}; +-#[cfg(feature = "audio")] ++#[cfg(any(feature = "audio", feature = "raw-audio"))] + use tsproto_packets::packets::InAudioBuf; + use tsproto_packets::packets::{InCommandBuf, OutCommand, OutPacket, PacketType}; + +@@ -214,7 +214,7 @@ + /// + /// Audio packets can be handled by the [`AudioHandler`](audio::AudioHandler), which builds a + /// queue per client and handles packet loss and jitter. +- #[cfg(feature = "audio")] ++ #[cfg(any(feature = "audio", feature = "raw-audio"))] + Audio(InAudioBuf), + /// The needed level. + IdentityLevelIncreasing(u8), +@@ -1092,7 +1092,7 @@ + /// If the current channel (and server) allow unencrypted voice packets. + /// + /// For whisper packets, only the server setting is checked. +- #[cfg(feature = "audio")] ++ #[cfg(any(feature = "audio", feature = "raw-audio"))] + fn intern_can_receive_unencrypted_audio(book: &data::Connection, whisper: bool) -> bool { + match book.server.codec_encryption_mode { + CodecEncryptionMode::ForcedOn => false, +@@ -1215,7 +1215,7 @@ + ProtoStreamItem::Error(error) => { + warn!(%error, "Connection got a non-fatal error"); + } +- #[cfg(feature = "audio")] ++ #[cfg(any(feature = "audio", feature = "raw-audio"))] + ProtoStreamItem::Audio(audio) => { + if !Self::intern_can_receive_audio(book, &self.options) { + info!("Received audio packet while output is muted, ignoring"); +--- a/tsclientlib/Cargo.toml ++++ b/tsclientlib/Cargo.toml +@@ -23,6 +23,8 @@ + # Enable the unstable api + unstable = [] + audio = ["audiopus"] ++# Forward encoded packets without linking a native audio codec. ++raw-audio = [] + # Enable default reqwest features. + # Use default-features=false on tsclientlib to configure reqwest differently. + default-tls = ["reqwest/charset", "reqwest/default-tls", "reqwest/http2"] +--- a/tsclientlib/src/sync.rs ++++ b/tsclientlib/src/sync.rs +@@ -11,7 +11,7 @@ + use tokio::sync::{mpsc, oneshot}; + use tracing::{error, info}; + use ts_bookkeeping::ChannelId; +-#[cfg(feature = "audio")] ++#[cfg(any(feature = "audio", feature = "raw-audio"))] + use tsproto_packets::packets::InAudioBuf; + #[cfg(feature = "unstable")] + use tsproto_packets::packets::OutCommand; +@@ -62,7 +62,7 @@ + /// + /// Audio packets can be handled by the [`AudioHandler`](crate::audio::AudioHandler), which + /// builds a queue per client and handles packet loss and jitter. +- #[cfg(feature = "audio")] ++ #[cfg(any(feature = "audio", feature = "raw-audio"))] + Audio(InAudioBuf), + /// The needed level. + IdentityLevelIncreasing(u8), +@@ -234,7 +234,7 @@ + SyncStreamItem::BookEvents(i) + } + StreamItem::MessageEvent(i) => SyncStreamItem::MessageEvent(i), +- #[cfg(feature = "audio")] ++ #[cfg(any(feature = "audio", feature = "raw-audio"))] + StreamItem::Audio(i) => SyncStreamItem::Audio(i), + StreamItem::IdentityLevelIncreasing(i) => { + SyncStreamItem::IdentityLevelIncreasing(i) diff --git a/native/vendor/tsclientlib/CHANGELOG.md b/native/vendor/tsclientlib/CHANGELOG.md new file mode 100644 index 0000000..a8e7fcb --- /dev/null +++ b/native/vendor/tsclientlib/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### ℹ Changed +- Switched from `slog` to `tracing` for logging +- Update dependencies (updates some exposed types) + +## [0.2.0] - 2021-05-12 +### ✨ Added +- 🎵 An audio queue that automatically sort, decode and handle lost audio packets +- Audio example for `tsclientlib` +- Send audio packets with `Connection::send_audio` +- ⏫ Automatically improve identity level if it is not high enough +- 🔓 Add `channel`, `channel_password` and (server-)`password` to `ConnectOptions` +- 📂 Filetransfer: Download and upload files from and to TeamSpeak servers +- Most structs can be serialized with `serde` now +- `Reason` to events that support it, that allows distinguishing between client joins and subscription events +- Add ability to check server identity when connecting as `ConnectOptions::server` +- `StreamItem::MessageEvent` for non-book events + +### ℹ Changed +- ➠ Upgrade from `futures` 0.1 to 0.3 and `tokio` 0.1 to 1.0 for `async`/`await` support +- 🔒 Rewrite `tsproto` and `tsclientlib` to be a single, non-cloneable object. This removes all locks +- 🚀 Many performance improvements + - New command parser, 2–2.5× faster than the old one + - New command serializer, 2× faster than the old one +- Switched error handling library from `failure` to `thiserror` +- Now licensed under MIT/Apache 2.0 (previously under OSL 2.0) +- Commands are now sent with `command.send(&mut connection)?` +- A new connection should now be created with `ConnectOptions::connect` instead of `Connection::new` +- Multiple renamings in the book +- Rename `StreamItem::ConEvents` to `StreamItem::BookEvents` +- Rename `UidRef` to `Uid` and make it a dynamically sized type. The previously owned `Uid` type is now called `UidBuf` +- Replace `ring` with RustCrypto crates to get rid of the `flakebi-ring` crate + +### ❌ Removed +- The `ConnectionManager` in `tsproto` was removed + +### 🐛 Fixed +- Hashcash implementation counts leading zeroes from lsb instead of msb +- Use `3.?.?` version by default to allow connecting to newer TeamSpeak servers +- Fix channel order handling +- Use `git-testament` instead of `built`, this removes building libgit +- Fix encoding newlines in commands +- The last `Ack` packet is sent reliably now, previously it was lost sometimes +- Fix connecting to servers behind certain protections by restart sending init packets +- Try to reconnect infinitely after a timeout +- Keep channel and muted state when reconnecting +- Automatically subscribe to new channels when the server is subscribed + +## [0.1.0] - 2019-04-14 +### Added +- First release on crates.io for + - tsclientlib + - tsproto + - tsproto-commands + - tsproto-structs diff --git a/native/vendor/tsclientlib/Cargo.toml b/native/vendor/tsclientlib/Cargo.toml new file mode 100644 index 0000000..56e994c --- /dev/null +++ b/native/vendor/tsclientlib/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "tsclientlib", + "tsproto", + "utils/ts-bookkeeping", + "utils/tsproto-packets", + "utils/tsproto-structs", + "utils/tsproto-types", +] diff --git a/native/vendor/tsclientlib/LICENSE-APACHE b/native/vendor/tsclientlib/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/native/vendor/tsclientlib/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/native/vendor/tsclientlib/LICENSE-MIT b/native/vendor/tsclientlib/LICENSE-MIT new file mode 100644 index 0000000..fa2904d --- /dev/null +++ b/native/vendor/tsclientlib/LICENSE-MIT @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-2020 tsclientlib contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/native/vendor/tsclientlib/README.md b/native/vendor/tsclientlib/README.md new file mode 100644 index 0000000..a470f1d --- /dev/null +++ b/native/vendor/tsclientlib/README.md @@ -0,0 +1,115 @@ +# TsClientlib [![Build status](https://ci.appveyor.com/api/projects/status/ylne3ku7265xa22j/branch/master?svg=true)](https://ci.appveyor.com/project/Flakebi/tsclientlib/branch/master) +TsClientlib is a library that enables you to write voip clients and bots using +the TeamSpeak protocol. + +> TeamSpeak is a proprietary voice-over-Internet Protocol (VoIP) application for +> audio communication between users on a chat channel, much like a telephone +> conference call. Users typically use headphones with a microphone. The client +> software connects to a TeamSpeak server of the user's choice, from which the +> user may join chat channels. – [Wikipedia](https://en.wikipedia.org/wiki/Teamspeak) + +The various libraries in this repository are currently a work in progress so +don‘t expect everything to work. Many things you would expect from a +library are working, like connecting, getting events, writing and receiving +messages, etc. Some features like automatic reconnects are not yet there. + +If you are searching for a usable client instead of a library, +[Qint](https://github.com/ReSpeak/Qint) will be a cross-platform TeamSpeak +client, which is based on this library (but it is not ready yet). + +## Dependencies +- [Rust](https://rust-lang.org) (preferred installation method is [rustup](https://rustup.rs)) +- [OpenSSL](https://www.openssl.org) 1.1 (linux only) + +## Getting Started +An example of a simple chat bot can be found [here](https://github.com/ReSpeak/SimpleBot). + +## Clone +This repository embeds the [declarations](https://github.com/ReSpeak/tsdeclarations) as submodule. You can clone with +``` +git clone https://github.com/ReSpeak/tsclientlib.git --recurse-submodules +``` +or download the submodule afterwards with +``` +git clone https://github.com/ReSpeak/tsclientlib.git +cd tsclientlib +git submodule update --init --recursive +``` + +## Build and run the example client +The code can be found [here](tsclientlib/examples/simple.rs). +``` +cd tsclientlib +cargo run --example simple +``` + +## Build and run the example audio client +The code can be found [here](tsclientlib/examples/audio.rs). +``` +cd tsclientlib +cargo run --example audio +``` + + +## Projects +You probably want to use tsclientlib, it builds upon all other projects. This +list shows what each library does and it may be useful if you want to help +developing. + +- `tsclientlib`: This is the main product of this repository, a simple to use TeamSpeak library +- `tsproto`: The low level library that does the network part. You probably don't want to use that, but a higher level library like tsclientlib. + +### Utils +The utils folder contains smaller building blocks for the library. + +- `ts-bookkeeping`: This crates keeps book of the currently connected clients and channels of a server. +- `tsproto-packets`: Parse packets and commands. +- `tsproto-structs`: Contains parsed versions of the [tsdeclarations](https://github.com/ReSpeak/tsdeclarations). +- `tsproto-types`: Contains basic types for TeamSpeak, e.g. versions and error codes. + +## How this works +`tsproto` implements the basic TeamSpeak protocol stuff (uh, who would have +expected that), which comes down to creating a connection, make sure that udp +packets are delivered, encrypt and compress the communication and give access to +all these low-level things. + +The convenient client library on top is `tsclientlib`. It uses all the versions, +messages, structures and errors which are written down in a +[machine readable format](https://github.com/ReSpeak/tsdeclarations) and +provides a nice and safe api. + +## Performance +For benchmarks, a TeamSpeak server has to run at localhost. Run +``` +cd tsproto +cargo bench -- +``` +where `` is `connect` or `message`. + +On a i7-5280K with 6 cores/12 threads @3.6 GHz, which uses more or less only one +thread because we only test a single connection, we get: + +- 199 ms for creating one connection, which means 6.5 connections per second. This comes down to solving the RSA puzzle at the beginning of a connection, not much else plays a role. Be sure to run the benchmark with `--features rug` to get an efficient big integer implementation, otherwise it will fall back to a slower implementation. +- 189 µs for sending a message, which means 5300 messages per second. The benchmark is not perfectly accurate as it does not wait for all packets to be sent. + +## Miscellaneous +This project is not an official TeamSpeak project. We started to write an own +client for fun and because we want some features (and bugfixes) which are not +available in the official client. + +That said, we do not want to harm the company behind TeamSpeak because we like +their product. Otherwise we would just use something else and not write our own +client 😉. As TeamSpeak earns its money with selling servers and thus their +existence depends on it, we will not publish any server related code and we +encourage you to do the same (this may change with the new licensing system, +introduced in the 3.1 server). + +Thanks TeamSpeak for your software! + +## License +Licensed under either of + + * [Apache License, Version 2.0](LICENSE-APACHE) + * [MIT license](LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/clippy.toml b/native/vendor/tsclientlib/clippy.toml new file mode 100644 index 0000000..c6c2413 --- /dev/null +++ b/native/vendor/tsclientlib/clippy.toml @@ -0,0 +1 @@ +doc-valid-idents = ["MiB", "GiB", "TiB", "PiB", "EiB", "TeamSpeak", "TeamSpeak3", "PRIME256v1"] diff --git a/native/vendor/tsclientlib/tools/measure-latency.sh b/native/vendor/tsclientlib/tools/measure-latency.sh new file mode 100644 index 0000000..113daa7 --- /dev/null +++ b/native/vendor/tsclientlib/tools/measure-latency.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -e +# Measure the latency of recording (a microphone) with the ts client, sending it +# to the server and to another client again and playing it. + +if [[ -f ~/.TsLatencyPulseaudioLoop ]]; then + echo Removing modules + # Try to unload first + while read -r line; do + pactl unload-module $line || true + done < ~/.TsLatencyPulseaudioLoop + + rm -f ~/.TsLatencyPulseaudioLoop +fi + +set -e + +if [[ -n $1 ]]; then + exit +fi + +# Either TeamSpeak3 or voice-client +from='"audio-latency"' +to='"audio-latency"' + +# The sink for the music +pactl load-module module-null-sink sink_name=latency_nullsink object.linger=1 media.class=Audio/Sink sink_properties=device.description=LatencySink >> ~/.TsLatencyPulseaudioLoop +# The sink for TeamSpeak +pactl load-module module-null-sink sink_name=latency_tssink object.linger=1 media.class=Audio/Sink sink_properties=device.description=LatencyTsSink >> ~/.TsLatencyPulseaudioLoop +echo Created modules + +# Find source-output id of teamspeak +id=`pactl list source-outputs | grep "$from" -B20 | grep "Source Output" | cut -d# -f2` +echo Found output "$from": "$id" +# Connect nullsink to teamspeak3 +pactl move-source-output $id latency_nullsink.monitor + +# Find source-output id of teamspeak +id=`pactl list sink-inputs | grep "$to" -B20 | grep "Sink Input" | cut -d# -f2` +echo Found input "$to": "$id" +# Connect teamspeak3 to nullsink +pactl move-sink-input $id latency_tssink + + +# Now measure latency +echo Starting measurement +gst-launch-1.0 -v pulsesrc device=latency_tssink.monitor ! audiolatency print-latency=true ! pulsesink device=latency_nullsink diff --git a/native/vendor/tsclientlib/tsclientlib/Cargo.toml b/native/vendor/tsclientlib/tsclientlib/Cargo.toml new file mode 100644 index 0000000..64367c4 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/Cargo.toml @@ -0,0 +1,66 @@ +[package] +name = "tsclientlib" +version = "0.2.0" +authors = ["Flakebi "] +description = "A library to create TeamSpeak clients and bots." +repository = "https://github.com/ReSpeak/tsclientlib" +readme = "README.md" +keywords = ["teamspeak3", "ts3", "voip"] +categories = ["multimedia"] +license = "MIT OR Apache-2.0" +edition = "2018" +include = [ + "/Cargo.toml", + "/README.md", + "**/*.rs", +] + +[package.metadata.docs.rs] +features = ["unstable"] + +[features] +default = ["audio", "default-tls"] +# Enable the unstable api +unstable = [] +audio = ["audiopus"] +# Forward encoded packets without linking a native audio codec. +raw-audio = [] +# Enable default reqwest features. +# Use default-features=false on tsclientlib to configure reqwest differently. +default-tls = ["reqwest/charset", "reqwest/default-tls", "reqwest/http2"] +# Use API of audiopus fork at https://github.com/Flakebi/audiopus for more features +audiopus-unstable = [] + +[dependencies] +audiopus = { version = "0.3.0-rc.0", optional = true } +base64 = "0.22" +futures = "0.3" +git-testament = "0.2" +itertools = "0.14" +num-traits = "0.2" +pin-utils = "0.1" +rand = "0.10" +reqwest = { version = "0.13", default-features = false } +thiserror = "2" +time = "0.3" +tokio = { version = "1", features = ["time"] } +tokio-stream = "0.1" +tracing = "0.1" +hickory-net = "0.26" +hickory-resolver = "0.26" +ts-bookkeeping = { path = "../utils/ts-bookkeeping", version = "0.1" } +tsproto = { path = "../tsproto", version = "0.2" } +tsproto-packets = { path = "../utils/tsproto-packets", version = "0.1" } +tsproto-types = { path = "../utils/tsproto-types", version = "0.1" } +url = "2" + +[dev-dependencies] +anyhow = "1" +audiopus = "0.3.0-rc.0" +cpal = "0.18" +once_cell = "1" +quickcheck = "1" +quickcheck_macros = "1" +clap = { version = "4", features = ["derive"] } +tokio = { version = "1", features = ["io-util", "net", "rt-multi-thread", "rt", "signal"] } +tracing-subscriber = "0.3" diff --git a/native/vendor/tsclientlib/tsclientlib/README.md b/native/vendor/tsclientlib/tsclientlib/README.md new file mode 100644 index 0000000..15bd30f --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/README.md @@ -0,0 +1,21 @@ +# TsClientlib [![docs.rs](https://docs.rs/tsclientlib/badge.svg)](https://docs.rs/tsclientlib) +tsclientlib is a library which makes it simple to create TeamSpeak clients +and bots. + +For a full client application, you might want to have a look at [Qint]. + +If more power over the internals of a connection is needed, the `unstable` feature can be +enabled. Beware that functionality behind this feature may change on any minor release. + +The base class of this library is the [`Connection`]. One instance of this +struct manages a single connection to a server. + +[Qint]: https://github.com/ReSpeak/Qint + +## License +Licensed under either of + + * [Apache License, Version 2.0](../LICENSE-APACHE) + * [MIT license](../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/tsclientlib/README.tpl b/native/vendor/tsclientlib/tsclientlib/README.tpl new file mode 100644 index 0000000..da985f2 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/README.tpl @@ -0,0 +1,10 @@ +# TsClientlib [![docs.rs](https://docs.rs/tsclientlib/badge.svg)](https://docs.rs/tsclientlib) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../LICENSE-APACHE) + * [MIT license](../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/tsclientlib/examples/audio-latency.rs b/native/vendor/tsclientlib/tsclientlib/examples/audio-latency.rs new file mode 100644 index 0000000..5ca49ca --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/audio-latency.rs @@ -0,0 +1,66 @@ +use anyhow::Result; +use clap::Parser; +use tokio::sync::mpsc; +use tokio::task::LocalSet; +use tracing::{debug, info}; + +use tsclientlib::ClientId; +use tsproto_packets::packets::{Direction, InAudioBuf}; + +mod audio_utils; + +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +struct ConnectionId(u64); + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The volume for the capturing + #[arg(default_value_t = 1.0)] + volume: f32, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_id = ConnectionId(0); + let local_set = LocalSet::new(); + let audiodata = audio_utils::start(&local_set)?; + + let (send, mut recv) = mpsc::channel(1); + { + let mut a2t = audiodata.a2ts.lock().unwrap(); + a2t.set_listener(send); + a2t.set_volume(args.volume); + a2t.set_playing(true); + } + + let t2a = audiodata.ts2a.clone(); + loop { + // Wait for ctrl + c + tokio::select! { + send_audio = recv.recv() => { + if let Some(packet) = send_audio { + let from = ClientId(0); + let mut t2a = t2a.lock().unwrap(); + let in_audio = InAudioBuf::try_new(Direction::C2S, packet.into_vec()).unwrap(); + if let Err(error) = t2a.play_packet((con_id, from), in_audio) { + debug!(%error, "Failed to play packet"); + } + } else { + info!("Audio sending stream was canceled"); + break; + } + } + _ = tokio::signal::ctrl_c() => { break; } + }; + } + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/audio.rs b/native/vendor/tsclientlib/tsclientlib/examples/audio.rs new file mode 100644 index 0000000..94ca7e8 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/audio.rs @@ -0,0 +1,127 @@ +//! This example connects to a teamspeak instance and joins a channel. +//! The connected bot-identity will listen on your microphone and send everything to the current +//! channel. In parallel, the program will play back all other clients in the channel via its own +//! audio output. +//! Microphone -> Channel +//! Channel -> PC Speakers + +use anyhow::{bail, Result}; +use clap::Parser; +use futures::prelude::*; +use tokio::sync::mpsc; +use tokio::task::LocalSet; +use tracing::{debug, info}; + +use tsclientlib::{ClientId, Connection, DisconnectOptions, Identity, StreamItem}; +use tsproto_packets::packets::AudioData; + +mod audio_utils; + +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +struct ConnectionId(u64); + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// The volume for the capturing + #[arg(default_value_t = 1.0)] + volume: f32, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_id = ConnectionId(0); + let local_set = LocalSet::new(); + let audiodata = audio_utils::start(&local_set)?; + + let con_config = Connection::build(args.address) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + // Connect + let mut con = con_config.connect()?; + + let r = con + .events() + .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + .next() + .await; + if let Some(r) = r { + r?; + } + + let (send, mut recv) = mpsc::channel(5); + { + let mut a2t = audiodata.a2ts.lock().unwrap(); + a2t.set_listener(send); + a2t.set_volume(args.volume); + a2t.set_playing(true); + } + + loop { + let t2a = audiodata.ts2a.clone(); + let events = con.events().try_for_each(|e| async { + if let StreamItem::Audio(packet) = e { + let from = ClientId(match packet.data().data() { + AudioData::S2C { from, .. } => *from, + AudioData::S2CWhisper { from, .. } => *from, + _ => panic!("Can only handle S2C packets but got a C2S packet"), + }); + let mut t2a = t2a.lock().unwrap(); + if let Err(error) = t2a.play_packet((con_id, from), packet) { + debug!(%error, "Failed to play packet"); + } + } + Ok(()) + }); + + // Wait for ctrl + c + tokio::select! { + send_audio = recv.recv() => { + if let Some(packet) = send_audio { + con.send_audio(packet)?; + } else { + info!("Audio sending stream was canceled"); + break; + } + } + _ = tokio::signal::ctrl_c() => { break; } + r = events => { + r?; + bail!("Disconnected"); + } + }; + } + + // Disconnect + con.disconnect(DisconnectOptions::new())?; + con.events().for_each(|_| future::ready(())).await; + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/audio_to_ts.rs b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/audio_to_ts.rs new file mode 100644 index 0000000..7c61b2a --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/audio_to_ts.rs @@ -0,0 +1,184 @@ +use std::sync::atomic::{AtomicU32, Ordering}; +use std::sync::{Arc, Mutex}; + +use anyhow::{Result, format_err}; +use audiopus::coder::Encoder; +use cpal::traits::{DeviceTrait, StreamTrait}; +use cpal::{Device, Stream, StreamConfig}; +use futures::prelude::*; +use tokio::sync::mpsc; +use tokio::task::LocalSet; +use tokio::time::{self, Duration}; +use tokio_stream::wrappers::IntervalStream; +use tracing::{debug, error, instrument, warn}; +use tsproto_packets::packets::{AudioData, CodecType, OutAudio, OutPacket}; + +use super::*; + +pub struct AudioToTs { + device: Device, + listener: Arc>>>, + stream: Option, + + is_playing: bool, + /// Storing an f32 + volume: Arc, +} + +struct Callback { + listener: Arc>>>, + encoder: Encoder, + /// Storing an f32 + volume: Arc, + + tmp_buffer: [f32; USUAL_FRAME_SIZE * 2], + opus_output: [u8; MAX_OPUS_FRAME_SIZE], +} + +impl AudioToTs { + pub fn new(device: Device, local_set: &LocalSet) -> Result>> { + let listener = Arc::new(Mutex::new(Default::default())); + let volume = Arc::new(AtomicU32::new(1.0_f32.to_bits())); + + let res = Arc::new(Mutex::new(Self { + device, + listener, + stream: None, + + is_playing: false, + volume, + })); + + Self::start(res.clone(), local_set); + + Ok(res) + } + + #[instrument(skip(self))] + fn open_capture(&self) -> Result { + let config = StreamConfig { + channels: 1, + sample_rate: 48000, + buffer_size: cpal::BufferSize::Fixed(USUAL_FRAME_SIZE as u32), + }; + + let encoder = Encoder::new( + audiopus::SampleRate::Hz48000, + audiopus::Channels::Mono, + audiopus::Application::Voip, + ) + .expect("Could not create encoder"); + let mut callback = Callback { + listener: self.listener.clone(), + encoder, + volume: self.volume.clone(), + + tmp_buffer: [0.0; _], + opus_output: [0; _], + }; + + self.device + .build_input_stream( + config, + move |audio_data, _| callback.callback(audio_data), + |error| error!(%error, "Error during audio capture"), + Some(Duration::from_secs(5)), + ) + .map_err(|e| format_err!("cpal error: {}", e)) + } + + pub fn set_listener(&self, sender: mpsc::Sender) { + let mut listener = self.listener.lock().unwrap(); + *listener = Some(sender); + } + + pub fn set_volume(&mut self, volume: f32) { + self.volume.store(volume.to_bits(), Ordering::Relaxed); + } + + pub fn set_playing(&mut self, playing: bool) { + if let Some(stream) = &self.stream { + if playing { + if let Err(error) = stream.play() { + error!(%error, "Failed to start stream"); + self.stream = None; + } else { + self.is_playing = true; + } + } else { + if let Err(error) = stream.pause() { + error!(%error, "Failed to pause stream"); + self.stream = None; + } + self.is_playing = false; + } + } + } + + #[instrument(skip(a2t, local_set))] + fn start(a2t: Arc>, local_set: &LocalSet) { + local_set.spawn_local( + IntervalStream::new(time::interval(Duration::from_secs(1))).for_each(move |_| { + let mut a2t = a2t.lock().unwrap(); + + if a2t.stream.is_none() { + // Try to reconnect to audio + match a2t.open_capture() { + Ok(s) => { + a2t.stream = Some(s); + debug!("Reconnected to capture device"); + if a2t.is_playing { + a2t.set_playing(true); + } + } + Err(error) => { + error!(%error, "Failed to open capture device"); + } + }; + } + + future::ready(()) + }), + ); + } +} + +impl Callback { + #[instrument(skip(self, buffer))] + fn callback<'a>(&'a mut self, mut buffer: &'a [f32]) { + // Handle volume + let volume = f32::from_bits(self.volume.load(Ordering::Relaxed)); + if volume != 1.0 { + if self.tmp_buffer.len() < buffer.len() { + warn!("tmp buffer len smaller than received capture buffer, dropping data"); + } + for (dst, src) in self.tmp_buffer.iter_mut().zip(buffer.iter()) { + *dst = *src * volume; + } + buffer = &self.tmp_buffer[..buffer.len()]; + } + + match self.encoder.encode_float(buffer, &mut self.opus_output[..]) { + Err(error) => { + error!(%error, "Failed to encode opus"); + } + Ok(len) => { + // Create packet + let packet = OutAudio::new(&AudioData::C2S { + id: 0, + codec: CodecType::OpusVoice, + data: &self.opus_output[..len], + }); + + // Write into packet sink + let mut listener = self.listener.lock().unwrap(); + if let Some(lis) = &mut *listener { + match lis.try_send(packet) { + Err(mpsc::error::TrySendError::Closed(_)) => *listener = None, + _ => {} + } + } + } + } + } +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/mod.rs b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/mod.rs new file mode 100644 index 0000000..2680be3 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/mod.rs @@ -0,0 +1,37 @@ +use std::sync::{Arc, Mutex}; + +use anyhow::Result; +use cpal::traits::HostTrait; +use tokio::task::LocalSet; + +use audio_to_ts::AudioToTs; +use ts_to_audio::TsToAudio; + +pub mod audio_to_ts; +pub mod ts_to_audio; + +/// The usual frame size. +/// +/// Use 48 kHz, 20 ms frames (50 per second) and mono data (1 channel). +/// This means 1920 samples and 7.5 kiB. +const USUAL_FRAME_SIZE: usize = 48000 / 50; + +/// The maximum size of an opus frame is 1275 as from RFC6716. +const MAX_OPUS_FRAME_SIZE: usize = 1275; + +#[derive(Clone)] +pub struct AudioData { + pub a2ts: Arc>, + pub ts2a: Arc>, +} + +pub(crate) fn start(local_set: &LocalSet) -> Result { + let host = cpal::default_host(); + let output_device = host.default_output_device().unwrap(); + let input_device = host.default_input_device().unwrap(); + + let ts2a = TsToAudio::new(output_device, local_set)?; + let a2ts = AudioToTs::new(input_device, local_set)?; + + Ok(AudioData { a2ts, ts2a }) +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/ts_to_audio.rs b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/ts_to_audio.rs new file mode 100644 index 0000000..53622ea --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/audio_utils/ts_to_audio.rs @@ -0,0 +1,138 @@ +use std::sync::{Arc, Mutex}; + +use anyhow::{Result, format_err}; +use cpal::traits::{DeviceTrait, StreamTrait}; +use cpal::{Device, Stream, StreamConfig}; +use futures::prelude::*; +use tokio::task::LocalSet; +use tokio::time::{self, Duration}; +use tokio_stream::wrappers::IntervalStream; +use tracing::{debug, error, instrument}; +use tsclientlib::ClientId; +use tsproto_packets::packets::InAudioBuf; + +use super::*; +use crate::ConnectionId; + +type Id = (ConnectionId, ClientId); +type AudioHandler = tsclientlib::audio::AudioHandler; + +pub struct TsToAudio { + device: Device, + stream: Option, + is_playing: bool, + data: Arc>, +} + +struct Callback { + data: Arc>, +} + +impl TsToAudio { + pub fn new(device: Device, local_set: &LocalSet) -> Result>> { + let data = Arc::new(Mutex::new(AudioHandler::new())); + + let res = Arc::new(Mutex::new(Self { device, stream: None, is_playing: false, data })); + + Self::start(res.clone(), local_set); + + Ok(res) + } + + #[instrument(skip(self))] + fn open_playback(&self) -> Result { + let config = StreamConfig { + channels: 2, + sample_rate: 48000, + buffer_size: cpal::BufferSize::Fixed(USUAL_FRAME_SIZE as u32), + }; + + let mut callback = Callback { data: self.data.clone() }; + + self.device + .build_output_stream( + config, + move |audio_data, _| callback.callback(audio_data), + |error| error!(%error, "Error during audio playback"), + Some(Duration::from_secs(5)), + ) + .map_err(|e| format_err!("cpal error: {}", e)) + } + + #[instrument(skip(t2a, local_set))] + fn start(t2a: Arc>, local_set: &LocalSet) { + local_set.spawn_local( + IntervalStream::new(time::interval(Duration::from_secs(1))).for_each(move |_| { + let mut t2a = t2a.lock().unwrap(); + + if t2a.stream.is_none() { + // Try to reconnect to audio + match t2a.open_playback() { + Ok(s) => { + t2a.stream = Some(s); + t2a.is_playing = false; + debug!("Reconnected to playback device"); + } + Err(error) => { + error!(%error, "Failed to open playback device"); + } + }; + } + + if let Some(stream) = &t2a.stream { + let data_empty = t2a.data.lock().unwrap().get_queues().is_empty(); + if !t2a.is_playing && !data_empty { + debug!("Resuming playback"); + if let Err(error) = stream.play() { + error!(%error, "Failed to start stream"); + t2a.stream = None; + } else { + t2a.is_playing = true; + } + } else if t2a.is_playing && data_empty { + debug!("Pausing playback"); + if let Err(error) = stream.pause() { + error!(%error, "Failed to pause stream"); + t2a.stream = None; + } + t2a.is_playing = false; + } + } + future::ready(()) + }), + ); + } + + #[instrument(skip(self, id, packet))] + pub(crate) fn play_packet(&mut self, id: Id, packet: InAudioBuf) -> Result<()> { + { + let mut data = self.data.lock().unwrap(); + data.handle_packet(id, packet)?; + } + + if !self.is_playing { + if let Some(stream) = &self.stream { + debug!("Resuming playback"); + if let Err(error) = stream.play() { + error!(%error, "Failed to start stream"); + self.stream = None; + } else { + self.is_playing = true; + } + } + } + Ok(()) + } +} + +impl Callback { + fn callback(&mut self, buffer: &mut [f32]) { + // Clear buffer + for d in &mut *buffer { + *d = 0.0; + } + + let mut data = self.data.lock().unwrap(); + data.fill_buffer(buffer); + } +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/channeltree.rs b/native/vendor/tsclientlib/tsclientlib/examples/channeltree.rs new file mode 100644 index 0000000..2365ed0 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/channeltree.rs @@ -0,0 +1,129 @@ +use anyhow::{bail, Result}; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; + +use tsclientlib::data::{self, Channel, Client}; +use tsclientlib::prelude::*; +use tsclientlib::{ChannelId, Connection, DisconnectOptions, Identity, StreamItem}; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +/// `channels` have to be ordered. +fn print_channels(clients: &[&Client], channels: &[&Channel], parent: ChannelId, depth: usize) { + let indention = " ".repeat(depth); + for channel in channels { + if channel.parent == parent { + println!("{}- {}", indention, channel.name); + // Print all clients in this channel + for client in clients { + if client.channel == channel.id { + println!("{} {}", indention, client.name); + } + } + + print_channels(clients, channels, channel.id, depth + 1); + } + } +} + +fn print_channel_tree(con: &data::Connection) { + let mut channels: Vec<_> = con.channels.values().collect(); + let mut clients: Vec<_> = con.clients.values().collect(); + // This is not the real sorting order, the order is the ChannelId of the + // channel on top of this one, but we don't care for this example. + channels.sort_by_key(|ch| ch.order.0); + clients.sort_by_key(|c| c.talk_power); + println!("{}", con.server.name); + print_channels(&clients, &channels, ChannelId(0), 0); +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_config = Connection::build(args.address) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + // Connect + let mut con = con_config.connect()?; + + let r = con + .events() + .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + .next() + .await; + if let Some(r) = r { + r?; + } + + con.get_state().unwrap().server.set_subscribed(true).send(&mut con)?; + + // Wait some time + let mut events = con.events().try_filter(|_| future::ready(false)); + tokio::select! { + _ = time::sleep(Duration::from_secs(1)) => {} + _ = events.next() => { + bail!("Disconnected"); + } + }; + drop(events); + + // Print channel tree + print_channel_tree(con.get_state().unwrap()); + + // Change name + { + let state = con.get_state().unwrap(); + let name = state.clients[&state.own_client].name.clone(); + state + .client_update() + .set_input_muted(true) + .set_name(&format!("{}1", name)) + .send(&mut con)?; + } + + // Wait some time + let mut events = con.events().try_filter(|_| future::ready(false)); + tokio::select! { + _ = time::sleep(Duration::from_secs(3)) => {} + _ = events.next() => { + bail!("Disconnected"); + } + }; + drop(events); + + // Disconnect + con.disconnect(DisconnectOptions::new())?; + con.events().for_each(|_| future::ready(())).await; + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/many.rs b/native/vendor/tsclientlib/tsclientlib/examples/many.rs new file mode 100644 index 0000000..1e0f2e8 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/many.rs @@ -0,0 +1,86 @@ +use anyhow::Result; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; +use tracing::error; + +use tsclientlib::{Connection, DisconnectOptions, Identity, StreamItem}; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, + /// How many connections + #[arg()] + count: usize, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_config = Connection::build(args.address.as_str()) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + stream::iter(0..args.count) + .for_each_concurrent(None, |_| { + let con_config = con_config.clone(); + tokio::spawn(async move { + // Connect + let mut con = con_config.connect().unwrap(); + + let r = con + .events() + .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + .next() + .await; + if let Some(Err(error)) = r { + error!(%error, "Connection failed"); + return; + } + + // Wait some time + let mut events = con.events().try_filter(|_| future::ready(false)); + tokio::select! { + _ = time::sleep(Duration::from_secs(15)) => {} + _ = events.next() => { + error!("Disconnected unexpectedly"); + return; + } + }; + drop(events); + + // Disconnect + let _ = con.disconnect(DisconnectOptions::new()); + con.events().for_each(|_| future::ready(())).await; + }) + .map(|_| ()) + }) + .await; + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/simple-sync.rs b/native/vendor/tsclientlib/tsclientlib/examples/simple-sync.rs new file mode 100644 index 0000000..c77b5e6 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/simple-sync.rs @@ -0,0 +1,78 @@ +use anyhow::Result; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; + +use tsclientlib::sync::SyncConnection; +use tsclientlib::{Connection, DisconnectOptions, Identity}; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_config = Connection::build(args.address) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + // Connect + let con: SyncConnection = con_config.connect()?.into(); + let mut handle = con.get_handle(); + + // Do event handling in another thread + tokio::spawn(con.for_each(|_| future::ready(()))); + + handle.wait_until_connected().await?; + + let welcome_message = handle + .with_connection(|con| Result::<_>::Ok(con.get_state()?.server.welcome_message.clone())) + .await??; + println!("Server welcome message: {}", sanitize(&welcome_message)); + + // Wait some time + time::sleep(Duration::from_secs(1)).await; + + // Disconnect + handle.disconnect(DisconnectOptions::new()).await?; + + Ok(()) +} + +/// Only retain a certain set of characters. +fn sanitize(s: &str) -> String { + s.chars() + .filter(|c| { + c.is_alphanumeric() + || [' ', '\t', '.', ':', '-', '_', '"', '\'', '/', '(', ')', '[', ']', '{', '}'] + .contains(c) + }) + .collect() +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/simple.rs b/native/vendor/tsclientlib/tsclientlib/examples/simple.rs new file mode 100644 index 0000000..ce6384d --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/simple.rs @@ -0,0 +1,85 @@ +use anyhow::{bail, Result}; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; + +use tsclientlib::{Connection, DisconnectOptions, Identity, StreamItem}; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_config = Connection::build(args.address) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + // Connect + let mut con = con_config.connect()?; + + let r = con + .events() + .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + .next() + .await; + if let Some(r) = r { + r?; + } + + println!("Server welcome message: {}", sanitize(&con.get_state()?.server.welcome_message)); + + // Wait some time + let mut events = con.events().try_filter(|_| future::ready(false)); + tokio::select! { + _ = time::sleep(Duration::from_secs(1)) => {} + _ = events.next() => { + bail!("Disconnected"); + } + }; + drop(events); + + // Disconnect + con.disconnect(DisconnectOptions::new())?; + con.events().for_each(|_| future::ready(())).await; + + Ok(()) +} + +/// Only retain a certain set of characters. +fn sanitize(s: &str) -> String { + s.chars() + .filter(|c| { + c.is_alphanumeric() + || [' ', '\t', '.', ':', '-', '_', '"', '\'', '/', '(', ')', '[', ']', '{', '}'] + .contains(c) + }) + .collect() +} diff --git a/native/vendor/tsclientlib/tsclientlib/examples/sync.rs b/native/vendor/tsclientlib/tsclientlib/examples/sync.rs new file mode 100644 index 0000000..0829d7d --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/examples/sync.rs @@ -0,0 +1,77 @@ +use anyhow::Result; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; + +use tsclientlib::prelude::*; +use tsclientlib::sync::SyncConnection; +use tsclientlib::{Connection, DisconnectOptions, Identity, StreamItem}; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "localhost")] + address: String, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + tracing_subscriber::fmt::init(); + + // Parse command line options + let args = Args::parse(); + + let con_config = Connection::build(args.address) + .log_commands(args.verbose >= 1) + .log_packets(args.verbose >= 2) + .log_udp_packets(args.verbose >= 3); + + // Optionally set the key of this client, otherwise a new key is generated. + let id = Identity::new_from_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITs\ + C/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + let con_config = con_config.identity(id); + + // Connect + let mut con = con_config.connect()?; + let r = con + .events() + .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + .next() + .await; + if let Some(r) = r { + r?; + } + + let sync_con: SyncConnection = con.into(); + let mut con = sync_con.get_handle(); + + tokio::spawn(sync_con.for_each(|_| future::ready(()))); + + con.with_connection(move |mut con| { + let state = con.get_state()?; + state.server.send_textmessage("Hello there").send(&mut con)?; + Result::<_>::Ok(()) + }) + .await??; + + // Wait some time + time::sleep(Duration::from_secs(1)).await; + + // Disconnect + con.disconnect(DisconnectOptions::new()).await?; + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsclientlib/src/audio.rs b/native/vendor/tsclientlib/tsclientlib/src/audio.rs new file mode 100644 index 0000000..2b6fc34 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/audio.rs @@ -0,0 +1,876 @@ +//! Handle receiving audio. +//! +//! The [`AudioHandler`] collects all incoming audio packets and queues them per +//! client. It decodes the audio, handles out-of-order packets and missing +//! packets. It automatically adjusts the queue length based on the jitter of +//! incoming packets. + +use std::cmp::Reverse; +use std::collections::{HashMap, VecDeque}; +use std::convert::TryInto; +use std::fmt::Debug; +use std::hash::Hash; + +use audiopus::coder::Decoder; +#[cfg(feature = "audiopus-unstable")] +use audiopus::coder::GenericCtl; +use audiopus::{Channels, SampleRate, packet}; +use thiserror::Error; +use tracing::{Span, debug, info_span, trace, warn}; +use tsproto_packets::packets::{AudioData, CodecType, InAudioBuf}; + +use crate::ClientId; + +const SAMPLE_RATE: SampleRate = SampleRate::Hz48000; +const CHANNELS: Channels = Channels::Stereo; +const CHANNEL_NUM: usize = 2; +/// If this amount of packets is lost consecutively, we assume the stream stopped. +const MAX_PACKET_LOSSES: usize = 3; +/// Store the buffer sizes for the last `LAST_BUFFER_SIZE_COUNT` packets. +const LAST_BUFFER_SIZE_COUNT: u8 = 255; +/// The amount of samples to maximally buffer. Equivalent to 0.5 s. +const MAX_BUFFER_SIZE: usize = 48_000 / 2; +/// Maximum number of packets in the queue. +const MAX_BUFFER_PACKETS: usize = 50; +/// Buffer for maximal 0.5 s without playing anything. +const MAX_BUFFER_TIME: usize = 48_000 / 2; +/// Duplicate or remove every `step` sample when speeding-up. +const SPEED_CHANGE_STEPS: usize = 100; +/// The usual amount of samples in a frame. +/// +/// Use 48 kHz, 20 ms frames (50 per second) and mono data (1 channel). +/// This means 1920 samples and 7.5 kiB. +const USUAL_FRAME_SIZE: usize = 48000 / 50; + +type Result = std::result::Result; + +#[derive(Debug, Error)] +#[non_exhaustive] +pub enum Error { + #[error("Failed to create opus decoder: {0}")] + CreateDecoder(#[source] audiopus::Error), + #[error("Opus decode failed: {error} (packet: {packet:?})")] + Decode { + #[source] + error: audiopus::Error, + packet: Option>, + }, + #[error("Get duplicate packet id {0}")] + Duplicate(u16), + #[error("Failed to get packet samples: {0}")] + GetPacketSample(#[source] audiopus::Error), + #[error("Audio queue is full, dropping")] + QueueFull, + #[error("Audio packet is too late, dropping (wanted {wanted}, got {got})")] + TooLate { wanted: u16, got: u16 }, + #[error("Packet has too many samples")] + TooManySamples, + #[error("Only opus audio is supported, ignoring {0:?}")] + UnsupportedCodec(CodecType), +} + +#[derive(Clone, Debug)] +struct SlidingWindowMinimum { + /// How long a value stays in the sliding window. + size: u8, + /// This is a sliding window minimum, it contains + /// `(insertion time, value)`. + /// + /// When we insert a value, we can remove all bigger sample counts, + /// thus the queue always stays sorted with the minimum at the front + /// and the maximum at the back (latest entry). + /// + /// Provides amortized O(1) minimum. + /// Source: https://people.cs.uct.ac.za/~ksmith/articles/sliding_window_minimum.html#sliding-window-minimum-algorithm + queue: VecDeque<(u8, T)>, + /// The current insertion time. + cur_time: u8, +} + +#[derive(Debug)] +struct QueuePacket { + packet: InAudioBuf, + samples: usize, + id: u16, +} + +/// A queue for audio packets for one audio stream. +pub struct AudioQueue { + span: Span, + decoder: Decoder, + pub volume: f32, + /// The id of the next packet that should be decoded. + /// + /// Used to check for packet loss. + next_id: u16, + /// If the last packet was a whisper packet. + whispering: bool, + packet_buffer: VecDeque, + /// Amount of samples in the `packet_buffer`. + packet_buffer_samples: usize, + /// Temporary buffer that contains the samples of one decoded packet. + decoded_buffer: Vec, + /// The number of samples in `decoded_buffer` that have been returned. + decoded_pos: usize, + /// The number of samples in the last packet. + last_packet_samples: usize, + /// The last `packet_loss_num` packet decodes were a loss. + packet_loss_num: usize, + /// The amount of samples to buffer until this queue is ready to play. + buffering_samples: usize, + /// The amount of packets in the buffer when a packet was decoded. + /// + /// Uses the amount of samples in the `packet_buffer` / `USUAL_PACKET_SAMPLES`. + /// Used to expand or reduce the buffer. + last_buffer_size_min: SlidingWindowMinimum, + last_buffer_size_max: SlidingWindowMinimum>, + /// Buffered for this duration. + buffered_for_samples: usize, +} + +/// Handles incoming audio, has one [`AudioQueue`] per sending client. +pub struct AudioHandler { + queues: HashMap, + /// Buffer this amount of samples for new queues before starting to play. + /// + /// Updated when a new queue gets added. + avg_buffer_samples: usize, +} + +impl SlidingWindowMinimum { + fn new(size: u8) -> Self { Self { size, queue: Default::default(), cur_time: 0 } } + + fn push(&mut self, value: T) { + while self.queue.back().map(|(_, s)| *s >= value).unwrap_or_default() { + self.queue.pop_back(); + } + let i = self.cur_time; + self.queue.push_back((i, value)); + while self + .queue + .front() + .map(|(i, _)| self.cur_time.wrapping_sub(*i) >= self.size) + .unwrap_or_default() + { + self.queue.pop_front(); + } + self.cur_time = self.cur_time.wrapping_add(1); + } + + fn get_min(&self) -> T { self.queue.front().map(|(_, s)| *s).unwrap_or_default() } +} + +impl AudioQueue { + fn new(packet: InAudioBuf) -> Result { + let data = packet.data().data(); + let opus_packet = data.data().try_into().map_err(Error::GetPacketSample)?; + let last_packet_samples = + packet::nb_samples(opus_packet, SAMPLE_RATE).map_err(Error::GetPacketSample)?; + if last_packet_samples > MAX_BUFFER_SIZE { + return Err(Error::TooManySamples); + } + + let last_packet_samples = last_packet_samples * CHANNEL_NUM; + let whispering = matches!(data, AudioData::S2CWhisper { .. }); + let decoder = Decoder::new(SAMPLE_RATE, CHANNELS).map_err(Error::CreateDecoder)?; + + // Enable DRED and NoLACE, ignore errors e.g. if unsupported + #[cfg(feature = "audiopus-unstable")] + let decoder = { + let mut decoder = decoder; + if let Err(error) = decoder.set_complexity(7) { + debug!(%error, "Failed setting opus decoder complexity, ignoring"); + } + decoder + }; + + let mut res = Self { + span: Span::current(), + decoder, + volume: 1.0, + next_id: data.id(), + whispering, + packet_buffer: Default::default(), + packet_buffer_samples: 0, + decoded_buffer: Default::default(), + decoded_pos: 0, + last_packet_samples, + packet_loss_num: 0, + buffering_samples: 0, + last_buffer_size_min: SlidingWindowMinimum::new(LAST_BUFFER_SIZE_COUNT), + last_buffer_size_max: SlidingWindowMinimum::>::new(LAST_BUFFER_SIZE_COUNT), + buffered_for_samples: 0, + }; + res.add_buffer_size(0); + res.add_packet(packet)?; + Ok(res) + } + + pub fn get_decoder(&self) -> &Decoder { &self.decoder } + pub fn is_whispering(&self) -> bool { self.whispering } + + /// Size is in samples. + fn add_buffer_size(&mut self, size: usize) { + if let Ok(size) = (size / USUAL_FRAME_SIZE).try_into() { + self.last_buffer_size_min.push(size); + self.last_buffer_size_max.push(Reverse(size)); + } else { + warn!(parent: &self.span, size, "Failed to put amount of packets into an u8"); + } + } + + /// The approximate deviation of the buffer size. + fn get_deviation(&self) -> u8 { + let min = self.last_buffer_size_min.get_min(); + let max = self.last_buffer_size_max.get_min(); + max.0 - min + } + + fn add_packet(&mut self, packet: InAudioBuf) -> Result<()> { + let _span = self.span.enter(); + if self.packet_buffer.len() >= MAX_BUFFER_PACKETS { + return Err(Error::QueueFull); + } + let samples; + if packet.data().data().data().len() <= 1 { + // End of stream + samples = 0; + } else { + let opus_packet = + packet.data().data().data().try_into().map_err(Error::GetPacketSample)?; + samples = + packet::nb_samples(opus_packet, SAMPLE_RATE).map_err(Error::GetPacketSample)?; + if samples > MAX_BUFFER_SIZE { + return Err(Error::TooManySamples); + } + } + + let id = packet.data().data().id(); + let packet = QueuePacket { packet, samples, id }; + if id.wrapping_sub(self.next_id) > MAX_BUFFER_PACKETS as u16 { + return Err(Error::TooLate { wanted: self.next_id, got: id }); + } + + // Put into first spot where the id is smaller + let i = self.packet_buffer.len() + - self + .packet_buffer + .iter() + .enumerate() + .rev() + .take_while(|(_, p)| p.id.wrapping_sub(id) <= MAX_BUFFER_PACKETS as u16) + .count(); + // Check for duplicate packet + if let Some(p) = self.packet_buffer.get(i) { + if p.id == packet.id { + return Err(Error::Duplicate(p.id)); + } + } + + trace!("Insert packet {} at {}", id, i); + let last_id = self.packet_buffer.back().map(|p| p.id.wrapping_add(1)).unwrap_or(id); + if last_id <= id { + self.buffering_samples = self.buffering_samples.saturating_sub(samples); + // Reduce buffering counter by lost packets if there are some + self.buffering_samples = self + .buffering_samples + .saturating_sub(usize::from(id - last_id) * self.last_packet_samples); + } + + self.packet_buffer_samples += packet.samples; + self.packet_buffer.insert(i, packet); + + Ok(()) + } + + fn decode_packet(&mut self, packet: Option<&QueuePacket>, fec: bool) -> Result<()> { + let _span = self.span.clone().entered(); + trace!(has_packet = packet.is_some(), fec, "Decoding packet"); + let packet_data; + let len; + if let Some(p) = packet { + packet_data = + Some(p.packet.data().data().data().try_into().map_err(Error::GetPacketSample)?); + len = p.samples; + self.whispering = matches!(p.packet.data().data(), AudioData::S2CWhisper { .. }); + } else { + packet_data = None; + len = self.last_packet_samples; + } + self.packet_loss_num += 1; + + let orig_buffer_len = self.decoded_buffer.len(); + self.decoded_buffer.resize(orig_buffer_len + len * CHANNEL_NUM, 0.0); + let len = self + .decoder + .decode_float( + packet_data, + (&mut self.decoded_buffer[orig_buffer_len..]) + .try_into() + .map_err(Error::GetPacketSample)?, + fec, + ) + .map_err(|e| Error::Decode { + error: e, + packet: packet.map(|p| p.packet.raw_data().to_vec()), + })?; + self.last_packet_samples = len; + self.decoded_buffer.truncate(orig_buffer_len + len * CHANNEL_NUM); + + // Update packet_loss_num + if packet.is_some() && !fec { + self.packet_loss_num = 0; + } + + // Update last_buffer_size + let mut count = self.packet_buffer_samples; + if let Some(last) = self.packet_buffer.back() { + // Lost packets + trace!( + last.id, + next_id = self.next_id, + first_id = self.packet_buffer.front().unwrap().id, + buffer_len = self.packet_buffer.len(), + "Ids" + ); + count += (usize::from(last.id.wrapping_sub(self.next_id)) + 1 + - self.packet_buffer.len()) + * self.last_packet_samples; + } + self.add_buffer_size(count); + + Ok(()) + } + + /// Decode data and return the requested length of buffered data. + /// + /// Returns `true` in the second return value when the stream ended, + /// `false` when it continues normally. + pub fn get_next_data(&mut self, len: usize) -> Result<(&[f32], bool)> { + let _span = self.span.clone().entered(); + if self.buffering_samples > 0 { + if self.buffered_for_samples >= MAX_BUFFER_TIME { + self.buffering_samples = 0; + self.buffered_for_samples = 0; + trace!( + buffered_for_samples = self.buffered_for_samples, + buffering_samples = self.buffering_samples, + "Buffered for too long" + ); + } else { + self.buffered_for_samples += len; + trace!( + buffered_for_samples = self.buffered_for_samples, + buffering_samples = self.buffering_samples, + "Buffering" + ); + return Ok((&[], false)); + } + } + // Need to refill buffer + self.decoded_buffer.drain(..self.decoded_pos); + + while self.decoded_buffer.len() < len { + trace!(decoded_buffer = self.decoded_buffer.len(), len, "get_next_data"); + + // Decode a packet + if let Some(packet) = self.packet_buffer.pop_front() { + if packet.packet.data().data().data().len() <= 1 { + // End of stream + return Ok((&self.decoded_buffer, true)); + } + + self.packet_buffer_samples -= packet.samples; + let cur_id = self.next_id; + self.next_id = self.next_id.wrapping_add(1); + if packet.id != cur_id { + debug_assert!( + packet.id.wrapping_sub(cur_id) < MAX_BUFFER_PACKETS as u16, + "Invalid packet queue state: {} < {}", + packet.id, + cur_id + ); + // Packet loss + debug!(need = cur_id, have = packet.id, "Audio packet loss"); + if packet.id == self.next_id { + // Can use forward-error-correction + self.decode_packet(Some(&packet), true)?; + } else { + self.decode_packet(None, false)?; + } + self.packet_buffer_samples += packet.samples; + self.packet_buffer.push_front(packet); + } else { + self.decode_packet(Some(&packet), false)?; + } + } else { + debug!("No packets in queue"); + // Packet loss or end of stream + self.decode_packet(None, false)?; + } + + if self.last_packet_samples == 0 { + break; + } + + // Check if we should speed-up playback + let min = self.last_buffer_size_min.get_min(); + let dev = self.get_deviation(); + if min > (MAX_BUFFER_SIZE / USUAL_FRAME_SIZE) as u8 { + debug!(min, "Truncating buffer"); + // Throw out all but min samples + let mut keep_samples = 0; + let keep = self + .packet_buffer + .iter() + .rev() + .take_while(|p| { + keep_samples += p.samples; + keep_samples < usize::from(min) + USUAL_FRAME_SIZE + }) + .count(); + let len = self.packet_buffer.len() - keep; + self.packet_buffer.drain(..len); + self.packet_buffer_samples = self.packet_buffer.iter().map(|p| p.samples).sum(); + if let Some(p) = self.packet_buffer.front() { + self.next_id = p.id; + } + } else if min > dev { + // Speed-up + debug!( + min, + cur_packet_count = self.packet_buffer.len(), + last_packet_samples = self.last_packet_samples, + dev, + "Speed-up buffer" + ); + let start = self.decoded_buffer.len() - self.last_packet_samples * CHANNEL_NUM; + for i in 0..(self.last_packet_samples / SPEED_CHANGE_STEPS) { + let i = start + i * (SPEED_CHANGE_STEPS - 1) * CHANNEL_NUM; + self.decoded_buffer.drain(i..(i + CHANNEL_NUM)); + } + } + } + + self.decoded_pos = len; + Ok((&self.decoded_buffer[..len], false)) + } +} + +impl Default for AudioHandler { + fn default() -> Self { Self { queues: Default::default(), avg_buffer_samples: 0 } } +} + +impl AudioHandler { + pub fn new() -> Self { Default::default() } + + /// Delete all queues + pub fn reset(&mut self) { self.queues.clear(); } + + pub fn get_queues(&self) -> &HashMap { &self.queues } + pub fn get_mut_queues(&mut self) -> &mut HashMap { &mut self.queues } + + /// `buf` is not cleared before filling it. + /// + /// Returns the clients that are not talking anymore. + pub fn fill_buffer(&mut self, buf: &mut [f32]) -> Vec { + self.fill_buffer_with_proc(buf, |_, _| {}) + } + + /// `buf` is not cleared before filling it. + /// + /// Same as [`fill_buffer`] but before merging a queue into the output buffer, a preprocessor + /// function is called. The queue volume is applied after calling the preprocessor. + /// + /// Returns the clients that are not talking anymore. + pub fn fill_buffer_with_proc( + &mut self, buf: &mut [f32], mut handle: F, + ) -> Vec { + trace!(len = buf.len(), "Filling audio buffer"); + let mut to_remove = Vec::new(); + for (id, queue) in self.queues.iter_mut() { + if queue.packet_loss_num >= MAX_PACKET_LOSSES { + debug!(packet_loss_num = queue.packet_loss_num, "Removing talker"); + to_remove.push(id.clone()); + continue; + } + + let vol = queue.volume; + match queue.get_next_data(buf.len()) { + Err(error) => { + warn!(%error, "Failed to decode audio packet"); + } + Ok((r, is_end)) => { + handle(id, r); + for i in 0..r.len() { + buf[i] += r[i] * vol; + } + if is_end { + to_remove.push(id.clone()); + } + } + } + } + + for id in &to_remove { + self.queues.remove(id); + } + to_remove + } + + /// Add a packet to the audio queue. + /// + /// If a new client started talking, returns the id of this client. + pub fn handle_packet(&mut self, id: Id, packet: InAudioBuf) -> Result> { + let empty = packet.data().data().data().len() <= 1; + let codec = packet.data().data().codec(); + if codec != CodecType::OpusMusic && codec != CodecType::OpusVoice { + return Err(Error::UnsupportedCodec(codec)); + } + + if let Some(queue) = self.queues.get_mut(&id) { + queue.add_packet(packet)?; + Ok(None) + } else { + if empty { + return Ok(None); + } + + let _span = info_span!("audio queue", client = ?id); + trace!("Adding talker"); + let mut queue = AudioQueue::new(packet)?; + if !self.queues.is_empty() { + // Update avg_buffer_samples + self.avg_buffer_samples = USUAL_FRAME_SIZE + + self + .queues + .values() + .map(|q| usize::from(q.last_buffer_size_min.get_min())) + .sum::() / self.queues.len(); + } + queue.buffering_samples = self.avg_buffer_samples; + self.queues.insert(id.clone(), queue); + Ok(Some(id)) + } + } +} + +#[cfg(test)] +mod test { + use anyhow::{Result, bail}; + use audiopus::coder::Encoder; + use tsproto_packets::packets::{Direction, OutAudio}; + + use super::*; + use crate::tests::create_logger; + + enum SimulateAction { + CreateEncoder, + /// Create packet with id. + /// + /// The `bool` is `false` if packet handling should fail. + ReceivePacket(u16, bool), + ReceiveRaw(u16, Vec), + /// Fetch audio of this sample count and expect a certain packet id. + FillBuffer(usize, Option), + /// Custom check + Check(Box)>), + } + + /// Helper function to check an audio packet. + #[allow(dead_code)] + fn check_packet(data: &[u8]) -> Result<()> { + create_logger(); + let mut handler = AudioHandler::::new(); + let id = ClientId(0); + let mut buf = vec![0.0; 48_000 / 100 * 2]; + + // Sometimes, TS sends short, non-opus packets + let packet = + OutAudio::new(&AudioData::S2C { id: 30, codec: CodecType::OpusMusic, from: 0, data }); + let input = InAudioBuf::try_new(Direction::S2C, packet.into_vec()).unwrap(); + handler.handle_packet(id, input)?; + + handler.fill_buffer(&mut buf); + handler.fill_buffer(&mut buf); + Ok(()) + } + + fn simulate(actions: Vec) -> Result<()> { + let mut encoder = None; + let mut opus_output = [0; 1275]; // Max size for an opus packet + let id = ClientId(0); + create_logger(); + let mut handler = AudioHandler::::new(); + + for a in actions { + println!("\nCurrent state"); + for q in &handler.queues { + print!("Queue {:?}:", q.0); + for p in &q.1.packet_buffer { + print!(" {:?},", p); + } + println!(); + } + + match a { + SimulateAction::CreateEncoder => { + encoder = Some(Encoder::new( + audiopus::SampleRate::Hz48000, + audiopus::Channels::Mono, + audiopus::Application::Voip, + )?); + } + SimulateAction::ReceivePacket(i, success) => { + let e = encoder.as_mut().unwrap(); + let data = vec![i as f32; USUAL_FRAME_SIZE]; + let len = e.encode_float(&data, &mut opus_output[..])?; + let packet = OutAudio::new(&AudioData::S2C { + id: i, + codec: CodecType::OpusMusic, + from: 0, + data: &opus_output[..len], + }); + let input = InAudioBuf::try_new(Direction::S2C, packet.into_vec()).unwrap(); + if handler.handle_packet(id, input).is_ok() != success { + bail!("handle_packet returned {:?} but expected {:?}", !success, success); + } + } + SimulateAction::ReceiveRaw(i, data) => { + let packet = OutAudio::new(&AudioData::S2C { + id: i, + codec: CodecType::OpusMusic, + from: 0, + data: &data, + }); + let input = InAudioBuf::try_new(Direction::S2C, packet.into_vec()).unwrap(); + let _ = handler.handle_packet(id, input); + } + SimulateAction::FillBuffer(size, expect) => { + let mut buf = vec![0.0; size * 2]; // Stereo + let cur_packet_id = + handler.queues.get(&id).and_then(|q| q.packet_buffer.front()).map(|p| p.id); + handler.fill_buffer(&mut buf); + let next_packet_id = + handler.queues.get(&id).and_then(|q| q.packet_buffer.front()).map(|p| p.id); + + if expect.is_some() { + assert_eq!(expect, cur_packet_id); + assert_ne!(cur_packet_id, next_packet_id); + } + + /*if let Some(e) = expect { + let e = *e as f32; + for b in &buf { + if (*b - e).abs() > 0.01 { + bail!("Buffer contains wrong value, \ + expected {}: {:?}", e, buf); + } + } + }*/ + } + SimulateAction::Check(f) => { + f(&handler); + } + } + } + Ok(()) + } + + #[test] + fn sliding_window_minimum() { + let data = &[ + (5, 5), + (6, 5), + (3, 3), + (4, 3), + (6, 3), + (5, 3), + (6, 3), + (6, 4), + (6, 5), + (6, 5), + (6, 6), + (7, 6), + (5, 5), + ]; + let mut window = SlidingWindowMinimum::new(5); + assert_eq!(window.get_min(), 0); + for (i, (val, min)) in data.iter().enumerate() { + println!("{:?}", window); + window.push(*val); + assert_eq!(window.get_min(), *min, "Failed in iteration {} ({:?})", i, window); + } + } + + #[test] + fn sliding_window_minimum_full() { + let mut window = SlidingWindowMinimum::new(255); + window.push(1); + assert_eq!(window.get_min(), 1); + for _ in 0..254 { + window.push(2); + } + assert_eq!(window.get_min(), 1); + window.push(2); + assert_eq!(window.get_min(), 2); + } + + #[test] + fn packets_wrapping() { + create_logger(); + let mut handler = AudioHandler::::new(); + let id = ClientId(0); + let mut buf = vec![0.0; 48_000 / 100 * 2]; + + for i in 0..100 { + let packet = OutAudio::new(&AudioData::S2C { + id: 65_500u16.wrapping_add(i), + codec: CodecType::OpusMusic, + from: 0, + data: &[0, 0, 0, 0, 0, 0, 0], + }); + let input = InAudioBuf::try_new(Direction::S2C, packet.into_vec()).unwrap(); + handler.handle_packet(id, input).unwrap(); + + if i > 5 { + handler.fill_buffer(&mut buf); + } + } + } + + #[quickcheck_macros::quickcheck] + fn short_packet_quickcheck(data: Vec>) { + create_logger(); + let mut handler = AudioHandler::::new(); + let id = ClientId(0); + let mut buf = vec![0.0; 48_000 / 100 * 2]; + + for p in data { + // Sometimes, TS sends short, non-opus packets + let packet = OutAudio::new(&AudioData::S2C { + id: 30, + codec: CodecType::OpusMusic, + from: 0, + data: &p, + }); + let input = InAudioBuf::try_new(Direction::S2C, packet.into_vec()).unwrap(); + let _ = handler.handle_packet(id, input); + + handler.fill_buffer(&mut buf); + handler.fill_buffer(&mut buf); + } + } + + #[test] + fn packets_wrapping2() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + for i in 0..100 { + let i = 65_500u16.wrapping_add(i); + a.push(SimulateAction::ReceivePacket(i, true)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, Some(i))); + } + for _ in 0..4 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } + + #[test] + fn silence() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + for _ in 0..100 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + simulate(a) + } + + #[test] + fn reversed() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + for i in 0..5 { + a.push(SimulateAction::ReceivePacket(i, true)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, Some(i))); + } + a.push(SimulateAction::ReceivePacket(4, false)); + a.push(SimulateAction::ReceivePacket(3, false)); + for _ in 0..4 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } + + #[test] + fn duplicate() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + a.push(SimulateAction::ReceivePacket(0, true)); + a.push(SimulateAction::ReceivePacket(0, false)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, Some(0))); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + simulate(a) + } + + #[test] + fn big_whole() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + for i in 27120..27124 { + a.push(SimulateAction::ReceivePacket(i, true)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, Some(i))); + } + a.push(SimulateAction::ReceiveRaw(27124, vec![2])); + for _ in 0..10 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + for i in 27339..27349 { + a.push(SimulateAction::ReceivePacket(i, true)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + for _ in 0..4 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } + + #[test] + fn end_packet() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + for i in 0..10 { + a.push(SimulateAction::ReceivePacket(i, true)); + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, Some(i))); + } + a.push(SimulateAction::ReceiveRaw(10, vec![])); + for _ in 0..4 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } + + #[test] + fn packet_loss() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + a.push(SimulateAction::ReceivePacket(50, true)); + a.push(SimulateAction::ReceivePacket(53, true)); + for _ in 0..8 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } + + #[test] + fn packet_wrapping_loss() -> Result<()> { + let mut a = vec![SimulateAction::CreateEncoder]; + a.push(SimulateAction::ReceivePacket(65534, true)); + a.push(SimulateAction::ReceivePacket(0, true)); + for _ in 0..7 { + a.push(SimulateAction::FillBuffer(USUAL_FRAME_SIZE, None)); + } + a.push(SimulateAction::Check(Box::new(|h| assert!(h.queues.is_empty())))); + simulate(a) + } +} diff --git a/native/vendor/tsclientlib/tsclientlib/src/lib.rs b/native/vendor/tsclientlib/tsclientlib/src/lib.rs new file mode 100644 index 0000000..a6c80eb --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/lib.rs @@ -0,0 +1,2042 @@ +//! tsclientlib is a library which makes it simple to create TeamSpeak clients +//! and bots. +//! +//! For a full client application, you might want to have a look at [Qint]. +//! +//! If more power over the internals of a connection is needed, the `unstable` feature can be +//! enabled. Beware that functionality behind this feature may change on any minor release. +//! +//! The base class of this library is the [`Connection`]. One instance of this +//! struct manages a single connection to a server. +//! +//! [Qint]: https://github.com/ReSpeak/Qint +// Needed for futures on windows. +#![recursion_limit = "128"] + +use std::borrow::Cow; +use std::collections::VecDeque; +use std::convert::TryInto; +use std::iter; +use std::mem; +use std::net::SocketAddr; +use std::pin::Pin; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll}; +use std::time::Duration; + +use base64::prelude::*; +use futures::prelude::*; +use thiserror::Error; +use time::OffsetDateTime; +use tokio::io::AsyncWriteExt; +use tokio::net::{TcpStream, UdpSocket}; +use tokio::sync::oneshot; +use tracing::{debug, info, info_span, warn, Instrument, Span}; +use ts_bookkeeping::messages::c2s; +use ts_bookkeeping::messages::OutMessageTrait; +use tsproto::client; +use tsproto::connection::StreamItem as ProtoStreamItem; +use tsproto::resend::ResenderState; +use tsproto_packets::commands::{CommandItem, CommandParser}; +#[cfg(any(feature = "audio", feature = "raw-audio"))] +use tsproto_packets::packets::InAudioBuf; +use tsproto_packets::packets::{InCommandBuf, OutCommand, OutPacket, PacketType}; + +#[cfg(feature = "audio")] +pub mod audio; +pub mod prelude; +pub mod resolver; +pub mod sync; + +// The build environment of tsclientlib. +git_testament::git_testament!(TESTAMENT); + +#[cfg(test)] +mod tests; + +// Reexports +pub use ts_bookkeeping::messages::s2c::InMessage; +// TODO This is bad because it re-exports ConnectOptions +pub use ts_bookkeeping::*; +pub use tsproto::resend::{ConnectionStats, PacketStat}; +pub use tsproto::Identity; +pub use tsproto_types::errors::Error as TsError; + +/// Wait this time for initserver, in seconds. +const INITSERVER_TIMEOUT: u64 = 5; + +type Result = std::result::Result; + +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +pub struct MessageHandle(pub u16); +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +pub struct FiletransferHandle(pub u16); + +#[derive(Clone, Debug, Error, Eq, Hash, PartialEq)] +#[error("{}", error)] +pub struct CommandError { + #[source] + pub error: TsError, + pub missing_permission: Option, +} + +#[derive(Debug, Error)] +#[non_exhaustive] +pub enum Error { + /// A command return an error. + #[error(transparent)] + CommandError(#[from] CommandError), + #[error("Failed to connect: {0}")] + Connect(#[source] tsproto::client::Error), + #[error("Failed to connect to server at {address:?}: {errors:?}")] + ConnectFailed { address: String, errors: Vec }, + #[error("Connection aborted: {0}")] + ConnectionFailed(#[source] tsproto::client::Error), + /// The connection was destroyed. + #[error("Connection does not exist anymore")] + ConnectionGone, + #[error("Server refused connection: {0}")] + ConnectTs(#[source] tsproto_types::errors::Error), + #[error("File transfer failed: {0}")] + FiletransferIo(#[source] std::io::Error), + #[error("Failed to create identity: {0}")] + IdentityCreate(#[source] tsproto::Error), + #[error("The server needs an identity of level {0}, please increase your identity level")] + IdentityLevel(u8), + #[error("The server requested an identity of level {needed}, but we already have level {have}")] + IdentityLevelCorrupted { needed: u8, have: u8 }, + #[error("Failed to increase identity level: Thread died")] + IdentityLevelIncreaseFailedThread, + #[error("We should be connected but the connection params do not exist")] + InitserverParamsMissing, + #[error("Failed to parse initserver: {0}")] + InitserverParse(#[source] ts_bookkeeping::messages::ParseError), + #[error("Timeout while waiting for initserver")] + InitserverTimeout, + #[error("Failed to receive initserver: {0}")] + InitserverWait(#[source] tsproto::client::Error), + #[error("Io error: {0}")] + Io(#[source] tokio::io::Error), + /// The connection is currently not connected to a server but is in the process of connecting. + #[error("Currently not connected")] + NotConnected, + #[error("Failed to resolve address: {0}")] + ResolveAddress(#[source] Box), + #[error("Failed to send clientinit: {0}")] + SendClientinit(#[source] tsproto::client::Error), + #[error("Failed to send packet: {0}")] + SendPacket(#[source] tsproto::client::Error), + #[error("The server changed its identity")] + ServerUidMismatch(UidBuf), +} + +/// The reason for a temporary disconnect. +#[derive(Clone, Copy, Debug)] +pub enum TemporaryDisconnectReason { + /// Timed out because the server did not respond to packets in time. + Timeout(&'static str), + /// The server terminated our connection because it shut down. + /// + /// This corresponds to the `Serverstop` and `ClientdisconnectServerShutdown` reasons. + /// This often happens on server restarts, so the connection will try to reconnect. + Serverstop, +} + +pub trait OutCommandExt { + /// Adds a `return_code` to the command and returns if the corresponding + /// answer is received. If an error occurs, the future will return an error. + fn send_with_result(self, con: &mut Connection) -> Result; + + /// Sends the command without asking for an answer. + fn send(self, con: &mut Connection) -> Result<()>; +} + +/// The result of a download request. +/// +/// A file download can be started by [`Connection::download_file`]. +#[derive(Debug)] +pub struct FileDownloadResult { + /// The size of the requested file. + // TODO The rest of the size when a seek_position is specified? + pub size: u64, + /// The stream where the file can be downloaded. + pub stream: TcpStream, +} + +/// The result of an upload request. +/// +/// A file upload can be started by [`Connection::upload_file`]. +#[derive(Debug)] +pub struct FileUploadResult { + /// The size of the already uploaded part when `resume` was set to `true` + /// in [`Connection::upload_file`]. + pub seek_position: u64, + /// The stream where the file can be uploaded. + pub stream: TcpStream, +} + +/// Signals audio related changes. +#[derive(Debug)] +pub enum AudioEvent { + /// If this client can send audio or is muted. + /// + /// If the client is muted, the server will drop any sent audio packets. A client counts as + /// muted if input or output is muted, he is marked away or the talk power is less than the + /// needed talk power in the current channel. Temporary disconnects also count as mutes. + /// + /// Every time the mute state changes, this event is emitted. + CanSendAudio(bool), + /// If this client can receive audio or the output is muted. + /// + /// Audio packets might still be received but should not be played. + /// + /// Every time the mute state changes, this event is emitted. + CanReceiveAudio(bool), +} + +/// An event that gets returned by the connection. +/// +/// A stream of these events is returned by [`Connection::events`]. +#[derive(Debug)] +pub enum StreamItem { + /// All the incoming book events. + /// + /// If a connection to the server was established this will contain an added event of a server. + BookEvents(Vec), + /// All incoming messages that are not related to the book. + /// + /// This contains messages like `ChannelListFinished` or `ClientChatComposing`. + /// All events related to channels or clients are returned as events in the `BookEvents` + /// variant. Other messages handled by tsclientlib, e.g. for filetransfer are also not included + /// in these events. + MessageEvent(InMessage), + /// Received an audio packet. + /// + /// Audio packets can be handled by the [`AudioHandler`](audio::AudioHandler), which builds a + /// queue per client and handles packet loss and jitter. + #[cfg(any(feature = "audio", feature = "raw-audio"))] + Audio(InAudioBuf), + /// The needed level. + IdentityLevelIncreasing(u8), + /// This event may occur without an `IdentityLevelIncreasing` event before + /// if a new identity is created because no identity was supplied. + IdentityLevelIncreased, + /// The connection timed out or the server shut down. The connection will be + /// rebuilt automatically. + DisconnectedTemporarily(TemporaryDisconnectReason), + /// The result of sending a message. + /// + /// The [`MessageHandle`] is the return value of [`OutCommandExt::send_with_result`]. + MessageResult(MessageHandle, std::result::Result<(), CommandError>), + /// A file download succeeded. This event contains the `TcpStream` where the + /// file can be downloaded. + /// + /// The [`FiletransferHandle`] is the return value of [`Connection::download_file`]. + FileDownload(FiletransferHandle, FileDownloadResult), + /// A file upload succeeded. This event contains the `TcpStream` where the + /// file can be uploaded. + /// + /// The [`FiletransferHandle`] is the return value of [`Connection::upload_file`]. + FileUpload(FiletransferHandle, FileUploadResult), + /// A file download or upload failed. + /// + /// This can happen if either the TeamSpeak server denied the file transfer or the tcp + /// connection failed. + /// + /// The [`FiletransferHandle`] is the return value of [`Connection::download_file`] or + /// [`Connection::upload_file`]. + FiletransferFailed(FiletransferHandle, Error), + /// The network statistics were updated. + /// + /// This means e.g. the packet loss got a new value. Clients with audio probably want to update + /// the packet loss option of opus. + NetworkStatsUpdated, + /// A change related to audio. + AudioChange(AudioEvent), +} + +/// The `Connection` is the main interaction point with this library. +/// +/// It represents a connection to a TeamSpeak server. It will reconnect automatically when the +/// connection times out. It will not reconnect which the client is kicked or banned from the +/// server. +pub struct Connection { + state: ConnectionState, + span: Span, + options: ConnectOptions, + stream_items: VecDeque>, +} + +struct ConnectedConnection { + client: client::Client, + cur_return_code: u16, + cur_filetransfer_id: u16, + /// If we are subscribed to the server. This will automatically subscribe to new channels. + subscribed: bool, + /// If a file stream can be opened, it gets put in here until the tcp + /// connection is ready and the key is sent. + /// + /// Afterwards we can directly return a `TcpStream` in the event stream. + filetransfers: Vec>, + connection_time: time::OffsetDateTime, +} + +enum ConnectionState { + /// The future that resolves to a connection and a boolean if we should reconnect on failure. + /// + /// If the `bool` is `false`, the connection will abort on error. Otherwise it will try to + /// connect again on timeout. + Connecting(future::BoxFuture<'static, Result<(client::Client, data::Connection)>>, bool), + IdentityLevelIncreasing { + /// We get the improved identity here. + recv: oneshot::Receiver, + state: Arc>, + }, + Connected { + con: ConnectedConnection, + book: data::Connection, + }, +} + +/// A wrapper to poll events from a connection. This is used so a user can drop +/// and filter the stream of events without problems. +struct EventStream<'a>(&'a mut Connection); + +enum IdentityIncreaseLevelState { + Computing, + /// Set to this state to cancel the computation. + Canceled, +} + +/// The main type of this crate, which represents a connection to a server. +/// +/// After creating a connection with [`Connection::new`], the main way to interact with it is +/// [`get_state`](Connection::get_state). It stores currently visible clients and channels on the +/// server. The setter methods e.g. for the nickname or channel create a command that can be send +/// to the server. The send method returns a handle which can then be used to check if +/// the action succeeded or not. +/// +/// The second way of interaction is polling with [`events()`](Connection::events), which returns a +/// stream of [`StreamItem`]s. +/// +/// The connection will not do anything unless the event stream is polled. Even +/// sending packets will only happen while polling. Make sure to always wait for +/// events when awaiting other futures. +/// +/// # Examples +/// This will open a connection to the TeamSpeak server at `localhost`. +/// +/// ```no_run +/// use futures::prelude::*; +/// use tsclientlib::{Connection, StreamItem}; +/// +/// #[tokio::main] +/// async fn main() { +/// let mut con = Connection::build("localhost").connect().unwrap(); +/// // Wait until connected +/// con.events() +/// // We are connected when we receive the first BookEvents +/// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) +/// .next() +/// .await +/// .unwrap(); +/// } +/// ``` +impl Connection { + /// Start creating the configuration of a new connection. + /// + /// # Arguments + /// The address of the server has to be supplied. The address can be a + /// [`SocketAddr`](std::net::SocketAddr), a string or directly a [`ServerAddress`]. A string + /// will automatically be resolved from all formats supported by TeamSpeak. + /// For details, see [`resolver::resolve`]. + /// + /// # Examples + /// This will open a connection to the TeamSpeak server at `localhost`. + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, StreamItem}; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let mut con = Connection::build("localhost").connect().unwrap(); + /// // Wait until connected + /// con.events() + /// // We are connected when we receive the first BookEvents + /// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + /// .next() + /// .await + /// .unwrap(); + /// # } + /// ``` + #[inline] + pub fn build>(address: A) -> ConnectOptions { + ConnectOptions { + address: address.into(), + local_address: None, + identity: None, + server: None, + name: "TeamSpeakUser".into(), + version: Version::Windows_3_X_X__1, + hardware_id: "923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc".into(), + channel: None, + channel_password: None, + password: None, + input_muted: false, + output_muted: false, + input_hardware_enabled: true, + output_hardware_enabled: true, + away: None, + log_commands: false, + log_packets: false, + log_udp_packets: false, + } + } + + /// Create a connection + /// + /// This function opens a new connection to a server. The returned future + /// resolves, when the connection is established successfully. + /// + /// Settings like nickname of the user can be set using the + /// [`ConnectOptions`] parameter. + /// + /// # Examples + /// This will open a connection to the TeamSpeak server at `localhost`. + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, ConnectOptions, StreamItem}; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let mut con = Connection::new(ConnectOptions::new("localhost")).unwrap(); + /// // Wait until connected + /// con.events() + /// // We are connected when we receive the first BookEvents + /// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + /// .next() + /// .await + /// .unwrap(); + /// # } + /// ``` + // TODO Remove + #[deprecated(since = "0.2.0", note = "ConnectOptions::connect should be used instead")] + pub fn new(options: ConnectOptions) -> Result { options.connect() } + + /// Get the options which were used to create this connection. + /// + /// The identity of the options is updated while connecting if the identity + /// level needs to be improved. + pub fn get_options(&self) -> &ConnectOptions { &self.options } + + /// Get a stream of events. The event stream needs to be polled, otherwise + /// nothing will happen in a connection, not even sending packets will work. + /// + /// The returned stream can be dropped and recreated if needed. + pub fn events(&mut self) -> impl Stream> + '_ { EventStream(self) } + + /// Connect to a server. + /// + /// If `is_reconnect` is `true`, wait 10 seconds before sending the first packet. This is to not + /// spam unnecessary packets if the internet or server is down. + async fn connect( + options: ConnectOptions, is_reconnect: bool, + ) -> Result<(client::Client, data::Connection)> { + if is_reconnect { + tokio::time::sleep(Duration::from_secs(10)).await; + } + + let resolved = match &options.address { + ServerAddress::SocketAddr(a) => stream::once(future::ok(*a)).left_stream(), + ServerAddress::Other(s) => resolver::resolve(s.into()).right_stream(), + }; + pin_utils::pin_mut!(resolved); + let mut resolved: Pin<_> = resolved; + + let mut errors = Vec::new(); + while let Some(addr) = resolved.next().await { + let addr = addr.map_err(|e| Error::ResolveAddress(Box::new(e)))?; + match Self::connect_to(&options, addr).await { + Ok(res) => return Ok(res), + Err(e @ Error::IdentityLevel(_)) | Err(e @ Error::ConnectTs(_)) => { + // Either increase identity level or the server refused us + return Err(e); + } + Err(error) => { + info!(%error, "Connecting failed, trying next address"); + errors.push(error); + } + } + } + Err(Error::ConnectFailed { address: options.address.to_string(), errors }) + } + + async fn connect_to( + options: &ConnectOptions, addr: SocketAddr, + ) -> Result<(client::Client, data::Connection)> { + let counter = options.identity.as_ref().unwrap().counter(); + let socket = Box::new( + UdpSocket::bind(options.local_address.unwrap_or_else(|| { + if addr.is_ipv4() { + "0.0.0.0:0".parse().unwrap() + } else { + "[::]:0".parse().unwrap() + } + })) + .await + .map_err(Error::Io)?, + ); + let mut client = + client::Client::new(addr, socket, options.identity.as_ref().unwrap().key().clone()); + + // Logging + tsproto::log::add_logger( + options.log_commands, + options.log_packets, + options.log_udp_packets, + &mut *client, + ); + + // Create a connection + debug!(address = %addr, "Connecting"); + client.connect().await.map_err(Error::Connect)?; + + if let Some(server_uid) = &options.server { + let params = if let Some(r) = &client.params { + r + } else { + return Err(Error::InitserverParamsMissing); + }; + let real_uid = UidBuf(params.public_key.get_uid_no_base64()); + if real_uid != *server_uid { + return Err(Error::ServerUidMismatch(real_uid)); + } + } + + // Create clientinit packet + let client_version = options.version.get_version_string(); + let client_platform = options.version.get_platform(); + let client_version_sign = BASE64_STANDARD.encode(options.version.get_signature()); + + let default_channel_password = options + .channel_password + .as_ref() + .map(|p| tsproto_types::crypto::encode_password(p.as_bytes())) + .unwrap_or_default(); + let password = options + .password + .as_ref() + .map(|p| tsproto_types::crypto::encode_password(p.as_bytes())) + .unwrap_or_default(); + let packet = c2s::OutClientInitMessage::new(&mut iter::once(c2s::OutClientInitPart { + name: Cow::Borrowed(options.name.as_ref()), + version: Cow::Borrowed(client_version), + platform: Cow::Borrowed(client_platform), + input_muted: if options.input_muted { Some(true) } else { None }, + output_muted: if options.output_muted { Some(true) } else { None }, + input_hardware_enabled: options.input_hardware_enabled, + output_hardware_enabled: options.output_hardware_enabled, + is_away: if options.away.is_some() { Some(true) } else { None }, + away_message: options.away.as_deref().map(Cow::Borrowed), + default_channel: Cow::Borrowed(options.channel.as_deref().unwrap_or_default()), + default_channel_password: Cow::Borrowed(default_channel_password.as_ref()), + password: Cow::Borrowed(password.as_ref()), + metadata: "".into(), + version_sign: Cow::Borrowed(client_version_sign.as_ref()), + client_key_offset: counter, + phonetic_name: "".into(), + default_token: "".into(), + hardware_id: Cow::Borrowed(options.hardware_id.as_ref()), + badges: None, + signed_badges: None, + integrations: None, + active_integrations_info: None, + my_team_speak_avatar: None, + my_team_speak_id: None, + security_hash: None, + })); + + client.send_packet(packet.into_packet()).map_err(Error::SendClientinit)?; + + match tokio::time::timeout( + Duration::from_secs(INITSERVER_TIMEOUT), + Self::wait_initserver(client), + ) + .await + { + Ok(r) => r, + Err(_) => Err(Error::InitserverTimeout), + } + } + + async fn wait_initserver( + mut client: client::Client, + ) -> Result<(client::Client, data::Connection)> { + // Wait until we received the initserver packet. + loop { + let cmd = client + .filter_commands(|_, cmd| Ok(Some(cmd))) + .await + .map_err(Error::InitserverWait)?; + let msg = InMessage::new(cmd.data().packet().header(), cmd.data().packet().content()) + .map_err(Error::InitserverParse); + + match msg { + Ok(InMessage::CommandError(e)) => { + let e = e.iter().next().unwrap(); + if e.id == ts_bookkeeping::TsError::ClientCouldNotValidateIdentity { + if let Some(needed) = + e.extra_message.as_ref().and_then(|m| m.parse::().ok()) + { + return Err(Error::IdentityLevel(needed)); + } + } + return Err(Error::ConnectTs(e.id)); + } + Ok(InMessage::InitServer(initserver)) => { + let public_key = { + let params = if let Some(r) = &client.params { + r + } else { + return Err(Error::InitserverParamsMissing); + }; + + params.public_key.clone() + }; + + // Create connection + let data = data::Connection::new(public_key, &initserver); + + return Ok((client, data)); + } + Ok(msg) => { + // TODO Save instead of drop + warn!(message = ?msg, "Expected initserver, dropping command"); + } + Err(error) => { + warn!(%error, "Expected initserver, failed to parse command"); + } + } + } + } + + /// If this returns `None`, the level was increased and we should try + /// connecting again. + fn increase_identity_level(&mut self, needed: u8) -> Result<()> { + if needed > 20 { + return Err(Error::IdentityLevel(needed)); + } + + let identity = self.options.identity.as_ref().unwrap().clone(); + let level = identity.level(); + if level >= needed { + return Err(Error::IdentityLevelCorrupted { needed, have: level }); + } + + // Increase identity level + let state = Arc::new(Mutex::new(IdentityIncreaseLevelState::Computing)); + let (send, recv) = oneshot::channel(); + // TODO Use tokio::blocking + // TODO Time estimate + std::thread::spawn(move || { + let mut identity = identity; + // TODO Check if canceled in between + identity.upgrade_level(needed); + let _ = send.send(identity); + }); + + self.state = ConnectionState::IdentityLevelIncreasing { recv, state }; + Ok(()) + } + + /// Adds a `return_code` to the command and returns if the corresponding + /// answer is received. If an error occurs, the future will return an error. + fn send_command_with_result(&mut self, packet: OutCommand) -> Result { + self.update_on_outgoing_command(&packet); + if let ConnectionState::Connected { con, .. } = &mut self.state { + con.send_command_with_result(packet) + } else { + Err(Error::NotConnected) + } + } + + fn send_command(&mut self, packet: OutCommand) -> Result<()> { + self.update_on_outgoing_command(&packet); + if let ConnectionState::Connected { con, .. } = &mut self.state { + con.send_command(packet) + } else { + Err(Error::NotConnected) + } + } + + /// Update for outgoing commands. + /// + /// Updates subscription and muted state. + /// + /// Muted state needs to be handled at the following places: + /// - Outgoing packet to change mute/away state: Immediately apply and add book event, update + /// CanTalk, save in ConnectOptions + /// - Incoming event to change channel/own name, edit current channel/own client permissions, + /// server settings: Update CanTalk/Play, save in ConnectOptions + /// - Incoming packet to change mute/away state: Ignore for own client + /// - Connect, temporary disconnect: Update CanTalk/Play + fn update_on_outgoing_command(&mut self, cmd: &OutCommand) { + if let ConnectionState::Connected { con, book } = &mut self.state { + let (cmd_name, parser) = CommandParser::new(cmd.0.content()); + + if cmd_name == b"channelsubscribeall" { + con.subscribed = true; + } else if cmd_name == b"channelunsubscribeall" { + con.subscribed = false; + } else if cmd_name == b"clientupdate" { + let prev_can_send = Self::intern_can_send_audio(book, &self.options); + let prev_can_receive = Self::intern_can_receive_audio(book, &self.options); + let mut own_client = book.clients.get_mut(&book.own_client); + let mut has_away_message = false; + let mut has_is_away = false; + let mut events = Vec::new(); + + for arg in parser { + if let CommandItem::Argument(arg) = arg { + macro_rules! set_prop { + ($prop:ident, $event:ident, $event_value:ident) => { + self.options.$prop = arg.value().get_raw() == b"1"; + if let Some(own_client) = &mut own_client { + if own_client.$prop != self.options.$prop { + let old = own_client.$prop; + own_client.$prop = self.options.$prop; + events.push(events::Event::PropertyChanged { + id: events::PropertyId::$event(own_client.id), + old: events::PropertyValue::$event_value(old), + invoker: None, + extra: Default::default(), + }); + } + } + }; + } + + match arg.name() { + b"client_input_muted" => { + set_prop!(input_muted, ClientInputMuted, Bool); + } + b"client_output_muted" => { + set_prop!(output_muted, ClientOutputMuted, Bool); + } + b"client_away" => { + if arg.value().get_raw() == b"1" { + if !has_away_message { + self.options.away = Some("".into()); + } + } else { + self.options.away = None; + } + has_is_away = true; + } + b"client_away_message" => { + if has_is_away && self.options.away.is_some() { + match arg.value().get_str() { + Ok(r) => self.options.away = Some(r.to_string().into()), + Err(error) => { + warn!(%error, message = ?arg.value(), + "Failed to parse sent away message"); + } + } + has_away_message = true; + } + } + b"client_input_hardware" => { + set_prop!(input_hardware_enabled, ClientInputHardwareEnabled, Bool); + } + b"client_output_hardware" => { + set_prop!( + output_hardware_enabled, + ClientOutputHardwareEnabled, + Bool + ); + } + _ => {} + } + if let Some(own_client) = &mut own_client { + if own_client.away_message.as_deref() + != self.options.away.as_ref().map(|s| s.as_ref()) + { + let old = mem::replace( + &mut own_client.away_message, + self.options.away.as_ref().map(|s| s.to_string()), + ); + events.push(events::Event::PropertyChanged { + id: events::PropertyId::ClientAwayMessage(own_client.id), + old: events::PropertyValue::OptionString(old), + invoker: None, + extra: Default::default(), + }); + } + } + } + } + + if !events.is_empty() { + self.stream_items.push_back(Ok(StreamItem::BookEvents(events))); + } + + let new_can_send = Self::intern_can_send_audio(book, &self.options); + let new_can_receive = Self::intern_can_receive_audio(book, &self.options); + if new_can_send != prev_can_send { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanSendAudio(new_can_send), + ))); + } + if new_can_receive != prev_can_receive { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanReceiveAudio(new_can_receive), + ))); + } + } + } + } + + /// Cancels the computation to increase the identity level. + /// + /// This function initiates the cancellation and immediately returns. It + /// does not wait until the background thread quits. + /// + /// Does nothing if the identity level is currently not increased. + pub fn cancel_identity_level_increase(&mut self) { + if let ConnectionState::IdentityLevelIncreasing { state, .. } = &mut self.state { + *state.lock().unwrap() = IdentityIncreaseLevelState::Canceled; + } + } + + /// Get access to the raw connection. + /// + /// Fails if the connection is currently not connected to the server. + #[cfg(feature = "unstable")] + pub fn get_tsproto_client(&self) -> Result<&client::Client> { + if let ConnectionState::Connected { con, .. } = &self.state { + Ok(&con.client) + } else { + Err(Error::NotConnected) + } + } + + /// Get access to the raw connection. + /// + /// Fails if the connection is currently not connected to the server. + #[cfg(feature = "unstable")] + pub fn get_tsproto_client_mut(&mut self) -> Result<&mut client::Client> { + if let ConnectionState::Connected { con, .. } = &mut self.state { + Ok(&mut con.client) + } else { + Err(Error::NotConnected) + } + } + + /// Returns the public key of the server, fails if disconnected. + #[cfg(feature = "unstable")] + pub fn get_server_key(&self) -> Result { + self.get_tsproto_client().and_then(|c| { + if let Some(params) = &c.params { + Ok(params.public_key.clone()) + } else { + Err(Error::NotConnected) + } + }) + } + + /// Get the current state of clients and channels of this connection. + /// + /// Fails if the connection is currently not connected to the server. + pub fn get_state(&self) -> Result<&data::Connection> { + if let ConnectionState::Connected { book, .. } = &self.state { + Ok(book) + } else { + Err(Error::NotConnected) + } + } + + /// Disconnect from the server. + /// + /// # Arguments + /// - `options`: Either `None` or `DisconnectOptions`. + /// + /// # Examples + /// + /// Use default options: + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, DisconnectOptions, StreamItem}; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let mut con = Connection::build("localhost").connect().unwrap(); + /// // Wait until connected + /// con.events() + /// // We are connected when we receive the first BookEvents + /// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + /// .next() + /// .await + /// .unwrap(); + /// + /// // Disconnect + /// con.disconnect(DisconnectOptions::new()).unwrap(); + /// con.events().for_each(|_| future::ready(())).await; + /// # } + /// ``` + /// + /// Specify a reason and a quit message: + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, DisconnectOptions, Reason, StreamItem}; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let mut con = Connection::build("localhost").connect().unwrap(); + /// // Wait until connected + /// con.events() + /// // We are connected when we receive the first BookEvents + /// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + /// .next() + /// .await + /// .unwrap(); + /// + /// // Disconnect + /// let options = DisconnectOptions::new() + /// .reason(Reason::Clientdisconnect) + /// .message("Away for a while"); + /// con.disconnect(options).unwrap(); + /// con.events().for_each(|_| future::ready(())).await; + /// # } + /// ``` + pub fn disconnect(&mut self, options: DisconnectOptions) -> Result<()> { + if let ConnectionState::Connected { con, book } = &mut self.state { + let packet = book.disconnect(options); + con.client.send_packet(packet.into_packet()).map_err(Error::SendPacket)?; + } + Ok(()) + } + + /// Send audio to the server. + /// + /// This function does only accept `Voice` and `VoiceWhisper` packets. Commands should be send + /// with [`command.send(&mut connection)`](OutCommandExt::send) or + /// [`command.send_with_result(&mut connection)`](OutCommandExt::send_with_result). + /// + /// # Examples + /// + /// ```no_run + /// # let con: tsclientlib::Connection = panic!(); + /// use tsproto_packets::packets::{AudioData, CodecType, OutAudio}; + /// let codec = CodecType::OpusVoice; + /// // Send an empty packet to signal audio end + /// let packet = OutAudio::new(&AudioData::C2S { id: 0, codec, data: &[] }); + /// con.send_audio(packet).unwrap(); + /// ``` + pub fn send_audio(&mut self, packet: OutPacket) -> Result<()> { + assert!( + [PacketType::Voice, PacketType::VoiceWhisper].contains(&packet.header().packet_type()), + "Can only send audio packets with send_audio" + ); + if let ConnectionState::Connected { con, book } = &mut self.state { + if !Self::intern_can_send_audio(book, &self.options) { + let span = self.span.clone(); + warn!(parent: span, "Sending audio while muted"); + } + con.client.send_packet(packet).map_err(Error::SendPacket)?; + Ok(()) + } else { + Err(Error::NotConnected) + } + } + + /// Download a file from a channel of the connected TeamSpeak server. + /// + /// Returns the size of the file and a tcp stream of the requested file. + /// + /// # Examples + /// Download an icon. + /// + /// ```no_run + /// # use tsclientlib::ChannelId; + /// # let con: tsclientlib::Connection = panic!(); + /// # let id = 0; + /// let handle_future = con.download_file(ChannelId(0), &format!("/icon_{}", id), None, None); + /// # // TODO Show rest of download + /// ``` + pub fn download_file( + &mut self, channel_id: ChannelId, path: &str, channel_password: Option<&str>, + seek_position: Option, + ) -> Result { + if let ConnectionState::Connected { con, .. } = &mut self.state { + con.download_file(channel_id, path, channel_password, seek_position) + } else { + Err(Error::NotConnected) + } + } + + /// Upload a file to a channel of the connected TeamSpeak server. + /// + /// Returns the size of the part which is already uploaded (when resume is + /// specified) and a tcp stream where the requested file should be uploaded. + /// + /// # Examples + /// Upload an avatar. + /// + /// ```no_run + /// # use tsclientlib::ChannelId; + /// # let con: tsclientlib::Connection = panic!(); + /// # let size = 0; + /// let handle_future = con.upload_file(ChannelId(0), "/avatar", None, size, true, false); + /// # // TODO Show rest of upload + /// ``` + pub fn upload_file( + &mut self, channel_id: ChannelId, path: &str, channel_password: Option<&str>, size: u64, + overwrite: bool, resume: bool, + ) -> Result { + if let ConnectionState::Connected { con, .. } = &mut self.state { + con.upload_file(channel_id, path, channel_password, size, overwrite, resume) + } else { + Err(Error::NotConnected) + } + } + + /// Get statistics about the network connection. + /// + /// # Example + /// Get the fraction of packets that are currently lost. + /// + /// ```no_run + /// # let con: tsclientlib::Connection = panic!(); + /// let loss: f32 = con.get_network_stats().unwrap().get_packetloss(); + /// ``` + /// + /// # Error + /// Returns an error if currently not connected. + pub fn get_network_stats(&self) -> Result<&ConnectionStats> { + if let ConnectionState::Connected { con, .. } = &self.state { + Ok(&con.client.resender.stats) + } else { + Err(Error::NotConnected) + } + } + + /// If this client can send audio or is muted. + /// + /// If the client is muted, the server will drop any sent audio packets. A client counts as + /// muted if input or output is muted, he is marked away or the talk power is less than the + /// needed talk power in the current channel. Temporary disconnects also count as mutes. + /// + /// If this changes, the [`AudioEvent::CanSendAudio`] event is emitted. + pub fn can_send_audio(&self) -> bool { + if let ConnectionState::Connected { book, .. } = &self.state { + Self::intern_can_send_audio(book, &self.options) + } else { + false + } + } + + fn intern_can_send_audio(book: &data::Connection, options: &ConnectOptions) -> bool { + if let Some(own_client) = book.clients.get(&book.own_client) { + if own_client.input_muted + || !own_client.input_hardware_enabled + || own_client.away_message.is_some() + || own_client.output_muted + || !own_client.output_hardware_enabled + { + return false; + } + if let Some(own_channel) = book.channels.get(&own_client.channel) { + if let Some(needed_talk_power) = own_channel.needed_talk_power { + return own_client.talk_power_granted + || own_client.talk_power >= needed_talk_power; + } + } + true + } else { + !options.input_muted + && options.input_hardware_enabled + && options.away.is_none() + && !options.output_muted + && options.output_hardware_enabled + } + } + + /// If this client can receive audio or the output is muted. + /// + /// This will return `false` if the client is currently not connected to the server. + /// Audio packets might still be received but should not be played. + /// + /// If this changes, the [`AudioEvent::CanReceiveAudio`] event is emitted. + pub fn can_receive_audio(&self) -> bool { + if let ConnectionState::Connected { book, .. } = &self.state { + Self::intern_can_receive_audio(book, &self.options) + } else { + false + } + } + + fn intern_can_receive_audio(book: &data::Connection, options: &ConnectOptions) -> bool { + if let Some(own_client) = book.clients.get(&book.own_client) { + !own_client.output_muted + && !own_client.output_only_muted + && own_client.output_hardware_enabled + } else { + !options.output_muted && options.output_hardware_enabled + } + } + + /// If the current channel (and server) allow unencrypted voice packets. + /// + /// For whisper packets, only the server setting is checked. + #[cfg(any(feature = "audio", feature = "raw-audio"))] + fn intern_can_receive_unencrypted_audio(book: &data::Connection, whisper: bool) -> bool { + match book.server.codec_encryption_mode { + CodecEncryptionMode::ForcedOn => false, + CodecEncryptionMode::ForcedOff => true, + CodecEncryptionMode::PerChannel => { + if whisper { + return true; + } + if let Some(own_client) = book.clients.get(&book.own_client) { + if let Some(own_channel) = book.channels.get(&own_client.channel) { + return own_channel.is_unencrypted.unwrap_or(true); + } + } + true + } + } + } + + fn poll_next(&mut self, cx: &mut Context) -> Poll>> { + let _span = self.span.clone().entered(); + if let Some(item) = self.stream_items.pop_front() { + return Poll::Ready(Some(item)); + } + match &mut self.state { + ConnectionState::Connecting(fut, reconnect) => match fut.poll_unpin(cx) { + Poll::Pending => Poll::Pending, + Poll::Ready(Err(Error::IdentityLevel(level))) => { + if let Err(e) = self.increase_identity_level(level) { + return Poll::Ready(Some(Err(e))); + } + Poll::Ready(Some(Ok(StreamItem::IdentityLevelIncreasing(level)))) + } + Poll::Ready(Err(e)) => { + if *reconnect { + if let Error::ConnectFailed { errors, .. } = &e { + for e in errors { + if let Error::Connect(client::Error::TsProto( + tsproto::Error::Timeout(reason), + )) = e + { + debug!(timeout = reason, "Connect failed, reconnecting"); + let fut = + Self::connect(self.options.clone(), true).in_current_span(); + self.state = ConnectionState::Connecting(Box::pin(fut), true); + return self.poll_next(cx); + } + } + } + } + Poll::Ready(Some(Err(e))) + } + Poll::Ready(Ok((client, book))) => { + let con = ConnectedConnection { + client, + cur_return_code: 0, + cur_filetransfer_id: 0, + subscribed: false, + filetransfers: Default::default(), + connection_time: OffsetDateTime::now_utc(), + }; + if Self::intern_can_send_audio(&book, &self.options) { + self.stream_items + .push_back(Ok(StreamItem::AudioChange(AudioEvent::CanSendAudio(true)))); + } + if Self::intern_can_receive_audio(&book, &self.options) { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanReceiveAudio(true), + ))); + } + self.state = ConnectionState::Connected { con, book }; + Poll::Ready(Some(Ok(StreamItem::BookEvents(vec![ + events::Event::PropertyAdded { + id: events::PropertyId::Server, + invoker: None, + extra: Default::default(), + }, + ])))) + } + }, + ConnectionState::IdentityLevelIncreasing { recv, .. } => match recv.poll_unpin(cx) { + Poll::Pending => Poll::Pending, + Poll::Ready(Err(_)) => { + Poll::Ready(Some(Err(Error::IdentityLevelIncreaseFailedThread))) + } + Poll::Ready(Ok(identity)) => { + self.options.identity = Some(identity); + let fut = Self::connect(self.options.clone(), false); + self.state = + ConnectionState::Connecting(Box::pin(fut.in_current_span()), false); + Poll::Ready(Some(Ok(StreamItem::IdentityLevelIncreased))) + } + }, + ConnectionState::Connected { con, book } => match loop { + match con.client.poll_next_unpin(cx) { + Poll::Pending => break Poll::Pending, + Poll::Ready(None) => break Poll::Ready(None), + Poll::Ready(Some(Err(e))) => { + // Check if we were disconnecting + let state = con.client.resender.get_state(); + if state == ResenderState::Disconnected + || state == ResenderState::Disconnecting + { + break Poll::Ready(None); + } + + if let client::Error::TsProto(tsproto::Error::Timeout(reason)) = e { + // Reconnect on timeout + warn!(timeout = reason, "Connection failed, reconnecting"); + let fut = Self::connect(self.options.clone(), true); + self.state = + ConnectionState::Connecting(Box::pin(fut.in_current_span()), true); + return Poll::Ready(Some(Ok(StreamItem::DisconnectedTemporarily( + TemporaryDisconnectReason::Timeout(reason), + )))); + } else { + break Poll::Ready(Some(Err(Error::ConnectionFailed(e)))); + } + } + Poll::Ready(Some(Ok(item))) => match item { + ProtoStreamItem::Error(error) => { + warn!(%error, "Connection got a non-fatal error"); + } + #[cfg(any(feature = "audio", feature = "raw-audio"))] + ProtoStreamItem::Audio(audio) => { + if !Self::intern_can_receive_audio(book, &self.options) { + info!("Received audio packet while output is muted, ignoring"); + } else { + let encrypted = !audio + .data() + .packet() + .header() + .flags() + .contains(tsproto_packets::packets::Flags::UNENCRYPTED); + let whisper = audio.data().packet().header().packet_type() + == PacketType::VoiceWhisper; + if encrypted + || Self::intern_can_receive_unencrypted_audio(book, whisper) + { + return Poll::Ready(Some(Ok(StreamItem::Audio(audio)))); + } else { + info!( + "Received unencrypted audio packet but only encrypted \ + packets are allowed, ignoring" + ); + } + } + } + ProtoStreamItem::Command(cmd) => { + let prev_can_send = Self::intern_can_send_audio(book, &self.options); + let prev_can_receive = + Self::intern_can_receive_audio(book, &self.options); + if let Some(reason) = con.handle_command( + book, + &mut self.stream_items, + &mut self.options, + cmd, + ) { + warn!("Server shut down, reconnecting"); + let fut = Self::connect(self.options.clone(), true); + self.state = ConnectionState::Connecting( + Box::pin(fut.in_current_span()), + true, + ); + if prev_can_send { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanSendAudio(false), + ))); + } + if prev_can_receive { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanReceiveAudio(false), + ))); + } + self.stream_items + .push_back(Ok(StreamItem::DisconnectedTemporarily(reason))); + return Poll::Ready(Some(self.stream_items.pop_front().unwrap())); + } + + let new_can_send = Self::intern_can_send_audio(book, &self.options); + let new_can_receive = + Self::intern_can_receive_audio(book, &self.options); + if new_can_send != prev_can_send { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanSendAudio(new_can_send), + ))); + } + if new_can_receive != prev_can_receive { + self.stream_items.push_back(Ok(StreamItem::AudioChange( + AudioEvent::CanReceiveAudio(new_can_receive), + ))); + } + if let Some(item) = self.stream_items.pop_front() { + break Poll::Ready(Some(item)); + } + } + ProtoStreamItem::NetworkStatsUpdated => { + return Poll::Ready(Some(Ok(StreamItem::NetworkStatsUpdated))); + } + _ => {} + }, + } + } { + Poll::Ready(r) => Poll::Ready(r), + Poll::Pending => { + // Check file transfers + let ft = con.filetransfers.iter_mut().enumerate().find_map(|(i, ft)| match ft + .poll_unpin(cx) + { + Poll::Pending => None, + Poll::Ready(r) => Some((i, r)), + }); + if let Some((i, res)) = ft { + let _ = con.filetransfers.remove(i); + Poll::Ready(Some(Ok(res))) + } else { + Poll::Pending + } + } + }, + } + } +} + +impl OutCommandExt for T { + fn send_with_result(self, con: &mut Connection) -> Result { + con.send_command_with_result(self.to_packet()) + } + + fn send(self, con: &mut Connection) -> Result<()> { con.send_command(self.to_packet()) } +} + +impl Drop for Connection { + fn drop(&mut self) { self.cancel_identity_level_increase(); } +} + +impl<'a> Stream for EventStream<'a> { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, ctx: &mut Context) -> Poll> { + self.0.poll_next(ctx) + } +} + +impl ConnectedConnection { + fn handle_command( + &mut self, book: &mut data::Connection, stream_items: &mut VecDeque>, + options: &mut ConnectOptions, cmd: InCommandBuf, + ) -> Option { + let msg = match InMessage::new(cmd.data().packet().header(), cmd.data().packet().content()) + { + Ok(r) => r, + Err(error) => { + warn!(%error, "Failed to parse message"); + return None; + } + }; + + let mut handled = true; + if let InMessage::CommandError(msg) = &msg { + // Handle error messages + for msg in msg.iter() { + if let Some(ret_code) = msg.return_code.as_ref().and_then(|r| r.parse().ok()) { + let res = if msg.id == TsError::Ok { + Ok(()) + } else { + Err(CommandError { + error: msg.id, + missing_permission: msg.missing_permission_id, + }) + }; + stream_items + .push_back(Ok(StreamItem::MessageResult(MessageHandle(ret_code), res))); + } else { + handled = false; + } + } + } else if let InMessage::FileDownload(msg) = &msg { + for msg in msg.iter() { + let ft_id = FiletransferHandle(msg.client_filetransfer_id); + let ip = msg.ip.unwrap_or_else(|| self.client.address.ip()); + let addr = SocketAddr::new(ip, msg.port); + let key = msg.filetransfer_key.clone(); + let size = msg.size; + + let fut = Box::new(async move { + let addr = addr; + let key = key; + let mut stream = + TcpStream::connect(&addr).await.map_err(Error::FiletransferIo)?; + stream.write_all(key.as_bytes()).await.map_err(Error::FiletransferIo)?; + stream.flush().await.map_err(Error::FiletransferIo)?; + Ok(stream) + }) + .map(move |res| match res { + Ok(stream) => { + StreamItem::FileDownload(ft_id, FileDownloadResult { size, stream }) + } + Err(e) => StreamItem::FiletransferFailed(ft_id, e), + }); + + self.filetransfers.push(Box::pin(fut)); + } + } else if let InMessage::FileUpload(msg) = &msg { + for msg in msg.iter() { + let ft_id = FiletransferHandle(msg.client_filetransfer_id); + let ip = msg.ip.unwrap_or_else(|| self.client.address.ip()); + let addr = SocketAddr::new(ip, msg.port); + let key = msg.filetransfer_key.clone(); + let seek_position = msg.seek_position; + + let fut = Box::new(async move { + let addr = addr; + let key = key; + let mut stream = + TcpStream::connect(&addr).await.map_err(Error::FiletransferIo)?; + stream.write_all(key.as_bytes()).await.map_err(Error::FiletransferIo)?; + stream.flush().await.map_err(Error::FiletransferIo)?; + Ok(stream) + }) + .map(move |res| match res { + Ok(stream) => { + StreamItem::FileUpload(ft_id, FileUploadResult { seek_position, stream }) + } + Err(e) => StreamItem::FiletransferFailed(ft_id, e), + }); + + self.filetransfers.push(Box::pin(fut)); + } + } else if let InMessage::FiletransferStatus(msg) = &msg { + for msg in msg.iter() { + let ft_id = FiletransferHandle(msg.client_filetransfer_id); + let err = CommandError { error: msg.status, missing_permission: None }; + stream_items.push_back(Ok(StreamItem::FiletransferFailed(ft_id, err.into()))); + } + } else if let InMessage::ClientConnectionInfoUpdateRequest(_) = &msg { + // Answer with connection stats + let stats = &self.client.resender.stats; + let last_second_bytes = stats.get_last_second_bytes(); + let last_minute_bytes = stats.get_last_minute_bytes(); + let packet = c2s::OutSetConnectionInfoMessage::new(&mut iter::once( + c2s::OutSetConnectionInfoPart { + ping: stats.rtt.try_into().unwrap_or_else(|_| time::Duration::seconds(1)), + ping_deviation: stats + .rtt_dev + .try_into() + .unwrap_or_else(|_| time::Duration::seconds(1)), + packets_sent_speech: stats.total_packets[PacketStat::OutSpeech as usize], + packets_sent_keepalive: stats.total_packets[PacketStat::OutKeepalive as usize], + packets_sent_control: stats.total_packets[PacketStat::OutControl as usize], + bytes_sent_speech: stats.total_bytes[PacketStat::OutSpeech as usize], + bytes_sent_keepalive: stats.total_bytes[PacketStat::OutKeepalive as usize], + bytes_sent_control: stats.total_bytes[PacketStat::OutControl as usize], + packets_received_speech: stats.total_packets[PacketStat::InSpeech as usize], + packets_received_keepalive: stats.total_packets + [PacketStat::InKeepalive as usize], + packets_received_control: stats.total_packets[PacketStat::InControl as usize], + bytes_received_speech: stats.total_bytes[PacketStat::InSpeech as usize], + bytes_received_keepalive: stats.total_bytes[PacketStat::InKeepalive as usize], + bytes_received_control: stats.total_bytes[PacketStat::InControl as usize], + server_to_client_packetloss_speech: stats.get_packetloss_s2c_speech(), + server_to_client_packetloss_keepalive: stats.get_packetloss_s2c_keepalive(), + server_to_client_packetloss_control: stats.get_packetloss_s2c_control(), + server_to_client_packetloss_total: stats.get_packetloss_s2c_total(), + bandwidth_sent_last_second_speech: last_second_bytes + [PacketStat::OutSpeech as usize] + as u64, + bandwidth_sent_last_second_keepalive: last_second_bytes + [PacketStat::OutKeepalive as usize] + as u64, + bandwidth_sent_last_second_control: last_second_bytes + [PacketStat::OutControl as usize] + as u64, + bandwidth_sent_last_minute_speech: last_minute_bytes + [PacketStat::OutSpeech as usize] + / 60, + bandwidth_sent_last_minute_keepalive: last_minute_bytes + [PacketStat::OutKeepalive as usize] + / 60, + bandwidth_sent_last_minute_control: last_minute_bytes + [PacketStat::OutControl as usize] + / 60, + bandwidth_received_last_second_speech: last_second_bytes + [PacketStat::InSpeech as usize] + as u64, + bandwidth_received_last_second_keepalive: last_second_bytes + [PacketStat::InKeepalive as usize] + as u64, + bandwidth_received_last_second_control: last_second_bytes + [PacketStat::InControl as usize] + as u64, + bandwidth_received_last_minute_speech: last_minute_bytes + [PacketStat::InSpeech as usize] + / 60, + bandwidth_received_last_minute_keepalive: last_minute_bytes + [PacketStat::InKeepalive as usize] + / 60, + bandwidth_received_last_minute_control: last_minute_bytes + [PacketStat::InControl as usize] + / 60, + }, + )); + + if let Err(e) = self.client.send_packet(packet.into_packet()) { + stream_items.push_back(Err(Error::SendPacket(e))); + } + } else { + let (mut events, book_handled) = match book.handle_command(&msg) { + Ok(r) => r, + Err(error) => { + warn!(%error, "Failed to handle message"); + (Vec::new(), false) + } + }; + + if let InMessage::ClientConnectionInfo(msg) = &msg { + for msg in msg.iter() { + if msg.client_id == book.own_client && msg.connected_time.is_none() { + if let Some(own_client) = book.clients.get_mut(&book.own_client) { + if let Some(connection_data) = &mut own_client.connection_data { + connection_data.connected_time = + Some(OffsetDateTime::now_utc() - self.connection_time); + } + } + } + } + } + + handled = book_handled; + self.client.hand_back_buffer(cmd.into_buffer()); + if !events.is_empty() { + // Ignore mute state update for own client + let own_id = book.own_client; + if let Some(own_client) = book.clients.get_mut(&own_id) { + events.retain(|e| { + if let events::Event::PropertyChanged { id, old, .. } = e { + macro_rules! reset { + ($msg:ident, $obj:ident) => { + if *id == events::PropertyId::$msg(own_id) { + if let events::PropertyValue::Bool(b) = old { + own_client.$obj = *b; + } + return false; + } + }; + } + + reset!(ClientInputMuted, input_muted); + reset!(ClientOutputMuted, output_muted); + reset!(ClientInputHardwareEnabled, input_hardware_enabled); + reset!(ClientOutputHardwareEnabled, output_hardware_enabled); + reset!(ClientOutputOnlyMuted, output_only_muted); + + if *id == events::PropertyId::ClientAwayMessage(own_id) { + if let events::PropertyValue::OptionString(s) = old { + own_client.away_message = s.clone(); + } + return false; + } + } + true + }); + } + + stream_items.push_back(Ok(StreamItem::BookEvents(events))); + } + } + + if let InMessage::ChannelCreated(msg) = &msg { + // Handle subscriptions + // - If the client (server groups or permissions) change, he stays subscribed (even if he + // does not have the power anymore). + // - If the channel is edited, the subscription status gets updated. + // - If we enter a channel, we get subscribed but there is no notification that we are + // subscribed. + // - If we leave a channel, there is a notification that we unsubscribed. + // - If a new channel is created, we are not automatically subscribed. + if self.subscribed { + // Subscribe to new channels + let packet = c2s::OutChannelSubscribeMessage::new( + &mut msg + .iter() + .map(|msg| c2s::OutChannelSubscribePart { channel_id: msg.channel_id }), + ); + if let Err(error) = self.client.send_packet(packet.into_packet()) { + warn!(%error, "Failed to send channel subscribe packet"); + } + } + } else if let InMessage::ClientLeftView(msg) = &msg { + // Handle server restarts + for msg in msg.iter() { + if msg.client_id == book.own_client + && matches!( + msg.reason, + Some(Reason::Serverstop) | Some(Reason::ClientdisconnectServerShutdown) + ) { + return Some(TemporaryDisconnectReason::Serverstop); + } + } + } else if let InMessage::ClientMoved(msg) = &msg { + // Save channel switches in options + for msg in msg.iter() { + if msg.client_id == book.own_client && msg.target_channel_id.0 != 0 { + options.channel = Some(format!("/{}", msg.target_channel_id.0).into()); + break; + } + } + } else if let InMessage::ClientUpdated(msg) = &msg { + // Save name change in options + for msg in msg.iter() { + if msg.client_id == book.own_client { + if let Some(name) = &msg.name { + options.name = name.to_string().into(); + } + } + } + } + + if !handled { + stream_items.push_back(Ok(StreamItem::MessageEvent(msg))); + } + None + } + + fn send_command_with_result(&mut self, mut packet: OutCommand) -> Result { + let code = self.cur_return_code; + self.cur_return_code += 1; + packet.write_arg("return_code", &code); + + self.send_command(packet).map(|_| MessageHandle(code)) + } + + fn send_command(&mut self, packet: OutCommand) -> Result<()> { + self.client.send_packet(packet.into_packet()).map(|_| ()).map_err(Error::SendPacket) + } + + fn download_file( + &mut self, channel_id: ChannelId, path: &str, channel_password: Option<&str>, + seek_position: Option, + ) -> Result { + let ft_id = self.cur_filetransfer_id; + self.cur_filetransfer_id += 1; + let pass = channel_password + .map(|p| tsproto_types::crypto::encode_password(p.as_bytes())) + .unwrap_or_default(); + let packet = c2s::OutInitDownloadMessage::new(&mut iter::once(c2s::OutInitDownloadPart { + client_filetransfer_id: ft_id, + name: Cow::Borrowed(path), + channel_id, + channel_password: Cow::Borrowed(&pass), + seek_position: seek_position.unwrap_or_default(), + protocol: 1, + })); + + self.send_command_with_result(packet).map(|_| FiletransferHandle(ft_id)) + } + + fn upload_file( + &mut self, channel_id: ChannelId, path: &str, channel_password: Option<&str>, size: u64, + overwrite: bool, resume: bool, + ) -> Result { + let ft_id = self.cur_filetransfer_id; + self.cur_filetransfer_id += 1; + + let pass = channel_password + .map(|p| tsproto_types::crypto::encode_password(p.as_bytes())) + .unwrap_or_default(); + let packet = c2s::OutInitUploadMessage::new(&mut iter::once(c2s::OutInitUploadPart { + client_filetransfer_id: ft_id, + name: Cow::Borrowed(path), + channel_id, + channel_password: Cow::Borrowed(&pass), + overwrite, + resume, + size, + protocol: 1, + })); + + self.send_command_with_result(packet).map(|_| FiletransferHandle(ft_id)) + } +} + +/// The configuration for creating a new connection. +/// +/// # Example +/// +/// ``` +/// # use tsclientlib::Connection; +/// let config = Connection::build("localhost") +/// .name("MyUser") +/// .channel("Default Channel/Nested"); +/// +/// let con = Connection::new(config); +/// ``` +#[derive(Clone, Debug)] +pub struct ConnectOptions { + address: ServerAddress, + local_address: Option, + identity: Option, + server: Option, + name: Cow<'static, str>, + version: Version, + hardware_id: Cow<'static, str>, + channel: Option>, + channel_password: Option>, + password: Option>, + input_muted: bool, + output_muted: bool, + input_hardware_enabled: bool, + output_hardware_enabled: bool, + away: Option>, + log_commands: bool, + log_packets: bool, + log_udp_packets: bool, +} + +impl ConnectOptions { + /// Start creating the configuration of a new connection. + /// + /// # Arguments + /// The address of the server has to be supplied. The address can be a + /// [`SocketAddr`](std::net::SocketAddr), a string or directly a [`ServerAddress`]. A string + /// will automatically be resolved from all formats supported by TeamSpeak. + /// For details, see [`resolver::resolve`]. + #[inline] + // TODO Remove + #[deprecated(since = "0.2.0", note = "Connection::build should be used instead")] + pub fn new>(address: A) -> Self { Connection::build(address) } + + /// Create the connection object from these options. + /// + /// This function opens a new connection to a server. The connection needs to be polled for + /// events to do something. + /// + /// # Examples + /// This will open a connection to the TeamSpeak server at `localhost`. + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, StreamItem}; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let mut con = Connection::build("localhost").connect().unwrap(); + /// // Wait until connected + /// con.events() + /// // We are connected when we receive the first BookEvents + /// .try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_)))) + /// .next() + /// .await + /// .unwrap(); + /// # } + /// ``` + pub fn connect(mut self) -> Result { + let span = info_span!("connection", addr = %self.address).entered(); + + #[cfg(debug_assertions)] + let profile = "Debug"; + #[cfg(not(debug_assertions))] + let profile = "Release"; + + info!( + version = git_testament::render_testament!(TESTAMENT).as_str(), + profile, + tsproto_version = git_testament::render_testament!(tsproto::get_testament()).as_str(), + "tsclientlib" + ); + + let mut stream_items = VecDeque::new(); + self.identity = Some(self.identity.take().unwrap_or_else(|| { + // Create new ECDH key + let id = Identity::create(); + // Send event + stream_items.push_back(Ok(StreamItem::IdentityLevelIncreased)); + id + })); + + // Try all addresses + let fut = Connection::connect(self.clone(), false); + + Ok(Connection { + state: ConnectionState::Connecting(Box::pin(fut.in_current_span()), false), + span: span.exit(), + options: self, + stream_items, + }) + } + + /// The address for the socket of our client + /// + /// # Default + /// The default is `0.0.0:0` when connecting to an IPv4 address and `[::]:0` + /// when connecting to an IPv6 address. + #[inline] + pub fn local_address(mut self, local_address: SocketAddr) -> Self { + self.local_address = Some(local_address); + self + } + + /// Set the identity of the user. + /// + /// # Default + /// A new identity is generated when connecting. + #[inline] + pub fn identity(mut self, identity: Identity) -> Self { + self.identity = Some(identity); + self + } + + /// Check the identity of the server to be equal with the given uid. + /// + /// If the public key of the server does not match this uid, the connection will be aborted. + /// + /// # Default + /// Allow the server to have any identity. + #[inline] + pub fn server(mut self, server: UidBuf) -> Self { + self.server = Some(server); + self + } + + /// The name of the user. + /// + /// # Default + /// `TeamSpeakUser` + #[inline] + pub fn name>>(mut self, name: S) -> Self { + self.name = name.into(); + self + } + + /// The displayed version of the client. + /// + /// # Default + /// `3.2.1 on Linux` + #[inline] + pub fn version(mut self, version: Version) -> Self { + self.version = version; + self + } + + /// The hardware ID (HWID) of the client. + /// + /// # Default + /// `923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc` + #[inline] + pub fn hardware_id>>(mut self, hwid: S) -> Self { + self.hardware_id = hwid.into(); + self + } + + /// Connect to a specific channel. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").channel("Default Channel"); + /// ``` + /// + /// Connecting to a channel further down in the hierarchy. + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").channel("Default Channel/Nested"); + /// ``` + #[inline] + pub fn channel>>(mut self, path: S) -> Self { + self.channel = Some(path.into()); + self + } + + /// Connect to a specific channel. + /// + /// Setting the channel id is equal to connecting to the channel `/`. + /// + /// # Example + /// ``` + /// # use tsclientlib::{ChannelId, Connection}; + /// let opts = Connection::build("localhost").channel_id(ChannelId(2)); + /// ``` + #[inline] + pub fn channel_id(mut self, channel: ChannelId) -> Self { + self.channel = Some(format!("/{}", channel.0).into()); + self + } + + /// Use a password for the given channel when connecting. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost") + /// .channel("Secret Channel") + /// .channel_password("My secret password"); + /// ``` + #[inline] + pub fn channel_password>>(mut self, pwd: S) -> Self { + self.channel_password = Some(pwd.into()); + self + } + + /// Use a server password when connecting. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").password("My secret password"); + /// ``` + #[inline] + pub fn password>>(mut self, pwd: S) -> Self { + self.password = Some(pwd.into()); + self + } + + /// Connect to the server in a muted state. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").input_muted(true); + /// ``` + #[inline] + pub fn input_muted(mut self, input_muted: bool) -> Self { + self.input_muted = input_muted; + self + } + + /// Connect to the server with the output muted. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").output_muted(true); + /// ``` + #[inline] + pub fn output_muted(mut self, output_muted: bool) -> Self { + self.output_muted = output_muted; + self + } + + /// Connect to the server with input hardware disabled state. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").input_hardware_enabled(true); + /// ``` + #[inline] + pub fn input_hardware_enabled(mut self, input_hardware_enabled: bool) -> Self { + self.input_hardware_enabled = input_hardware_enabled; + self + } + + /// Connect to the server with output hardware disabled stat. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").output_hardware_enabled(true); + /// ``` + #[inline] + pub fn output_hardware_enabled(mut self, output_hardware_enabled: bool) -> Self { + self.output_hardware_enabled = output_hardware_enabled; + self + } + + /// Connect to the server with an away message. + /// + /// # Example + /// ``` + /// # use tsclientlib::Connection; + /// let opts = Connection::build("localhost").away("Buying groceries"); + /// ``` + #[inline] + pub fn away>>(mut self, message: S) -> Self { + self.away = Some(message.into()); + self + } + + /// If the content of all commands should be written to the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_commands(mut self, log_commands: bool) -> Self { + self.log_commands = log_commands; + self + } + + /// If the content of all packets in high-level form should be written to + /// the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_packets(mut self, log_packets: bool) -> Self { + self.log_packets = log_packets; + self + } + + /// If the content of all udp packets in byte-array form should be written + /// to the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_udp_packets(mut self, log_udp_packets: bool) -> Self { + self.log_udp_packets = log_udp_packets; + self + } + + #[inline] + pub fn get_address(&self) -> &ServerAddress { &self.address } + #[inline] + pub fn get_local_address(&self) -> Option<&SocketAddr> { self.local_address.as_ref() } + #[inline] + pub fn get_identity(&self) -> Option<&Identity> { self.identity.as_ref() } + #[inline] + pub fn get_server(&self) -> Option<&Uid> { self.server.as_deref() } + #[inline] + pub fn get_name(&self) -> &str { &self.name } + #[inline] + pub fn get_version(&self) -> &Version { &self.version } + #[inline] + pub fn get_hardware_id(&self) -> &str { &self.hardware_id } + #[inline] + pub fn get_channel(&self) -> Option<&str> { self.channel.as_ref().map(AsRef::as_ref) } + #[inline] + pub fn get_channel_password(&self) -> Option<&str> { + self.channel_password.as_ref().map(AsRef::as_ref) + } + #[inline] + pub fn get_password(&self) -> Option<&str> { self.password.as_ref().map(AsRef::as_ref) } + #[inline] + pub fn get_input_muted(&self) -> bool { self.input_muted } + #[inline] + pub fn get_output_muted(&self) -> bool { self.output_muted } + #[inline] + pub fn get_input_hardware_enabled(&self) -> bool { self.input_hardware_enabled } + #[inline] + pub fn get_output_hardware_enabled(&self) -> bool { self.output_hardware_enabled } + #[inline] + pub fn get_away(&self) -> Option<&str> { self.away.as_ref().map(AsRef::as_ref) } + #[inline] + pub fn get_log_commands(&self) -> bool { self.log_commands } + #[inline] + pub fn get_log_packets(&self) -> bool { self.log_packets } + #[inline] + pub fn get_log_udp_packets(&self) -> bool { self.log_udp_packets } +} diff --git a/native/vendor/tsclientlib/tsclientlib/src/prelude.rs b/native/vendor/tsclientlib/tsclientlib/src/prelude.rs new file mode 100644 index 0000000..29b9124 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/prelude.rs @@ -0,0 +1,4 @@ +pub use ts_bookkeeping::data::exts::*; +pub use ts_bookkeeping::messages::OutMessageTrait; + +pub use crate::OutCommandExt as _; diff --git a/native/vendor/tsclientlib/tsclientlib/src/resolver.rs b/native/vendor/tsclientlib/tsclientlib/src/resolver.rs new file mode 100644 index 0000000..d6dea01 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/resolver.rs @@ -0,0 +1,514 @@ +//! Resolve TeamSpeak server addresses of any kind. +// Changes with TeamSpeak client 3.1: +// https://support.teamspeakusa.com/index.php?/Knowledgebase/Article/View/332 + +use std::net::{IpAddr, Ipv6Addr, SocketAddr}; +use std::str; + +use futures::prelude::*; +use hickory_net::proto::rr::RData; +use hickory_resolver::TokioResolver; +use hickory_resolver::config::{CLOUDFLARE, ResolverConfig, ResolverOpts}; +use hickory_resolver::net::runtime::TokioRuntimeProvider; +use itertools::Itertools; +use rand::RngExt; +use thiserror::Error; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tokio::net::{self, TcpStream}; +use tokio::time::Duration; +use tracing::{debug, instrument, warn}; + +const DEFAULT_PORT: u16 = 9987; +const DNS_PREFIX_TCP: &str = "_tsdns._tcp."; +const DNS_PREFIX_UDP: &str = "_ts3._udp."; +const NICKNAME_LOOKUP_ADDRESS: &str = "https://named.myteamspeak.com/lookup"; +/// Wait this amount of seconds before giving up. +const TIMEOUT_SECONDS: u64 = 10; + +type Result = std::result::Result; + +#[derive(Debug, Error)] +#[non_exhaustive] +pub enum Error { + #[error("Failed to create resolver: {0}")] + CreateResolver(#[source] hickory_net::NetError), + #[error("Invalid IPv4 address")] + InvalidIp4Address, + #[error("Invalid IPv6 address")] + InvalidIp6Address, + #[error("Invalid IP address")] + InvalidIpAddress, + #[error("Not a valid nickname")] + InvalidNickname, + #[error("Failed to parse port: {0}")] + InvalidPort(#[source] std::num::ParseIntError), + #[error("Failed to contact {0} server: {1}")] + Io(&'static str, #[source] std::io::Error), + #[error("Failed to parse url: {0}")] + NicknameParseUrl(#[source] url::ParseError), + #[error("Failed to resolve nickname: {0}")] + NicknameResolve(#[source] reqwest::Error), + #[error("Failed to resolve hostname: {0}")] + ResolveHost(#[source] tokio::io::Error), + #[error("Failed to get SRV record")] + SrvLookup(#[source] hickory_net::NetError), + #[error("tsdns did not return an ip address but {0:?}")] + TsdnsAddressInvalidResponse(String), + #[error("tsdns server does not know the address")] + TsdnsAddressNotFound, + #[error("Failed to parse tsdns response: {0}")] + TsdnsParseResponse(#[source] std::str::Utf8Error), +} + +#[derive(Debug, PartialEq, Eq)] +enum ParseIpResult<'a> { + Addr(SocketAddr), + Other(&'a str, Option), +} + +/// Beware that this may be slow because it tries all available methods. +/// +/// The following methods are tried: +/// 1. If the address is an ip, the ip is returned +/// 1. Server nicknames are resolved by a http request to TeamSpeak +/// 1. The SRV record at `_ts3._udp.
` +/// 1. The SRV record at `_tsdns._tcp.address.tld` to get the address of a tsdns +/// server, e.g. when the address is `ts3.subdomain.from.com`, the SRV record +/// at `_tsdns._tcp.from.com` is requested +/// 1. Directly resolve the address to an ip address +/// +/// If a port is given with `:port`, it overwrites the automatically determined +/// port. IPv6 addresses are put in square brackets when a port is present: +/// `[::1]:9987` +#[instrument] +pub fn resolve(address: String) -> impl Stream> { + debug!("Starting resolve"); + let addr; + let port; + match parse_ip(&address) { + Ok(ParseIpResult::Addr(res)) => { + return stream::once(future::ok(res)).left_stream(); + } + Ok(ParseIpResult::Other(a, p)) => { + addr = a.to_string(); + port = p; + if let Some(port) = port { + debug!(port, "Found port"); + } + } + Err(res) => return stream::once(future::err(res)).left_stream(), + } + + // Resolve as nickname + let res = if !address.contains('.') && addr != "localhost" { + debug!("Resolving nickname"); + // Could be a server nickname + resolve_nickname(address.clone()) + .map_ok(move |mut addr| { + if let Some(port) = port { + addr.set_port(port); + } + addr + }) + .left_stream() + } else { + stream::once(future::err(Error::InvalidNickname)).right_stream() + }; + + // The system config does not yet work on android: + // https://github.com/bluejekyll/trust-dns/issues/652 + let addr2 = addr.clone(); + // TODO Move current span into stream + let res = res.chain( + stream::once(async move { + let resolver = create_resolver()?; + + // Try to get the address by an SRV record + Result::<_>::Ok(resolve_srv(resolver, format!("{DNS_PREFIX_UDP}{addr2}."))) + }) + .try_flatten(), + ); + + // Try to get the address of a tsdns server by an SRV record + let addr2 = addr.clone(); + // TODO Move current span into stream + let res = res.chain( + stream::once(async move { + let resolver = create_resolver()?; + // Trim address to two components + let name = if let Some(i) = addr2.rfind('.').and_then(|i| addr2[..i].rfind('.')) { + &addr2[i + 1..] + } else { + &addr2 + }; + // Pick the first srv record of the first server that answers + Result::<_>::Ok(resolve_srv(resolver, format!("{DNS_PREFIX_TCP}{name}.")).and_then( + move |srv| { + let address = address.clone(); + async move { + // Got tsdns server + let mut addr = resolve_tsdns(srv, &address).await?; + if let Some(port) = port { + // Overwrite port if it was specified + addr.set_port(port); + } + Ok(addr) + } + }, + )) + }) + .try_flatten(), + ); + + // Interpret as normal address and resolve with system resolver + let res = res.chain( + stream::once(async move { + let res = net::lookup_host((addr.as_str(), port.unwrap_or(DEFAULT_PORT))) + .await + .map_err(Error::ResolveHost)? + .map(Ok) + .collect::>(); + Result::<_>::Ok(stream::iter(res)) + }) + .try_flatten(), + ); + + // TODO Move current span into stream + tokio_stream::StreamExt::timeout(res, Duration::from_secs(TIMEOUT_SECONDS)) + .filter_map(move |r: std::result::Result, _>| { + future::ready(match r { + // Timeout + Err(_) => None, + // Error + Ok(Err(error)) => { + debug!(%error, "Resolver failed in one step"); + None + } + // Success + Ok(Ok(r)) => Some(Ok(r)), + }) + }) + .right_stream() +} + +// Windows for some reason automatically adds a link-local address to the dns +// resolver. These addresses are usually not reachable and should be filtered out. +// See: https://superuser.com/questions/638566/strange-value-in-dns-shown-in-ipconfig +const FILTERED_IPS: &[IpAddr] = &[ + IpAddr::V6(Ipv6Addr::new(0xfec0, 0, 0, 0xffff, 0, 0, 0, 1)), + IpAddr::V6(Ipv6Addr::new(0xfec0, 0, 0, 0xffff, 0, 0, 0, 2)), + IpAddr::V6(Ipv6Addr::new(0xfec0, 0, 0, 0xffff, 0, 0, 0, 3)), +]; + +fn create_resolver() -> Result { + let (config, options) = match hickory_resolver::system_conf::read_system_conf() { + Ok((mut config, options)) => { + config.name_servers.retain(|ns| !FILTERED_IPS.contains(&ns.ip)); + (config, options) + } + Err(error) => { + warn!(%error, "Failed to use system dns resolver config"); + // Fallback + (ResolverConfig::udp_and_tcp(&CLOUDFLARE), ResolverOpts::default()) + } + }; + let mut builder = TokioResolver::builder_with_config(config, TokioRuntimeProvider::default()); + *builder.options_mut() = options; + builder.build().map_err(Error::CreateResolver) +} + +fn parse_ip(address: &str) -> Result> { + let mut addr = address; + let mut port = None; + if let Some(pos) = address.rfind(':') { + // Either with port or IPv6 address + if address.find(':').unwrap() == pos { + // Port is appended + addr = &address[..pos]; + port = Some(&address[pos + 1..]); + if addr.chars().all(|c| c.is_ascii_digit() || c == '.') { + // IPv4 address + return Ok(ParseIpResult::Addr( + std::net::ToSocketAddrs::to_socket_addrs(address) + .map_err(|_| Error::InvalidIp4Address)? + .next() + .ok_or(Error::InvalidIp4Address)?, + )); + } + } else if let Some(pos_bracket) = address.rfind(']') { + if pos_bracket < pos { + // IPv6 address and port + return Ok(ParseIpResult::Addr( + std::net::ToSocketAddrs::to_socket_addrs(address) + .map_err(|_| Error::InvalidIp6Address)? + .next() + .ok_or(Error::InvalidIp6Address)?, + )); + } else if pos_bracket == address.len() - 1 && address.starts_with('[') { + // IPv6 address + return Ok(ParseIpResult::Addr( + std::net::ToSocketAddrs::to_socket_addrs(&( + &address[1..pos_bracket], + DEFAULT_PORT, + )) + .map_err(|_| Error::InvalidIp6Address)? + .next() + .ok_or(Error::InvalidIp6Address)?, + )); + } else { + return Err(Error::InvalidIpAddress); + } + } else { + // IPv6 address + return Ok(ParseIpResult::Addr( + std::net::ToSocketAddrs::to_socket_addrs(&(address, DEFAULT_PORT)) + .map_err(|_| Error::InvalidIp6Address)? + .next() + .ok_or(Error::InvalidIp6Address)?, + )); + } + } else if address.chars().all(|c| c.is_ascii_digit() || c == '.') { + // IPv4 address + return Ok(ParseIpResult::Addr( + std::net::ToSocketAddrs::to_socket_addrs(&(address, DEFAULT_PORT)) + .map_err(|_| Error::InvalidIp4Address)? + .next() + .ok_or(Error::InvalidIp4Address)?, + )); + } + let port = if let Some(port) = port.map(|p| p.parse().map_err(Error::InvalidPort)) { + Some(port?) + } else { + None + }; + Ok(ParseIpResult::Other(addr, port)) +} + +pub fn resolve_nickname(nickname: String) -> impl Stream> { + stream::once(async { + let nickname = nickname; + let url = + reqwest::Url::parse_with_params(NICKNAME_LOOKUP_ADDRESS, Some(("name", &nickname))) + .map_err(Error::NicknameParseUrl)?; + let body = reqwest::get(url) + .await + .map_err(Error::NicknameResolve)? + .error_for_status() + .map_err(Error::NicknameResolve)? + .text() + .await + .map_err(Error::NicknameResolve)?; + let addrs = body + .split(&['\r', '\n'][..]) + .filter(|s| !s.is_empty()) + .map(|s| Result::<_>::Ok(s.to_string())) + .collect::>(); + + Result::<_>::Ok( + stream::iter(addrs) + .and_then(|addr| async move { + match parse_ip(&addr)? { + ParseIpResult::Addr(a) => Ok(stream::once(future::ok(a)).left_stream()), + ParseIpResult::Other(a, p) => { + let addrs = net::lookup_host((a, p.unwrap_or(DEFAULT_PORT))) + .await + .map_err(Error::ResolveHost)? + .collect::>(); + Ok(stream::iter(addrs).map(Result::<_>::Ok).right_stream()) + } + } + }) + .try_flatten(), + ) + }) + .try_flatten() +} + +pub async fn resolve_tsdns(server: A, addr: &str) -> Result { + let mut stream = TcpStream::connect(server).await.map_err(|e| Error::Io("tsdns", e))?; + stream.write_all(addr.as_bytes()).await.map_err(|e| Error::Io("tsdns", e))?; + let mut data = Vec::new(); + stream.read_to_end(&mut data).await.map_err(|e| Error::Io("tsdns", e))?; + + let addr = str::from_utf8(&data).map_err(Error::TsdnsParseResponse)?; + if addr.starts_with("404") { + return Err(Error::TsdnsAddressNotFound); + } + match parse_ip(addr)? { + ParseIpResult::Addr(a) => Ok(a), + _ => Err(Error::TsdnsAddressInvalidResponse(addr.to_string())), + } +} + +fn resolve_srv(resolver: TokioResolver, addr: String) -> impl Stream> { + stream::once(async { + let lookup = resolver.srv_lookup(addr).await.map_err(Error::SrvLookup)?; + let srvs = lookup + .answers() + .iter() + .map(|r| { + let RData::SRV(srv) = &r.data else { panic!("Unexpected answer") }; + srv.clone() + }) + .collect::>(); + + let prios = srvs.iter().chunk_by(|srv| srv.priority); + let entries = prios.into_iter().sorted_by_key(|(p, _)| *p); + + // Select by weight + let mut sorted_entries = Vec::new(); + for (_, es) in entries { + let mut zero_entries = Vec::new(); + + // All non-zero entries + let mut entries = es + .filter_map(|e| { + if e.weight == 0 { + zero_entries.push(e); + None + } else { + Some(e) + } + }) + .collect::>(); + + while !entries.is_empty() { + let weight: u32 = entries.iter().map(|e| e.weight as u32).sum(); + let mut w = rand::rng().random_range(0..=weight); + if w == 0 { + // Pick the first entry with weight 0 + if let Some(i) = entries.iter().position(|e| e.weight == 0) { + sorted_entries.push(entries.remove(i)); + } + } + for i in 0..entries.len() { + let weight = entries[i].weight as u32; + if w <= weight { + sorted_entries.push(entries.remove(i)); + break; + } + w -= weight; + } + } + } + + let res = sorted_entries + .into_iter() + .map(|e| Ok((e.target.to_ascii(), e.port))) + .collect::>>(); + drop(resolver); + Ok(stream::iter(res) + .and_then(|(e, port)| async move { + let res = net::lookup_host((e.as_str(), port)) + .await + .map_err(Error::ResolveHost)? + .map(Ok) + .collect::>(); + Ok(stream::iter(res)) + }) + .try_flatten()) + }) + .try_flatten() +} + +#[cfg(test)] +mod test { + use super::*; + use crate::tests::create_logger; + + #[test] + fn parse_ip_without_port() { + let res = parse_ip("127.0.0.1"); + assert_eq!( + res.unwrap(), + ParseIpResult::Addr(format!("127.0.0.1:{}", DEFAULT_PORT).parse().unwrap()) + ); + } + + #[test] + fn parse_ip_with_port() { + let res = parse_ip("127.0.0.1:1"); + assert_eq!(res.unwrap(), ParseIpResult::Addr("127.0.0.1:1".parse().unwrap())); + } + + #[test] + fn parse_ip6_without_port() { + let res = parse_ip("::"); + assert_eq!( + res.unwrap(), + ParseIpResult::Addr(format!("[::]:{}", DEFAULT_PORT).parse().unwrap()) + ); + } + + #[test] + fn parse_ip6_without_port2() { + let res = parse_ip("[::]"); + assert_eq!( + res.unwrap(), + ParseIpResult::Addr(format!("[::]:{}", DEFAULT_PORT).parse().unwrap()) + ); + } + + #[test] + fn parse_ip6_with_port() { + let res = parse_ip("[::]:1"); + assert_eq!(res.unwrap(), ParseIpResult::Addr("[::]:1".parse().unwrap())); + } + + #[test] + fn parse_ip_address_without_port() { + assert_eq!(parse_ip("localhost").unwrap(), ParseIpResult::Other("localhost", None)); + } + + #[test] + fn parse_ip_address_with_port() { + assert_eq!(parse_ip("localhost:1").unwrap(), ParseIpResult::Other("localhost", Some(1))); + } + + #[test] + fn parse_ip_with_large_port() { + assert!(parse_ip("127.0.0.1:65536").is_err()); + } + + #[tokio::test] + async fn resolve_localhost() { + create_logger(); + let res: Vec<_> = resolve("127.0.0.1".into()).map(|r| r.unwrap()).collect().await; + let addr = format!("127.0.0.1:{}", DEFAULT_PORT).parse::().unwrap(); + assert_eq!(res.as_slice(), &[addr]); + } + + #[tokio::test] + async fn resolve_localhost2() { + create_logger(); + let res: Vec<_> = resolve("localhost".into()).map(|r| r.unwrap()).collect().await; + assert!(res.contains(&format!("127.0.0.1:{}", DEFAULT_PORT).parse().unwrap())); + } + + #[tokio::test] + async fn resolve_example() { + create_logger(); + let res: Vec<_> = resolve("example.com".into()).map(|r| r.unwrap()).collect().await; + assert!(!res.is_empty()); + } + + #[tokio::test] + async fn resolve_splamy_de() { + create_logger(); + + let res: Vec<_> = tokio::time::timeout( + Duration::from_secs(5), + resolve("splamy.de".into()).map(|r| r.unwrap()).collect(), + ) + .await + .expect("Resolve takes unacceptable long"); + assert!(res.contains(&format!("37.120.179.68:{}", DEFAULT_PORT).parse().unwrap())); + } + + #[tokio::test] + async fn resolve_loc() { + create_logger(); + let res: Vec<_> = resolve("loc".into()).map(|r| r.unwrap()).collect().await; + assert!(res.contains(&format!("127.0.0.1:{}", DEFAULT_PORT).parse().unwrap())); + } +} diff --git a/native/vendor/tsclientlib/tsclientlib/src/sync.rs b/native/vendor/tsclientlib/tsclientlib/src/sync.rs new file mode 100644 index 0000000..058a3ba --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/sync.rs @@ -0,0 +1,470 @@ +//! The `sync` module contains an easier to use interface for a connection. +//! +//! It makes it easier to use a connection from multiple threads and use +//! `async`/`await` syntax for the cost of a little bit performance. +use std::collections::HashMap; +use std::ops::{Deref, DerefMut}; +use std::pin::Pin; +use std::task::{Context, Poll}; + +use futures::prelude::*; +use tokio::sync::{mpsc, oneshot}; +use tracing::{error, info}; +use ts_bookkeeping::ChannelId; +#[cfg(any(feature = "audio", feature = "raw-audio"))] +use tsproto_packets::packets::InAudioBuf; +#[cfg(feature = "unstable")] +use tsproto_packets::packets::OutCommand; + +use crate::{ + events, AudioEvent, DisconnectOptions, Error, InMessage, Result, StreamItem, + TemporaryDisconnectReason, +}; + +enum SyncConMessage { + RunFn(Box), + #[cfg(feature = "unstable")] + SendCommand(OutCommand, oneshot::Sender>), + WaitConnected(oneshot::Sender>), + Disconnect(DisconnectOptions, oneshot::Sender>), + DownloadFile { + channel_id: ChannelId, + path: String, + channel_password: Option, + seek_position: Option, + send: oneshot::Sender>, + }, + UploadFile { + channel_id: ChannelId, + path: String, + channel_password: Option, + size: u64, + overwrite: bool, + resume: bool, + send: oneshot::Sender>, + }, +} + +/// This is a subset of [`StreamItem`](crate::StreamItem). +pub enum SyncStreamItem { + /// All the incoming book events. + /// + /// If a connection to the server was established this will contain an added event of a server. + BookEvents(Vec), + /// All incoming messages that are not related to the book. + /// + /// This contains messages like `ChannelListFinished` or `ClientChatComposing`. + /// All events related to channels or clients are returned as events in the `BookEvents` + /// variant. Other messages handled by tsclientlib, e.g. for filetransfer are also not included + /// in these events. + MessageEvent(InMessage), + /// Received an audio packet. + /// + /// Audio packets can be handled by the [`AudioHandler`](crate::audio::AudioHandler), which + /// builds a queue per client and handles packet loss and jitter. + #[cfg(any(feature = "audio", feature = "raw-audio"))] + Audio(InAudioBuf), + /// The needed level. + IdentityLevelIncreasing(u8), + /// This event may occur without an `IdentityLevelIncreasing` event before + /// if a new identity is created because no identity was supplied. + IdentityLevelIncreased, + /// The connection timed out or the server shut down. The connection will be + /// rebuilt automatically. + DisconnectedTemporarily(TemporaryDisconnectReason), + /// The network statistics were updated. + /// + /// This means e.g. the packet loss got a new value. Clients with audio probably want to update + /// the packet loss option of opus. + NetworkStatsUpdated, + /// A change related to audio. + AudioChange(AudioEvent), +} + +/// A handle for a [`SyncConnection`] which can be sent across threads. +/// +/// All actions like sending messages, downloading and uploading happens through +/// a handle. +#[derive(Clone)] +pub struct SyncConnectionHandle { + send: mpsc::Sender, +} + +pub struct SyncConnection { + con: super::Connection, + recv: mpsc::Receiver, + send: mpsc::Sender, + + commands: HashMap>>, + connects: Vec>>, + disconnects: Vec>>, + downloads: + HashMap>>, + uploads: HashMap>>, +} + +impl From for SyncConnection { + fn from(con: super::Connection) -> Self { + let (send, recv) = mpsc::channel(1); + Self { + con, + recv, + send, + + commands: Default::default(), + connects: Default::default(), + disconnects: Default::default(), + downloads: Default::default(), + uploads: Default::default(), + } + } +} + +impl Deref for SyncConnection { + type Target = super::Connection; + #[inline] + fn deref(&self) -> &Self::Target { &self.con } +} + +impl DerefMut for SyncConnection { + #[inline] + fn deref_mut(&mut self) -> &mut ::Target { &mut self.con } +} + +impl Stream for SyncConnection { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, ctx: &mut Context) -> Poll> { + let _span = self.con.span.clone().entered(); + loop { + if let Poll::Ready(msg) = self.recv.poll_recv(ctx) { + if let Some(msg) = msg { + match msg { + SyncConMessage::RunFn(f) => f(&mut self), + #[cfg(feature = "unstable")] + SyncConMessage::SendCommand(arg, send) => { + let handle = match self.con.send_command_with_result(arg) { + Ok(r) => r, + Err(e) => { + let _ = send.send(Err(e)); + continue; + } + }; + self.commands.insert(handle, send); + } + SyncConMessage::WaitConnected(send) => { + if self.con.get_state().is_ok() { + let _ = send.send(Ok(())); + } else { + self.connects.push(send); + } + } + SyncConMessage::Disconnect(arg, send) => { + match self.con.disconnect(arg) { + Ok(r) => r, + Err(e) => { + let _ = send.send(Err(e)); + continue; + } + } + self.disconnects.push(send); + } + SyncConMessage::DownloadFile { + channel_id, + path, + channel_password, + seek_position, + send, + } => { + let handle = match self.con.download_file( + channel_id, + &path, + channel_password.as_deref(), + seek_position, + ) { + Ok(r) => r, + Err(e) => { + let _ = send.send(Err(e)); + continue; + } + }; + self.downloads.insert(handle, send); + } + SyncConMessage::UploadFile { + channel_id, + path, + channel_password, + size, + overwrite, + resume, + send, + } => { + let handle = match self.con.upload_file( + channel_id, + &path, + channel_password.as_deref(), + size, + overwrite, + resume, + ) { + Ok(r) => r, + Err(e) => { + let _ = send.send(Err(e)); + continue; + } + }; + self.uploads.insert(handle, send); + } + } + continue; + } else { + error!("Message stream ended unexpectedly"); + } + } + break; + } + + loop { + break if let Poll::Ready(item) = self.con.poll_next(ctx) { + Poll::Ready(match item { + Some(Ok(item)) => Some(Ok(match item { + StreamItem::BookEvents(i) => { + self.connects.drain(..).for_each(|send| { + let _ = send.send(Ok(())); + }); + SyncStreamItem::BookEvents(i) + } + StreamItem::MessageEvent(i) => SyncStreamItem::MessageEvent(i), + #[cfg(any(feature = "audio", feature = "raw-audio"))] + StreamItem::Audio(i) => SyncStreamItem::Audio(i), + StreamItem::IdentityLevelIncreasing(i) => { + SyncStreamItem::IdentityLevelIncreasing(i) + } + StreamItem::IdentityLevelIncreased => { + SyncStreamItem::IdentityLevelIncreased + } + StreamItem::DisconnectedTemporarily(reason) => { + SyncStreamItem::DisconnectedTemporarily(reason) + } + StreamItem::MessageResult(handle, res) => { + if let Some(send) = self.commands.remove(&handle) { + let _ = send.send(res.map_err(|e| e.into())); + } else { + info!("Got untracked message result"); + } + continue; + } + StreamItem::FileDownload(handle, res) => { + if let Some(send) = self.downloads.remove(&handle) { + let _ = send.send(Ok(res)); + } else { + info!("Got untracked download"); + } + continue; + } + StreamItem::FileUpload(handle, res) => { + if let Some(send) = self.uploads.remove(&handle) { + let _ = send.send(Ok(res)); + } else { + info!("Got untracked upload"); + } + continue; + } + StreamItem::FiletransferFailed(handle, res) => { + if let Some(send) = self.downloads.remove(&handle) { + let _ = send.send(Err(res)); + } else if let Some(send) = self.uploads.remove(&handle) { + let _ = send.send(Err(res)); + } else { + info!("Got untracked file transfer"); + } + continue; + } + StreamItem::NetworkStatsUpdated => SyncStreamItem::NetworkStatsUpdated, + StreamItem::AudioChange(change) => SyncStreamItem::AudioChange(change), + })), + Some(Err(e)) => Some(Err(e)), + None => { + self.disconnects.drain(..).for_each(|send| { + let _ = send.send(Ok(())); + }); + None + } + }) + } else { + Poll::Pending + }; + } + } +} + +impl SyncConnection { + /// Get a handle to the connection that can be sent across threads. + #[inline] + pub fn get_handle(&self) -> SyncConnectionHandle { + SyncConnectionHandle { send: self.send.clone() } + } +} + +impl SyncConnectionHandle { + /// Run a function on the connection. + pub async fn with_connection< + T: Send + 'static, + F: FnOnce(&mut SyncConnection) -> T + Send + 'static, + >( + &mut self, f: F, + ) -> Result { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::RunFn(Box::new(move |con| { + let _ = send.send(f(con)); + }))) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone) + } + + /// Adds a `return_code` to the command and returns if the corresponding + /// answer is received. If an error occurs, the future will return an error. + #[cfg(feature = "unstable")] + pub async fn send_command(&mut self, arg: OutCommand) -> Result<()> { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::SendCommand(arg, send)) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone)? + } + + /// This future resolves once the connection is connected to the server. + pub async fn wait_until_connected(&mut self) -> Result<()> { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::WaitConnected(send)) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone)? + } + + /// Disconnect from the server. + /// + /// # Arguments + /// - `options`: Either `None` or `DisconnectOptions`. + /// + /// # Examples + /// + /// Use default options: + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, ConnectOptions, DisconnectOptions, StreamItem}; + /// # use tsclientlib::sync::SyncConnection; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let con: SyncConnection = Connection::build("localhost").connect().unwrap().into(); + /// let mut handle = con.get_handle(); + /// tokio::spawn(con.for_each(|_| future::ready(()))); + /// // Wait until connected + /// handle.wait_until_connected().await.unwrap(); + /// + /// // Disconnect + /// handle.disconnect(DisconnectOptions::new()).await.unwrap(); + /// # } + /// ``` + /// + /// Specify a reason and a quit message: + /// + /// ```no_run + /// # use futures::prelude::*; + /// # use tsclientlib::{Connection, ConnectOptions, DisconnectOptions, Reason, StreamItem}; + /// # use tsclientlib::sync::SyncConnection; + /// + /// # #[tokio::main] + /// # async fn main() { + /// let con: SyncConnection = Connection::build("localhost").connect().unwrap().into(); + /// let mut handle = con.get_handle(); + /// tokio::spawn(con.for_each(|_| future::ready(()))); + /// // Wait until connected + /// handle.wait_until_connected().await.unwrap(); + /// + /// // Disconnect + /// let options = DisconnectOptions::new() + /// .reason(Reason::Clientdisconnect) + /// .message("Away for a while"); + /// handle.disconnect(DisconnectOptions::new()).await.unwrap(); + /// # } + /// ``` + pub async fn disconnect(&mut self, arg: DisconnectOptions) -> Result<()> { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::Disconnect(arg, send)) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone)? + } + + /// Download a file from a channel of the connected TeamSpeak server. + /// + /// Returns the size of the file and a tcp stream of the requested file. + /// + /// # Example + /// Download an icon. + /// + /// ```no_run + /// # use tsclientlib::ChannelId; + /// # let handle: tsclientlib::sync::SyncConnectionHandle = panic!(); + /// # let id = 0; + /// let download = handle.download_file(ChannelId(0), format!("/icon_{}", id), None, None); + /// ``` + pub async fn download_file( + &mut self, channel_id: ChannelId, path: String, channel_password: Option, + seek_position: Option, + ) -> Result { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::DownloadFile { + channel_id, + path, + channel_password, + seek_position, + send, + }) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone)? + } + + /// Upload a file to a channel of the connected TeamSpeak server. + /// + /// Returns the size of the part which is already uploaded (when resume is + /// specified) and a tcp stream where the requested file should be uploaded. + /// + /// # Example + /// Upload an avatar. + /// + /// ```no_run + /// # use tsclientlib::ChannelId; + /// # let handle: tsclientlib::sync::SyncConnectionHandle = panic!(); + /// # let size = 0; + /// let upload = handle.upload_file(ChannelId(0), "/avatar".to_string(), None, size, true, false); + /// ``` + pub async fn upload_file( + &mut self, channel_id: ChannelId, path: String, channel_password: Option, + size: u64, overwrite: bool, resume: bool, + ) -> Result { + let (send, recv) = oneshot::channel(); + self.send + .send(SyncConMessage::UploadFile { + channel_id, + path, + channel_password, + size, + overwrite, + resume, + send, + }) + .await + .map_err(|_| Error::ConnectionGone)?; + recv.await.map_err(|_| Error::ConnectionGone)? + } +} diff --git a/native/vendor/tsclientlib/tsclientlib/src/tests.rs b/native/vendor/tsclientlib/tsclientlib/src/tests.rs new file mode 100644 index 0000000..d5752e8 --- /dev/null +++ b/native/vendor/tsclientlib/tsclientlib/src/tests.rs @@ -0,0 +1,37 @@ +use once_cell::sync::Lazy; +use ts_bookkeeping::messages::s2c::InMessage; +use tsproto_packets::packets::{Direction, Flags, OutPacket, PacketType}; + +static TRACING: Lazy<()> = Lazy::new(|| tracing_subscriber::fmt().with_test_writer().init()); + +pub(crate) fn create_logger() { Lazy::force(&TRACING); } + +fn parse_msg(msg: &str) -> InMessage { + let header = OutPacket::new_with_dir(Direction::S2C, Flags::empty(), PacketType::Command); + + InMessage::new(&header.header(), msg.as_bytes()).unwrap() +} + +fn test_iconid(input: &str, expected: u32) { + create_logger(); + + let msg = parse_msg(&format!( + r#"initserver virtualserver_name=TeamSpeak\s]I[\sServer virtualserver_welcomemessage=Welcome\sto\sTeamSpeak,\scheck\s[URL]www.teamspeak.com[\/URL]\sfor\slatest\sinformation virtualserver_platform=Linux virtualserver_version=3.11.0\s[Build:\s1578903157] virtualserver_maxclients=32 virtualserver_created=1571572631 virtualserver_codec_encryption_mode=2 virtualserver_hostmessage virtualserver_hostmessage_mode=0 virtualserver_default_server_group=8 virtualserver_default_channel_group=8 virtualserver_hostbanner_url virtualserver_hostbanner_gfx_url virtualserver_hostbanner_gfx_interval=0 virtualserver_priority_speaker_dimm_modificator=-18.0000 virtualserver_id=1 virtualserver_hostbutton_tooltip virtualserver_hostbutton_url virtualserver_hostbutton_gfx_url virtualserver_name_phonetic virtualserver_ip=0.0.0.0,\s:: virtualserver_ask_for_privilegekey=0 virtualserver_hostbanner_mode=0 virtualserver_channel_temp_delete_delay_default=0 virtualserver_nickname client_nickname=TeamSpeakUser client_version=3.?.?\s[Build:\s5680278000] client_platform=Windows client_input_muted=0 client_output_muted=0 client_outputonly_muted=0 client_input_hardware=1 client_output_hardware=1 client_default_channel client_default_channel_password client_server_password client_meta_data client_version_sign=DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg== client_security_hash client_key_offset=354 client_away=0 client_away_message client_nickname_phonetic client_default_token client_badges client_myteamspeak_id client_integrations client_active_integrations_info client_myteamspeak_avatar client_signed_badges acn=TeamSpeakUser aclid=2 pv=7 client_talk_power=75 client_needed_serverquery_view_power=75 virtualserver_icon_id={}"#, + input + )); + if let InMessage::InitServer(list) = msg { + let cmd = list.iter().next().unwrap(); + assert_eq!(cmd.icon, ts_bookkeeping::IconId(expected)); + } else { + panic!("Failed to parse as initserver"); + } +} + +#[test] +fn normal_iconid() { test_iconid("96136942", 96136942); } + +#[test] +fn negative_iconid() { test_iconid("-96136942", 4198830354); } + +#[test] +fn big_iconid() { test_iconid("18446744073225738240", 3811153920); } diff --git a/native/vendor/tsclientlib/tsproto/Cargo.toml b/native/vendor/tsclientlib/tsproto/Cargo.toml new file mode 100644 index 0000000..b4fd1af --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/Cargo.toml @@ -0,0 +1,67 @@ +[package] +name = "tsproto" +version = "0.2.0" +authors = ["Flakebi "] +description = "An implementation of the TeamSpeak3 protocol as a library for use in clients and bots." +repository = "https://github.com/ReSpeak/tsclientlib" +readme = "README.md" +keywords = ["teamspeak3", "ts3", "voip"] +categories = ["multimedia"] +license = "MIT OR Apache-2.0" +edition = "2018" +autobenches = false +include = [ + "/Cargo.toml", + "/README.md", + "**/*.rs", +] + +[dependencies] +aes = "0.8" +base64 = "0.22" +omnom = "3" +curve25519-dalek-ng = "4" +eax = "0.5" +futures = "0.3" +generic-array = "0.14" +git-testament = "0.2" +num-bigint = "0.4" +num-derive = "0.4" +num-traits = "0.2" +pin-project-lite = "0.2" +rand = "0.10" +rug = { version = "1", optional = true, default-features = false, features = ["integer"] } +serde = { version = "1", features = ["derive"] } +sha-1 = "0.10" +sha2 = "0.10" +thiserror = "2" +time = { version = "0.3", features = ["formatting"] } +tokio = { version = "1", features = ["macros", "net", "sync", "time"] } +tracing = "0.1" +tsproto-packets = { path = "../utils/tsproto-packets", version = "0.1" } +tsproto-types = { path = "../utils/tsproto-types", version = "0.1" } +quicklz = "0.3" + +[dev-dependencies] +anyhow = "1" +criterion = "0.8" +once_cell = "1" +clap = { version = "4", features = ["derive"] } +tokio = { version = "1", features = ["rt-multi-thread", "signal"] } +tracing-subscriber = "0.3" + +[[bench]] +name = "modpow" +harness = false + +[[bench]] +name = "connect" +harness = false + +[[bench]] +name = "license" +harness = false + +[[bench]] +name = "message" +harness = false diff --git a/native/vendor/tsclientlib/tsproto/README.md b/native/vendor/tsclientlib/tsproto/README.md new file mode 100644 index 0000000..f60fe75 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/README.md @@ -0,0 +1,21 @@ +# TsProto   [![docs.rs](https://docs.rs/tsproto/badge.svg)](https://docs.rs/tsproto) +This library implements the TeamSpeak3 protocol. + +For a usable library to build clients and bots, you should take a look at +[`tsclientlib`](https://github.com/ReSpeak/tsclientlib), which provides a +convenient interface to this library. + +If you are searching for a usable client, [Qint](https://github.com/ReSpeak/Qint) +is a cross-platform TeamSpeak client, which is using this library (more +correctly, it is using `tsclientlib`). + +For more info on this project, take a look at the +[tsclientlib README](https://github.com/ReSpeak/tsclientlib). + +## License +Licensed under either of + + * [Apache License, Version 2.0](../LICENSE-APACHE) + * [MIT license](../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/tsproto/README.tpl b/native/vendor/tsclientlib/tsproto/README.tpl new file mode 100644 index 0000000..25ba62c --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/README.tpl @@ -0,0 +1,10 @@ +# TsProto   [![docs.rs](https://docs.rs/tsproto/badge.svg)](https://docs.rs/tsproto) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../LICENSE-APACHE) + * [MIT license](../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/tsproto/benches/connect.rs b/native/vendor/tsclientlib/tsproto/benches/connect.rs new file mode 100644 index 0000000..b053271 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/benches/connect.rs @@ -0,0 +1,77 @@ +use anyhow::{Error, Result}; +use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use once_cell::sync::Lazy; +use tracing::{info, warn}; +use tsproto::client::Client; +use tsproto::connection::StreamItem; +use tsproto_packets::commands::CommandParser; + +mod utils; +use crate::utils::*; + +static TRACING: Lazy<()> = Lazy::new(|| tracing_subscriber::fmt().with_test_writer().init()); + +async fn wait_channellistfinished(con: &mut Client) -> Result<()> { + con.filter_items(|con, i| { + Ok(match i { + StreamItem::S2CInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::C2SInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Command(packet) => { + let (name, _) = CommandParser::new(packet.data().packet().content()); + if name == b"channellistfinished" { Some(()) } else { None } + } + StreamItem::Error(error) => { + warn!(%error, "Got connection error"); + None + } + i => { + warn!(got = ?i, "Unexpected packet, waiting for channellistfinished"); + None + } + }) + }) + .await?; + Ok(()) +} + +fn one_connect(b: &mut Bencher) { + Lazy::force(&TRACING); + + let local_address = "127.0.0.1:0".parse().unwrap(); + let address = "127.0.0.1:9987".parse().unwrap(); + + let rt = tokio::runtime::Runtime::new().unwrap(); + + b.iter(|| { + rt.block_on(async move { + // The TS server does not accept the 3rd reconnect from the same port + // so we create a new client for every connection. + let mut con = create_client(local_address, address, 0).await?; + + connect(&mut con).await?; + info!("Connected"); + // Wait until channellistfinished + wait_channellistfinished(&mut con).await?; + + info!("Disconnecting"); + disconnect(&mut con).await?; + Ok::<_, Error>(()) + }) + .unwrap(); + }); +} + +fn bench_connect(c: &mut Criterion) { c.bench_function("connect", one_connect); } + +criterion_group! { + name = benches; + config = Criterion::default().sample_size(20); + targets = bench_connect +} +criterion_main!(benches); diff --git a/native/vendor/tsclientlib/tsproto/benches/license.rs b/native/vendor/tsclientlib/tsproto/benches/license.rs new file mode 100644 index 0000000..898f36b --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/benches/license.rs @@ -0,0 +1,58 @@ +use base64::prelude::*; +use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use tsproto::license::Licenses; +use tsproto_types::crypto::EccKeyPubEd25519; + +fn license_parse(b: &mut Bencher, license: Vec) { + b.iter(|| { + Licenses::parse_ignore_expired(license.clone()).unwrap(); + }); +} + +fn license_derive_key(b: &mut Bencher, license: Vec) { + let licenses = Licenses::parse_ignore_expired(license).unwrap(); + + b.iter(|| { + let derived_key = + licenses.derive_public_key(EccKeyPubEd25519::from_bytes(tsproto::ROOT_KEY)).unwrap(); + derived_key.compress().0 + }); +} + +const STANDARD_LICENSE: &str = "AQA1hUFJiiSs0wFXkYuPUJVcDa6XCrZTcsvkB0\ + Ffzz4CmwIITRXgCqeTYAcAAAAgQW5vbnltb3VzAACiIBip9hQaK6P3QhwOJs/BkPn0i\ + oyIDPaNgzJ6M8x0kiAJf4hxCYAxMQ=="; + +const AAL_LICENSE: &str = "AQCvbHFTQDY/terPeilrp/ECU9xCH5U3xC92lY\ + TNaY/0KQAJFueAazbsgAAAACVUZWFtU3BlYWsgU3lzdGVtcyBHbWJIAABhl9gwla/UJ\ + p2Eszst9TRVXO/PeE6a6d+CTI6Pg7OEVgAJc5CrL4Nh8gAAACRUZWFtU3BlYWsgc3lz\ + dGVtcyBHbWJIAACvTQIgpv6zmLZq3znh7ygmOSokGFkFjz4bTigrOnetrgIJdIIACdS\ + /gAYAAAAAU29zc2VuU3lzdGVtcy5iaWQAADY7+uV1CQ1niOvYSdGzsu83kPTNWijovr\ + 3B78eHGeePIAm98vQJvpu0"; + +fn standard_license_parse(b: &mut Bencher) { + license_parse(b, BASE64_STANDARD.decode(STANDARD_LICENSE).unwrap()); +} + +fn aal_license_parse(b: &mut Bencher) { + license_parse(b, BASE64_STANDARD.decode(AAL_LICENSE).unwrap()); +} + +fn standard_license_derive_key(b: &mut Bencher) { + license_derive_key(b, BASE64_STANDARD.decode(STANDARD_LICENSE).unwrap()); +} + +fn aal_license_derive_key(b: &mut Bencher) { + license_derive_key(b, BASE64_STANDARD.decode(AAL_LICENSE).unwrap()); +} + +fn bench_license(c: &mut Criterion) { + c.bench_function("parse standard license", standard_license_parse); + c.bench_function("parse aal license", aal_license_parse); + + c.bench_function("derive key standard license", standard_license_derive_key); + c.bench_function("derive key aal license", aal_license_derive_key); +} + +criterion_group!(benches, bench_license); +criterion_main!(benches); diff --git a/native/vendor/tsclientlib/tsproto/benches/message.rs b/native/vendor/tsclientlib/tsproto/benches/message.rs new file mode 100644 index 0000000..7e28716 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/benches/message.rs @@ -0,0 +1,69 @@ +use anyhow::Error; +use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use tracing::info; +use tsproto_packets::packets::*; + +mod utils; +use crate::utils::*; + +fn send_messages(b: &mut Bencher) { + create_logger(false); + + let local_address = "127.0.0.1:0".parse().unwrap(); + let address = "127.0.0.1:9987".parse().unwrap(); + + let rt = tokio::runtime::Runtime::new().unwrap(); + let mut con = rt + .block_on(async move { + let mut con = create_client(local_address, address, 0).await?; + + info!("Connecting"); + connect(&mut con).await?; + Ok::<_, Error>(con) + }) + .unwrap(); + + let mut i = 0; + + let mut last_id = None; + b.iter(|| { + let text = format!("Hello {}", i); + let mut packet = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "sendtextmessage"); + packet.write_arg("targetmode", &"3"); + packet.write_arg("msg", &text); + i += 1; + + rt.block_on(async { + con.wait_until_can_send().await.unwrap(); + last_id = Some(con.send_packet(packet.into_packet()).unwrap()); + }); + }); + + rt.block_on(async move { + if let Some(id) = last_id { + info!("Waiting for {:?}", id); + con.wait_for_ack(id).await?; + } + tokio::select! { + _ = tokio::time::sleep(tokio::time::Duration::from_millis(50)) => { + } + _ = con.wait_disconnect() => { + anyhow::bail!("Disconnected"); + } + }; + + info!("Disconnecting"); + disconnect(&mut con).await + }) + .unwrap(); +} + +fn bench_message(c: &mut Criterion) { c.bench_function("message", send_messages); } + +criterion_group! { + name = benches; + config = Criterion::default().sample_size(200); + targets = bench_message +} +criterion_main!(benches); diff --git a/native/vendor/tsclientlib/tsproto/benches/modpow.rs b/native/vendor/tsclientlib/tsproto/benches/modpow.rs new file mode 100644 index 0000000..79a0d71 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/benches/modpow.rs @@ -0,0 +1,42 @@ +use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use num_bigint::BigUint; +use num_traits::One; +#[cfg(feature = "rug")] +use rug::Integer; + +fn num_modpow(b: &mut Bencher) { + let n = "9387019355706217197639129234358945126657617361248696932841794255538327365072557602175160199263073329488914880215590036563068284078359088114486271428098753"; + let x = "2148617454765635492758175407769288127281667975788420713054995716016550287184632946544163990319181591625774561067011999700977775946073267145316355582522577"; + let level = 10_000; + let n = n.parse().unwrap(); + let x: BigUint = x.parse().unwrap(); + let mut e = BigUint::one(); + e <<= level as usize; + + b.iter(|| x.modpow(&e, &n)); +} + +#[cfg(feature = "rug")] +fn gmp_modpow(b: &mut Bencher) { + let n = "9387019355706217197639129234358945126657617361248696932841794255538327365072557602175160199263073329488914880215590036563068284078359088114486271428098753"; + let x = "2148617454765635492758175407769288127281667975788420713054995716016550287184632946544163990319181591625774561067011999700977775946073267145316355582522577"; + let level = 10_000; + let n: Integer = n.parse().unwrap(); + let x: Integer = x.parse().unwrap(); + let mut e = Integer::new(); + e.set_bit(level, true); + + b.iter(|| x.pow_mod_ref(&e, &n).unwrap()); +} + +fn bench_modpow(c: &mut Criterion) { + c.bench_function("num bigint", num_modpow); + + #[cfg(feature = "rug")] + { + c.bench_function("gmp", gmp_modpow); + } +} + +criterion_group!(benches, bench_modpow); +criterion_main!(benches); diff --git a/native/vendor/tsclientlib/tsproto/benches/utils/mod.rs b/native/vendor/tsclientlib/tsproto/benches/utils/mod.rs new file mode 100644 index 0000000..2025f39 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/benches/utils/mod.rs @@ -0,0 +1,112 @@ +use std::net::SocketAddr; + +use anyhow::Result; +use tokio::net::UdpSocket; +use tsproto::algorithms as algs; +use tsproto::client::Client; +use tsproto_packets::packets::*; +use tsproto_types::crypto::EccKeyPrivP256; + +#[allow(dead_code)] +pub fn create_logger(to_file: bool) { + if to_file { + tracing_subscriber::fmt() + .with_writer(|| std::fs::OpenOptions::new().append(true).open("bench.log").unwrap()) + .init(); + } else { + tracing_subscriber::fmt::init(); + } +} + +pub async fn create_client( + local_address: SocketAddr, remote_address: SocketAddr, verbose: u8, +) -> Result { + // Get P-256 ECDH key + let private_key = EccKeyPrivP256::import_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nm\ + DBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + + let udp_socket = UdpSocket::bind(local_address).await?; + let mut con = Client::new(remote_address, Box::new(udp_socket), private_key); + + if verbose >= 1 { + tsproto::log::add_logger(true, verbose > 1, verbose > 2, &mut con) + } + + Ok(con) +} + +/// Returns the `initserver` command. +pub async fn connect(con: &mut Client) -> Result { + con.connect().await?; + + // Send clientinit + let private_key = EccKeyPrivP256::import_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nm\ + DBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + + let private_key_as_pub = private_key.to_pub(); + let offset = algs::hash_cash(&private_key_as_pub, 8); + + // Create clientinit packet + let offset = offset.to_string(); + let mut packet = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientinit"); + + for (arg, val) in [ + ("client_nickname", "Bot"), + ("client_version", "3.?.? [Build: 5680278000]"), + ("client_platform", "Linux"), + ("client_input_hardware", "1"), + ("client_output_hardware", "1"), + ("client_default_channel", ""), + ("client_default_channel_password", ""), + ("client_server_password", ""), + ("client_meta_data", ""), + ( + "client_version_sign", + "Hjd+N58Gv3ENhoKmGYy2bNRBsNNgm5kpiaQWxOj5HN2DXttG6REjymSwJtpJ8muC2gSwRuZi0R+8Laan5ts5CQ==", + ), + ("client_nickname_phonetic", ""), + ("client_key_offset", &offset), + ("client_default_token", ""), + ("client_badges", "Overwolf=0"), + ( + "hwid", + "923f136fb1e22ae6ce95e60255529c00,\ + d13231b1bc33edfecfb9169cc7a63bcc", + ), + ] { + packet.write_arg(arg, &val); + } + + con.send_packet(packet.into_packet())?; + Ok(con + .filter_commands(|con, cmd| { + Ok(if cmd.data().packet().content().starts_with(b"initserver ") { + Some(cmd) + } else { + con.hand_back_buffer(cmd.into_buffer()); + None + }) + }) + .await?) +} + +pub async fn disconnect(con: &mut Client) -> Result<()> { + let mut packet = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientdisconnect"); + for (arg, val) in [ + // Reason: Disconnect + ("reasonid", "8"), + ("reasonmsg", "Bye"), + ] { + packet.write_arg(arg, &val); + } + + con.send_packet(packet.into_packet())?; + con.wait_disconnect().await?; + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsproto/examples/client.rs b/native/vendor/tsclientlib/tsproto/examples/client.rs new file mode 100644 index 0000000..3987cfc --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/client.rs @@ -0,0 +1,67 @@ +use std::net::SocketAddr; + +use anyhow::{bail, Result}; +use clap::Parser; +use tokio::time::{self, Duration}; +use tracing::info; +use tsproto_packets::packets::*; + +mod utils; +use crate::utils::*; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "127.0.0.1:9987")] + address: SocketAddr, + /// The listening address of the client + #[arg(long, default_value = "0.0.0.0:0")] + local_address: SocketAddr, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + // Parse command line options + let args = Args::parse(); + create_logger(); + + let mut con = create_client(args.local_address, args.address, args.verbose).await?; + + // Connect + connect(&mut con).await?; + info!("Connected"); + + // Wait some time + tokio::select! { + _ = time::sleep(Duration::from_secs(2)) => {} + _ = con.wait_disconnect() => { + bail!("Disconnected"); + } + }; + info!("Waited"); + + // Send packet + let mut cmd = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "sendtextmessage"); + cmd.write_arg("targetmode", &3); + cmd.write_arg("msg", &"Hello"); + let id = con.send_packet(cmd.into_packet())?; + con.wait_for_ack(id).await?; + + // Disconnect + disconnect(&mut con).await?; + info!("Disconnected"); + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsproto/examples/decompress.rs b/native/vendor/tsclientlib/tsproto/examples/decompress.rs new file mode 100644 index 0000000..c060928 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/decompress.rs @@ -0,0 +1,21 @@ +use std::io::{Cursor, Write}; + +use clap::Parser; +use tsproto::utils; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// Data (hex) + #[arg()] + data: String, +} + +fn main() { + // Parse command line options + let args = Args::parse(); + + let data = utils::read_hex(&args.data).unwrap(); + let data = quicklz::decompress(&mut Cursor::new(data), std::u32::MAX).unwrap(); + std::io::stdout().write_all(&data).unwrap(); +} diff --git a/native/vendor/tsclientlib/tsproto/examples/many-tsproto.rs b/native/vendor/tsclientlib/tsproto/examples/many-tsproto.rs new file mode 100644 index 0000000..8264564 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/many-tsproto.rs @@ -0,0 +1,71 @@ +use std::net::SocketAddr; + +use anyhow::Result; +use clap::Parser; +use futures::prelude::*; +use tokio::time::{self, Duration}; +use tracing::info; + +mod utils; +use crate::utils::*; + +#[derive(Parser, Clone, Debug)] +#[command(author, about)] +struct Args { + /// The address of the server to connect to + #[arg(short, long, default_value = "127.0.0.1:9987")] + address: SocketAddr, + /// The listening address of the client + #[arg(long, default_value = "0.0.0.0:0")] + local_address: SocketAddr, + /// Print the content of all packets + /// + /// 0. Print nothing + /// 1. Print command string + /// 2. Print packets + /// 3. Print udp packets + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, + /// How many connections + #[arg()] + count: usize, +} + +#[tokio::main] +async fn main() -> Result<()> { real_main().await } + +async fn real_main() -> Result<()> { + // Parse command line options + let args = Args::parse(); + create_logger(); + + stream::iter(0..args.count) + .for_each_concurrent(None, |_| { + let args = args.clone(); + tokio::spawn(async move { + let mut con = + create_client(args.local_address, args.address, args.verbose).await.unwrap(); + + // Connect + connect(&mut con).await.unwrap(); + info!("Connected"); + + // Wait some time + tokio::select! { + _ = time::sleep(Duration::from_secs(2)) => {} + _ = con.wait_disconnect() => { + panic!("Disconnected"); + } + }; + info!("Waited"); + + // Disconnect + let _ = disconnect(&mut con).await; + info!("Disconnected"); + }) + .map(|_| ()) + }) + .await; + + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsproto/examples/parse-license.rs b/native/vendor/tsclientlib/tsproto/examples/parse-license.rs new file mode 100644 index 0000000..f868893 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/parse-license.rs @@ -0,0 +1,19 @@ +use base64::prelude::*; +use clap::Parser; +use tsproto::license::*; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// The license data (base64) + #[arg()] + license: String, +} + +fn main() { + // Parse command line options + let args = Args::parse(); + + let l = Licenses::parse(BASE64_STANDARD.decode(&args.license).unwrap()).unwrap(); + println!("{:#?}", l); +} diff --git a/native/vendor/tsclientlib/tsproto/examples/test-decrypt.rs b/native/vendor/tsclientlib/tsproto/examples/test-decrypt.rs new file mode 100644 index 0000000..9b717f7 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/test-decrypt.rs @@ -0,0 +1,52 @@ +use std::io::Write; + +use clap::Parser; +use tsproto::algorithms as algs; +use tsproto::utils; +use tsproto_packets::packets::*; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// Print backtrace + #[arg(short, long = "debug")] + debug: bool, + /// Server to client + #[arg(short, long = "client")] + c2s: bool, + /// Data (hex) + #[arg()] + data: String, +} + +fn main() { + // Parse command line options + let args = Args::parse(); + + let dir = if args.c2s { Direction::C2S } else { Direction::S2C }; + + let data = utils::read_hex(&args.data).unwrap(); + let packet = match InPacket::try_new(dir, &data) { + Ok(p) => p, + Err(e) => { + if args.debug { + println!("Failed to decode: {:?}", e); + } else { + println!("Failed to decode: {}", e); + } + return; + } + }; + let decrypted = match algs::decrypt_fake(&packet) { + Ok(d) => d, + Err(e) => { + if args.debug { + println!("Failed to decrypt: {:?}", e); + } else { + println!("Failed to decrypt: {}", e); + } + return; + } + }; + std::io::stdout().write_all(&decrypted).unwrap(); +} diff --git a/native/vendor/tsclientlib/tsproto/examples/test-ed25519.rs b/native/vendor/tsclientlib/tsproto/examples/test-ed25519.rs new file mode 100644 index 0000000..655e0c9 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/test-ed25519.rs @@ -0,0 +1,39 @@ +use base64::prelude::*; +use clap::Parser; +use curve25519_dalek_ng::edwards::CompressedEdwardsY; +use curve25519_dalek_ng::scalar::Scalar; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// Public key + #[arg(short, long = "pub")] + pub_key: String, + /// Private key + #[arg(short, long = "priv")] + priv_key: String, +} + +fn main() { + // Parse command line options + let args = Args::parse(); + + let pub_key = BASE64_STANDARD.decode(&args.pub_key).unwrap(); + let priv_key = BASE64_STANDARD.decode(&args.priv_key).unwrap(); + let mut pubk = [0; 32]; + pubk.copy_from_slice(&pub_key); + let mut privk = [0; 32]; + privk.copy_from_slice(&priv_key); + /*privk[0] &= 248; + privk[31] &= 63; + privk[31] |= 64;*/ + + let priv_scal = Scalar::from_bytes_mod_order(privk); + //let priv_scal = Scalar::from_bytes_mod_order(privk); + let pub_point_compr = CompressedEdwardsY(pubk); + let pub_point = -pub_point_compr.decompress().unwrap(); + //let pub_point = curve25519_dalek::constants::ED25519_BASEPOINT_POINT; + + let res = (pub_point * priv_scal).compress(); + println!("Result: {}", BASE64_STANDARD.encode(&res.0)); +} diff --git a/native/vendor/tsclientlib/tsproto/examples/test-proofs.rs b/native/vendor/tsclientlib/tsproto/examples/test-proofs.rs new file mode 100644 index 0000000..30df5ff --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/test-proofs.rs @@ -0,0 +1,35 @@ +use base64::prelude::*; +use clap::Parser; +use tsproto_types::crypto::EccKeyPubP256; + +#[derive(Parser, Debug)] +#[command(author, about)] +struct Args { + /// Public key + #[arg(short, long)] + key: String, + /// Data (base64) + #[arg(short, long)] + data: String, + /// Signature (base64) + #[arg(short, long)] + signature: String, +} + +fn main() { + // Parse command line options + let args = Args::parse(); + + // l → proof + // ek || beta → proof + + let data = BASE64_STANDARD.decode(&args.data).unwrap(); + let signature = BASE64_STANDARD.decode(&args.signature).unwrap(); + let key = EccKeyPubP256::from_ts(&args.key).unwrap(); + /*let keyts = tomcrypt::P256EccKey::import(&BASE64_STANDARD.decode(&args.key).unwrap()) + .unwrap(); + let res = keyts.verify_hash(&data, &signature).unwrap(); + println!("Res: {:?}", res);*/ + + key.verify(&data, &signature).unwrap(); +} diff --git a/native/vendor/tsclientlib/tsproto/examples/utils/mod.rs b/native/vendor/tsclientlib/tsproto/examples/utils/mod.rs new file mode 100644 index 0000000..1af249d --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/examples/utils/mod.rs @@ -0,0 +1,101 @@ +use std::net::SocketAddr; + +use anyhow::Result; +use tokio::net::UdpSocket; +use tracing::{info, info_span}; +use tsproto::algorithms as algs; +use tsproto::client::Client; +use tsproto_packets::packets::*; +use tsproto_types::crypto::EccKeyPrivP256; + +pub fn create_logger() { tracing_subscriber::fmt::init(); } + +pub async fn create_client( + local_address: SocketAddr, remote_address: SocketAddr, verbose: u8, +) -> Result { + // Get P-256 ECDH key + let private_key = EccKeyPrivP256::import_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nm\ + DBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + + let udp_socket = UdpSocket::bind(local_address).await?; + let mut con = Client::new(remote_address, Box::new(udp_socket), private_key); + + if verbose >= 1 { + tsproto::log::add_logger_with_verbosity(verbose, &mut con) + } + + Ok(con) +} + +/// Returns the `initserver` command. +pub async fn connect(con: &mut Client) -> Result { + con.connect().await?; + + // Send clientinit + let private_key = EccKeyPrivP256::import_str( + "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+\ + k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nm\ + DBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap(); + + // Compute hash cash + let offset; + { + let _span = info_span!("Compute public key hash cash level").entered(); + let private_key_as_pub = private_key.to_pub(); + offset = algs::hash_cash(&private_key_as_pub, 8); + let omega = private_key_as_pub.to_ts(); + info!( + level = algs::get_hash_cash_level(&omega, offset), + offset, "Computed hash cash level" + ); + } + + // Create clientinit packet + let offset = offset.to_string(); + let mut cmd = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientinit"); + cmd.write_arg("client_nickname", &"Bot"); + cmd.write_arg("client_version", &"3.?.? [Build: 5680278000]"); + cmd.write_arg("client_platform", &"Linux"); + + cmd.write_arg("client_input_hardware", &"1"); + cmd.write_arg("client_output_hardware", &"1"); + cmd.write_arg("client_default_channel", &""); + cmd.write_arg("client_default_channel_password", &""); + cmd.write_arg("client_server_password", &""); + cmd.write_arg("client_meta_data", &""); + cmd.write_arg( + "client_version_sign", + &"Hjd+N58Gv3ENhoKmGYy2bNRBsNNgm5kpiaQWxOj5HN2DXttG6REjymSwJtpJ8muC2gSwRuZi0R+8Laan5ts5CQ==", + ); + cmd.write_arg("client_nickname_phonetic", &""); + cmd.write_arg("client_key_offset", &offset); + cmd.write_arg("client_default_token", &""); + cmd.write_arg("client_badges", &"Overwolf=0"); + cmd.write_arg("hwid", &"923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc"); + + con.send_packet(cmd.into_packet())?; + Ok(con + .filter_commands(|con, cmd| { + Ok(if cmd.data().packet().content().starts_with(b"initserver ") { + Some(cmd) + } else { + con.hand_back_buffer(cmd.into_buffer()); + None + }) + }) + .await?) +} + +pub async fn disconnect(con: &mut Client) -> Result<()> { + let mut cmd = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientdisconnect"); + cmd.write_arg("reasonid", &8); + cmd.write_arg("reasonmsg", &"Bye"); + + con.send_packet(cmd.into_packet())?; + con.wait_disconnect().await?; + Ok(()) +} diff --git a/native/vendor/tsclientlib/tsproto/src/algorithms.rs b/native/vendor/tsclientlib/tsproto/src/algorithms.rs new file mode 100644 index 0000000..f57b934 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/algorithms.rs @@ -0,0 +1,452 @@ +//! Handle packet splitting and cryptography +use curve25519_dalek_ng::edwards::EdwardsPoint; +use eax::aead::consts::{U16, U8}; +use eax::{AeadInPlace, Eax, KeyInit}; +use generic_array::GenericArray; +use num_bigint::BigUint; +use num_traits::ToPrimitive; +use omnom::WriteExt; +use quicklz::CompressionLevel; +use sha1::Sha1; +use sha2::{Digest, Sha256, Sha512}; +use tsproto_types::crypto::{EccKeyPrivEd25519, EccKeyPubP256}; + +use crate::connection::CachedKey; +use crate::{Error, Result}; +use tsproto_packets::packets::*; + +pub fn must_encrypt(t: PacketType) -> bool { + match t { + PacketType::Command | PacketType::CommandLow => true, + PacketType::Voice + | PacketType::Ack + | PacketType::AckLow + | PacketType::VoiceWhisper + | PacketType::Ping + | PacketType::Pong + | PacketType::Init => false, + } +} + +pub fn should_encrypt(t: PacketType, voice_encryption: bool) -> bool { + must_encrypt(t) + || t == PacketType::Ack + || t == PacketType::AckLow + || (voice_encryption && t.is_voice()) +} + +/// Compresses and splits the packet data of a `Command` or `CommandLow` packet. +/// +/// Returns the splitted packet data and their headers. +/// The headers have their type and the compressed and fragmented flag set +/// to the right value. +/// +/// Returns an error if the packet is too large but cannot be splitted. +/// Only `Command` and `CommandLow` packets can be compressed and splitted. +pub fn compress_and_split(is_client: bool, packet: OutPacket) -> Vec { + // Everything except whisper packets has to be less than 500 bytes + let header_size = + if is_client { tsproto_packets::C2S_HEADER_LEN } else { tsproto_packets::S2C_HEADER_LEN }; + let data = packet.content(); + // The maximum packet size (including header) is 500 bytes. + let max_size = 500 - header_size; + // Split the data if it is necessary. + let compressed; + let datas = if data.len() > max_size { + // Compress with QuickLZ + let cdata = ::quicklz::compress(data, CompressionLevel::Lvl1); + // Use only if it is efficient + let mut data = if cdata.len() > data.len() { + compressed = false; + data + } else { + compressed = true; + &cdata + }; + + // Ignore size limit for whisper packets + if data.len() <= max_size || packet.header().packet_type() == PacketType::VoiceWhisper { + let mut v = vec![0; header_size + data.len()]; + v[header_size..].copy_from_slice(data); + vec![v] + } else { + // Split + let count = (data.len() + max_size - 1) / max_size; + let mut splitted = Vec::with_capacity(count); + while data.len() > max_size { + let (first, last) = data.split_at(max_size); + let mut v = vec![0; header_size + max_size]; + v[header_size..].copy_from_slice(first); + splitted.push(v); + data = last; + } + // Rest + let mut v = vec![0; header_size + data.len()]; + v[header_size..].copy_from_slice(data); + splitted.push(v); + splitted + } + } else { + return vec![packet]; + }; + + let len = datas.len(); + let fragmented = len > 1; + let orig_header = packet.header_bytes(); + let dir = packet.direction(); + let mut packets = Vec::with_capacity(datas.len()); + for (i, mut d) in datas.into_iter().enumerate() { + d[..header_size].copy_from_slice(orig_header); + let mut packet = OutPacket::new_from_data(dir, d); + // Only set flags on first fragment + if i == 0 && compressed { + packet.flags(packet.header().flags() | Flags::COMPRESSED); + } + + // Set fragmented flag on first and last part + if fragmented && (i == 0 || i == len - 1) { + packet.flags(packet.header().flags() | Flags::FRAGMENTED); + } + packets.push(packet); + } + packets +} + +fn create_key_nonce( + p_type: PacketType, c_id: Option, p_id: u16, generation_id: u32, iv: &[u8; 64], + cache: &mut [[CachedKey; 2]; 8], +) -> (GenericArray, GenericArray) { + // Check if this generation is cached + let cache = &mut cache[p_type.to_usize().unwrap()][if c_id.is_some() { 1 } else { 0 }]; + if cache.generation_id != generation_id { + // Update the cache + let mut temp = [0; 70]; + if c_id.is_some() { + temp[0] = 0x31; + } else { + temp[0] = 0x30; + } + temp[1] = p_type.to_u8().unwrap(); + (&mut temp[2..6]).write_be(generation_id).unwrap(); + temp[6..].copy_from_slice(iv); + + let keynonce = Sha256::digest(&temp[..]); + let keynonce = keynonce.as_slice(); + cache.generation_id = generation_id; + cache.key.copy_from_slice(&keynonce[..16]); + cache.nonce.copy_from_slice(&keynonce[16..]); + } + + // Use the cached version + let mut key = cache.key; + let nonce = cache.nonce; + key[0] ^= (p_id >> 8) as u8; + key[1] ^= (p_id & 0xff) as u8; + (key, nonce) +} + +pub fn encrypt_key_nonce( + packet: &mut OutPacket, key: &GenericArray, nonce: &GenericArray, +) -> Result<()> { + let meta = packet.header().get_meta().to_vec(); + let cipher = Eax::::new(key); + let mac = cipher + .encrypt_in_place_detached(nonce, &meta, packet.content_mut()) + .map_err(|_| Error::MaxLengthExceeded("encryption data"))?; + packet.mac().copy_from_slice(mac.as_slice()); + Ok(()) +} + +pub fn encrypt_fake(packet: &mut OutPacket) -> Result<()> { + encrypt_key_nonce(packet, &crate::FAKE_KEY.into(), &crate::FAKE_NONCE.into()) +} + +pub fn encrypt( + packet: &mut OutPacket, generation_id: u32, iv: &[u8; 64], cache: &mut [[CachedKey; 2]; 8], +) -> Result<()> { + let header = packet.header(); + let (key, nonce) = create_key_nonce( + header.packet_type(), + header.client_id(), + header.packet_id(), + generation_id, + iv, + cache, + ); + encrypt_key_nonce(packet, &key, &nonce) +} + +pub fn decrypt_key_nonce( + packet: &InPacket, key: &GenericArray, nonce: &GenericArray, +) -> Result> { + let header = packet.header(); + let meta = header.get_meta(); + // TODO decrypt in-place in packet + let mut content = packet.content().to_vec(); + let cipher = Eax::::new(key); + cipher + .decrypt_in_place_detached(nonce, meta, &mut content, header.mac().into()) + .map(|()| content) + .map_err(|_| Error::WrongMac { + p_type: header.packet_type(), + generation_id: 0, + packet_id: header.packet_id(), + }) +} + +pub fn decrypt_fake(packet: &InPacket) -> Result> { + decrypt_key_nonce(packet, &crate::FAKE_KEY.into(), &crate::FAKE_NONCE.into()) +} + +pub fn decrypt( + packet: &InPacket, generation_id: u32, iv: &[u8; 64], cache: &mut [[CachedKey; 2]; 8], +) -> Result> { + let header = packet.header(); + let (key, nonce) = create_key_nonce( + header.packet_type(), + header.client_id(), + header.packet_id(), + generation_id, + iv, + cache, + ); + decrypt_key_nonce(packet, &key, &nonce).map_err(|e| { + if let Error::WrongMac { p_type, packet_id, .. } = e { + Error::WrongMac { p_type, generation_id, packet_id } + } else { + e + } + }) +} + +/// Compute shared iv and shared mac. +pub fn compute_iv_mac( + alpha: &[u8; 10], beta: &[u8; 54], our_key: &EccKeyPrivEd25519, other_key: &EdwardsPoint, +) -> ([u8; 64], [u8; 8]) { + let shared_secret = our_key.create_shared_secret(other_key); + let mut shared_iv = [0; 64]; + shared_iv.copy_from_slice(Sha512::digest(shared_secret).as_slice()); + for i in 0..10 { + shared_iv[i] ^= alpha[i]; + } + for i in 0..54 { + shared_iv[i + 10] ^= beta[i]; + } + let mut shared_mac = [0; 8]; + shared_mac.copy_from_slice(&Sha1::digest(shared_iv).as_slice()[..8]); + (shared_iv, shared_mac) +} + +pub fn hash_cash(key: &EccKeyPubP256, level: u8) -> u64 { + let omega = key.to_ts(); + let mut offset = 0; + while offset < u64::MAX && get_hash_cash_level(&omega, offset) < level { + offset += 1; + } + offset +} + +#[inline] +pub fn get_hash_cash_level(omega: &str, offset: u64) -> u8 { + let data = Sha1::digest(format!("{}{}", omega, offset).as_bytes()); + let mut res = 0; + for &d in data.as_slice() { + if d == 0 { + res += 8; + } else { + res += d.trailing_zeros() as u8; + break; + } + } + res +} + +pub fn biguint_to_array(i: &BigUint) -> [u8; 64] { + let mut v = i.to_bytes_le(); + + // Extend with zeroes until 64 bytes + let len = v.len(); + v.append(&mut vec![0; 64 - len]); + v.reverse(); + + let mut a = [0; 64]; + a.copy_from_slice(&v); + a +} + +pub fn array_to_biguint(i: &[u8; 64]) -> BigUint { BigUint::from_bytes_be(i) } + +#[cfg(test)] +mod tests { + use base64::prelude::*; + + use super::*; + use crate::license::Licenses; + use crate::packets::PacketType; + use crate::utils; + use tsproto_types::crypto::EccKeyPubEd25519; + + #[test] + fn test_fake_crypt() { + let data = (0..100).into_iter().collect::>(); + let mut packet = OutPacket::new_with_dir(Direction::C2S, Flags::empty(), PacketType::Ack); + packet.data_mut().extend_from_slice(&data); + encrypt_fake(&mut packet).unwrap(); + let packet = + InPacket::try_new(Direction::C2S, packet.data_mut().as_slice().into()).unwrap(); + let dec_data = decrypt_fake(&packet).unwrap(); + assert_eq!(&data, &dec_data); + } + + #[test] + fn test_fake_encrypt() { + let mut packet = OutAck::new(Direction::C2S, PacketType::Command, 0); + encrypt_fake(&mut packet).unwrap(); + + let real_res: &[u8] = + &[0xa4, 0x7b, 0x47, 0x94, 0xdb, 0xa9, 0x6a, 0xc5, 0, 0, 0, 0, 0x6, 0xfe, 0x18]; + assert_eq!(real_res, packet.data_mut().as_slice()); + } + + #[test] + fn shared_iv31() { + let licenses = Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQA1hUFJiiSs\ + 0wFXkYuPUJVcDa6XCrZTcsvkB0Ffzz4CmwIITRXgCqeTYAcAAAAgQW5vbnltb3VzAAC\ + 4R+5mos+UQ/KCbkpQLMI5WRp4wkQu8e5PZY4zU+/FlyAJwaE8CcJJ/A==") + .unwrap()).unwrap(); + let derived_key = + licenses.derive_public_key(EccKeyPubEd25519::from_bytes(crate::ROOT_KEY)).unwrap(); + + let client_ek = [ + 0xb0, 0x4e, 0xa1, 0xd9, 0x5c, 0x72, 0x64, 0xdf, 0x0d, 0xe8, 0xb3, 0x6b, 0xaa, 0x7c, + 0xa1, 0x5f, 0x75, 0x71, 0xf5, 0x1f, 0xa0, 0x54, 0xb5, 0x51, 0x27, 0x08, 0x8e, 0xdd, + 0x96, 0x3d, 0x6e, 0x79, + ]; + + let priv_key = EccKeyPrivEd25519::from_bytes(client_ek); + + let alpha_b64 = BASE64_STANDARD.decode("Jkxq1wIvvhzaCA==").unwrap(); + let mut alpha = [0; 10]; + alpha.copy_from_slice(&alpha_b64); + let beta_b64 = BASE64_STANDARD + .decode("wU5T/MM6toW6Wge9th7VlTlzVZ9JDWypw2P9migfc25pjGP2Tj7Hm6rJpmKeHRr08Ch7BEAR") + .unwrap(); + let mut beta = [0; 54]; + beta.copy_from_slice(&beta_b64); + + let expected_shared_shared_iv: [u8; 64] = [ + 0x58, 0x78, 0xae, 0x08, 0x08, 0x72, 0x05, 0xb0, 0x13, 0x27, 0x10, 0xe9, 0x81, 0xb4, + 0xaf, 0x14, 0x14, 0x71, 0xad, 0xcd, 0x82, 0x98, 0xf3, 0xd1, 0x1d, 0x07, 0x20, 0x72, + 0x7e, 0xb2, 0x1b, 0x89, 0x47, 0x82, 0x1e, 0xfb, 0x02, 0x53, 0x5a, 0x8a, 0x52, 0x4d, + 0x9a, 0x7a, 0x09, 0x2c, 0x1b, 0xe7, 0x1f, 0xd1, 0x9d, 0x2a, 0x9d, 0x4f, 0xbd, 0xe3, + 0x22, 0x09, 0xe4, 0x86, 0x7d, 0x63, 0x49, 0x07, + ]; + + let expected_xored_shared_shared_iv: [u8; 64] = [ + 0x7e, 0x34, 0xc4, 0xdf, 0x0a, 0x5d, 0xbb, 0xac, 0xc9, 0x2f, 0xd1, 0xa7, 0xd2, 0x48, + 0x6c, 0x2e, 0xa2, 0xf4, 0x17, 0x97, 0x85, 0x25, 0x45, 0xcf, 0xc8, 0x92, 0x19, 0x01, + 0x2b, 0x2d, 0x52, 0x84, 0x2b, 0x2b, 0xdd, 0x98, 0xff, 0xc9, 0x72, 0x95, 0x21, 0x23, + 0xf3, 0xf6, 0x6a, 0xda, 0x55, 0xd9, 0xd8, 0x4a, 0x37, 0xe3, 0x3b, 0x2d, 0x23, 0xfe, + 0x38, 0xfd, 0x14, 0xae, 0x06, 0x67, 0x09, 0x16, + ]; + + let (mut shared_iv, _shared_mac) = compute_iv_mac(&alpha, &beta, &priv_key, &derived_key); + + assert_eq!(&shared_iv as &[u8], &expected_xored_shared_shared_iv as &[u8]); + + for i in 0..10 { + shared_iv[i] ^= alpha[i]; + } + for i in 0..54 { + shared_iv[i + 10] ^= beta[i]; + } + + assert_eq!(&shared_iv as &[u8], &expected_shared_shared_iv as &[u8]); + + let mut temp = [0; 70]; + temp[0] = 0x31; + temp[1] = 0x2 & 0xf; + temp[6..].copy_from_slice(&expected_xored_shared_shared_iv); + + let temporary: [u8; 70] = [ + 0x31, 0x02, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x34, 0xc4, 0xdf, 0x0a, 0x5d, 0xbb, 0xac, + 0xc9, 0x2f, 0xd1, 0xa7, 0xd2, 0x48, 0x6c, 0x2e, 0xa2, 0xf4, 0x17, 0x97, 0x85, 0x25, + 0x45, 0xcf, 0xc8, 0x92, 0x19, 0x01, 0x2b, 0x2d, 0x52, 0x84, 0x2b, 0x2b, 0xdd, 0x98, + 0xff, 0xc9, 0x72, 0x95, 0x21, 0x23, 0xf3, 0xf6, 0x6a, 0xda, 0x55, 0xd9, 0xd8, 0x4a, + 0x37, 0xe3, 0x3b, 0x2d, 0x23, 0xfe, 0x38, 0xfd, 0x14, 0xae, 0x06, 0x67, 0x09, 0x16, + ]; + assert!(&temp as &[u8] == &temporary as &[u8]); + + let keynonce = Sha256::digest(&temp); + + let expected_keynonce: [u8; 32] = [ + 0xf3, 0x70, 0xd3, 0x43, 0xe7, 0x78, 0x15, 0x70, 0x7a, 0xff, 0x60, 0x48, 0xfb, 0xd9, + 0xac, 0x6b, 0xb6, 0x33, 0x35, 0x79, 0x31, 0x9b, 0x88, 0x0e, 0x2d, 0x25, 0xef, 0x9c, + 0xe9, 0x9e, 0x77, 0x5c, + ]; + + assert!(keynonce.as_slice() == &expected_keynonce as &[u8]); + } + + #[test] + fn test_new_decrypt() { + let shared_iv = utils::read_hex( + "C2 45 6F CB FC 22 08 AE 44 2B 7D E7 3A 67 1B DA 93 09 B2 00 F2 CD 10 49 08 CD 3A B0 \ + 7B DD 58 AD", + ) + .unwrap(); + let mut shared_iv = Sha512::digest(&shared_iv).as_slice().to_vec(); + assert_eq!( + utils::read_hex( + "4D 3F DA B7 D8 B0 2C 82 70 6A 39 3E 97 17 61 09 FA 03 AB 30 5C BB 78 7A 9A 82 D5 \ + 39 9A 60 FD A9 F6 7A D9 04 52 F2 AE 00 3E 35 E8 19 10 89 40 43 80 58 27 1F 0A E0 \ + E0 3D E0 9C F0 A3 4D 15 6B F0" + ) + .unwrap() + .as_slice(), + shared_iv.as_slice() + ); + + let alpha = [0; 10]; + let beta = BASE64_STANDARD + .decode("I4onb0zMyAD6bd24QANDls40eOES7qmjonBFtt5wRWzAfIIQWTSxjEas6TGTZIJ8QSJNX+Pl") + .unwrap(); + + for i in 0..10 { + shared_iv[i] ^= alpha[i]; + } + for i in 0..54 { + shared_iv[i + 10] ^= beta[i]; + } + + let mut temp = [0; 70]; + temp[0] = 0x31; + temp[1] = 0x2 & 0xf; + temp[6..].copy_from_slice(&shared_iv); + + let keynonce = Sha256::digest(&temp); + let keynonce = keynonce.as_slice(); + + let all = utils::read_hex("2b982443ab38be6b00020000329abf64d4572e1349897b5e1e96fbc4a763a4c4ce1f64f0c1e3febd0a5f04a82ab1f2bc2344bb374fd16181beb8233b5b06944280470e9b6893290a1da0776ffcd89f3beec2ce23b9694930c09efaaea0d88a6895a08ede4d5cbfea61291fc553ac651f1e2bc1d2bd277a8bd9ab5386415579a9e56fac46d8b6b119f454bebd99179cd317dec60af205341d11f274d02bbacdd7e9773f72a426358ca1d39016dd95bde2409cd81bf99b340887e997ea982370c6790cf4d23150460820224766838ea4ec4d71dd102ede701ea0001f392623aa410dd9ab0e45874da82e29e6e370515ec30a37dd73f5a364c233ff014384beab5f1708c9f48dfba33a520f8fcdcef055789c54693c3fe72c5bfaca7cb4ca1fed77b8624660b8abc882f4b95b1284cb6dc55019c6082dd6dd146fa50383662d7298bef04ababaf1af80e15cd4c1f81326f085788e2918e00324147dce39b23db71326abc3de4b94df10f1531e9cce202bba71fa3ebeefd77b21fa3260a62e92eeee2183421d384a8c48777e2f9efbc58d4f442c5f0529c7c0e27e81b2b6b1b05eb8fa19256886248d553582dfd24c7cfab3c3f7317a5cebc6504b53fa0e86fc8c1100fc1d506fcf96caa76a7c0b6a27e577f2efdecd4070e847a559bf37d75bfdbe9e814c702426ce696d8645bc300b5f28f9e7f1ce").unwrap(); + + let packet = InPacket::try_new(Direction::C2S, &all).unwrap(); + println!("Packet: {:?}", packet); + let mut key = [0; 16]; + let mut nonce = [0; 16]; + key.copy_from_slice(&keynonce[..16]); + nonce.copy_from_slice(&keynonce[16..]); + + let expected_key = + utils::read_hex("D2 42 75 71 9C EE 83 35 EF 8A CE E0 B7 28 40 B8").unwrap(); + let expected_nonce = + utils::read_hex("9C D9 30 B7 58 FE 50 23 64 66 11 C5 36 0E A2 5F").unwrap(); + + assert_eq!(&expected_nonce, &nonce); + assert_eq!(&expected_key, &key); + + key[1] ^= 2; // packet id + let dec = decrypt_key_nonce(&packet, &key.into(), &nonce.into()).unwrap(); + + println!("Decrypted: {:?}", String::from_utf8_lossy(&dec)); + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/client.rs b/native/vendor/tsclientlib/tsproto/src/client.rs new file mode 100644 index 0000000..bd67ca3 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/client.rs @@ -0,0 +1,1213 @@ +use std::net::SocketAddr; +use std::ops::{Deref, DerefMut}; +use std::pin::Pin; +use std::str; +use std::task::{Context, Poll}; + +use base64::prelude::*; +use futures::prelude::*; +#[cfg(not(feature = "rug"))] +use num_bigint::BigUint; +#[cfg(not(feature = "rug"))] +use num_traits::One; +use rand::RngExt; +#[cfg(feature = "rug")] +use rug::Integer; +#[cfg(feature = "rug")] +use rug::integer::Order; +use thiserror::Error; +use time::OffsetDateTime; +use tracing::{info, warn}; +use tsproto_packets::commands::{CommandItem, CommandParser}; +use tsproto_packets::packets::*; +use tsproto_types::crypto::{EccKeyPrivEd25519, EccKeyPrivP256, EccKeyPubEd25519, EccKeyPubP256}; + +use crate::algorithms as algs; +use crate::connection::{ConnectedParams, Connection, Socket, StreamItem}; +use crate::license::Licenses; +use crate::resend::{PacketId, ResenderState}; + +type Result = std::result::Result; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + #[error("Connection ended unexpectedly")] + ConnectionEnd, + #[error("Got initserver, but we have not yet a full connection")] + EarlyInitserver, + #[error("Cannot parse base64 argument {0}: {1}")] + InvalidBase64Arg(&'static str, #[source] base64::DecodeError), + #[error("Invalid packet: Incorrect beta length in initivexpand2 {0} != 54")] + InvalidBetaLength(usize), + #[error("Got invalid client id {0:?}: {1}")] + InvalidClientId(Vec, #[source] tsproto_packets::Error), + #[error("Invalid packet: initivexpand2 command has wrong arguments")] + InvalidInitivexpand2, + #[error("Invalid packet: Cannot parse omega as key: {0}")] + InvalidOmegaKey(#[source] tsproto_types::crypto::Error), + #[error("Invalid packet: Cannot parse omega as string: {0}")] + InvalidOmegaString(#[source] tsproto_packets::Error), + #[error("Invalid packet: {0}")] + InvalidPacket(&'static str), + #[error("Invalid packet: Got root for initivexpand2, but length {0} != 32")] + InvalidRootKeyLength(usize), + #[error("The server license signature is invalid: {0}")] + InvalidSignature(#[source] tsproto_types::crypto::Error), + #[error("Invalid packet: Got multiple {0} in one packet")] + MultipleCommands(&'static str), + #[error("Got initserver without accepted client id")] + NoClientId, + #[error("Got no ot=1, the server is probably outdated")] + OutdatedServer, + #[error("Failed to parse license: {0}")] + ParseLicense(#[source] crate::license::Error), + #[error("Failed to solve RSA puzzle")] + RsaPuzzle, + #[error("Requested RSA puzzle level {0} is too high")] + RsaPuzzleTooHighLevel(u32), + #[error(transparent)] + TsProto(#[from] crate::Error), + #[error("Expected {0} but got {1}")] + UnexpectedPacket(&'static str, String), +} + +pub struct Client { + con: Connection, + pub private_key: EccKeyPrivP256, +} + +impl Client { + pub fn new( + address: SocketAddr, udp_socket: Box, private_key: EccKeyPrivP256, + ) -> Self { + Self { con: Connection::new(true, address, udp_socket), private_key } + } + + async fn get_init(&mut self, init_steps: &[u8]) -> Result { + self.filter_items(|con, i| { + Ok(match i { + StreamItem::S2CInit(packet) => { + if init_steps.contains(&packet.data().data().get_step()) { + Some(packet) + } else { + // Resent packet + warn!(parent: &con.span, "Got wrong init packet"); + con.hand_back_buffer(packet.into_buffer()); + None + } + } + StreamItem::C2SInit(packet) => { + warn!(parent: &con.span, "Got init packet from the wrong direction"); + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Error(error) => { + warn!(parent: &con.span, %error, "Got connection error"); + None + } + StreamItem::AckPacket(_) => None, + StreamItem::NetworkStatsUpdated => None, + i => { + warn!(parent: &con.span, got = ?i, "Unexpected packet, wanted S2CInit"); + None + } + }) + }) + .await + } + + async fn get_command(&mut self) -> Result { + self.filter_items(|con, i| { + Ok(match i { + StreamItem::S2CInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::C2SInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Command(packet) => Some(packet), + StreamItem::Error(error) => { + warn!(parent: &con.span, %error, "Got connection error"); + None + } + StreamItem::AckPacket(_) => None, + StreamItem::NetworkStatsUpdated => None, + i => { + warn!(parent: &con.span, got = ?i, "Unexpected packet, wanted Command"); + None + } + }) + }) + .await + } + + /// Drop all packets until the given packet is acknowledged. + pub async fn wait_for_ack(&mut self, id: PacketId) -> Result<()> { + self.filter_items(|con, i| { + Ok(match i { + StreamItem::S2CInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::C2SInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Command(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Error(error) => { + warn!(parent: &con.span, %error, "Got connection error"); + None + } + StreamItem::AckPacket(ack) => { + if id <= ack { + Some(()) + } else { + None + } + } + StreamItem::NetworkStatsUpdated => None, + i => { + warn!(parent: &con.span, got = ?i, "Unexpected packet, wanted Ack"); + None + } + }) + }) + .await + } + + /// Drop all packets until the send queue is not full anymore. + pub async fn wait_until_can_send(&mut self) -> Result<()> { + if !self.is_send_queue_full() { + return Ok(()); + } + self.filter_items(|con, i| { + Ok(match i { + StreamItem::S2CInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::C2SInit(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Command(packet) => { + con.hand_back_buffer(packet.into_buffer()); + None + } + StreamItem::Error(error) => { + warn!(parent: &con.span, %error, "Got connection error"); + None + } + StreamItem::AckPacket(_) => { + if !con.is_send_queue_full() { + Some(()) + } else { + None + } + } + StreamItem::NetworkStatsUpdated => None, + i => { + warn!(parent: &con.span, got = ?i, "Unexpected packet, wanted Ack"); + None + } + }) + }) + .await + } + + /// Send a packet. The `send_packet` function will resolve to a future when + /// the packet has been sent. + /// + /// If the packet has an acknowledgement (ack or pong), the returned future + /// will resolve when it is received. Otherwise it will resolve instantly. + pub fn send_packet(&mut self, packet: OutPacket) -> Result { + let _span = self.con.span.clone().entered(); + if packet.header().packet_type() == PacketType::Command + && packet.content().starts_with(b"clientdisconnect") + { + let this = &mut **self; + this.resender.set_state(ResenderState::Disconnecting); + } + Ok(self.con.send_packet(packet)?) + } + + pub async fn connect(&mut self) -> Result<()> { + // Send the first init packet + // Get the current timestamp + let now = OffsetDateTime::now_utc(); + let timestamp = now.unix_timestamp() as u32; + // TeamSpeak offsets the timestamp for the version by some years + let version = timestamp - 1356998400; + + // Random bytes + let random0 = rand::rng().random::<[u8; 4]>(); + + let alpha; + loop { + // Wait for Init1 + { + self.send_packet(OutC2SInit0::new(version, timestamp, random0))?; + let init1 = self.get_init(&[1]).await?; + match init1.data().data() { + S2CInitData::Init1 { random1, random0_r } => { + // Check the response + // Most of the time, random0_r is the reversed random0, but + // sometimes it isn't so do not check it. + // random0.as_ref().iter().rev().eq(random0_r.as_ref()) + // The packet is correct. + + // Send next init packet + self.send_packet(OutC2SInit2::new(version, random1, **random0_r))?; + } + _ => { + return Err(Error::UnexpectedPacket( + "Init1", + format!("{:?}", init1.data().packet().header().packet_type()), + )); + } + } + } + + // Wait for Init3 + { + let init3 = self.get_init(&[3, 127]).await?; + if init3.data().data().get_step() == 127 { + continue; + } + match init3.data().data() { + S2CInitData::Init3 { x, n, level, random2 } => { + let level = *level; + // Solve RSA puzzle: y = x ^ (2 ^ level) % n + // Use Montgomery Reduction + if level > 10_000_000 { + // Reject too high exponents + return Err(Error::RsaPuzzleTooHighLevel(level)); + } + + // Create clientinitiv + alpha = rand::rng().random::<[u8; 10]>(); + // omega is an ASN.1-DER encoded public key from + // the ECDH parameters. + + let ip = self.con.address.ip(); + + let x = **x; + let n = **n; + let random2 = **random2; + + // Use gmp for faster computations if it is + // available. + #[cfg(feature = "rug")] + let y = { + let mut e = Integer::new(); + let n = Integer::from_digits(&n[..], Order::Msf); + let x = Integer::from_digits(&x[..], Order::Msf); + e.set_bit(level, true); + let y = x.pow_mod(&e, &n).map_err(|_| Error::RsaPuzzle)?; + let mut yi = [0; 64]; + y.write_digits(&mut yi, Order::Msf); + yi + }; + + #[cfg(not(feature = "rug"))] + let y = { + let xi = BigUint::from_bytes_be(&x); + let ni = BigUint::from_bytes_be(&n); + let e = BigUint::one() << level as usize; + let yi = xi.modpow(&e, &ni); + info!(parent: &self.con.span, level, x = %xi, n = %ni, y = %yi, + "Solve RSA puzzle"); + algs::biguint_to_array(&yi) + }; + + // Create the command string + // omega is an ASN.1-DER encoded public key from + // the ECDH parameters. + let omega = self.private_key.to_pub().to_tomcrypt(); + let ip = if crate::utils::is_global_ip(&ip) { + ip.to_string() + } else { + String::new() + }; + + // Send next init packet + self.send_packet(OutC2SInit4::new( + version, &x, &n, level, &random2, &y, &alpha, &omega, &ip, + ))?; + } + _ => { + return Err(Error::UnexpectedPacket( + "Init3", + format!("{:?}", init3.data().packet().header().packet_type()), + )); + } + } + } + break; + } + + let clientek_id; + { + let command = self.get_command().await?; + + let (name, args) = CommandParser::new(command.data().packet().content()); + if name != b"initivexpand2" { + return Err(Error::UnexpectedPacket( + "initivexpand2", + format!("{:?}", str::from_utf8(name)), + )); + } + + let mut l = None; + let mut beta_vec = None; + let mut server_key = None; + let mut proof = None; + let mut ot = false; + let mut root = None; + for item in args { + match item { + CommandItem::NextCommand => { + return Err(Error::MultipleCommands("initivexpand2")); + } + CommandItem::Argument(arg) => match arg.name() { + b"l" => { + l = Some( + BASE64_STANDARD + .decode(arg.value().get()) + .map_err(|e| Error::InvalidBase64Arg("proof", e))?, + ) + } + b"beta" => { + beta_vec = Some( + BASE64_STANDARD + .decode(arg.value().get()) + .map_err(|e| Error::InvalidBase64Arg("proof", e))?, + ) + } + b"omega" => { + server_key = Some( + EccKeyPubP256::from_ts( + &arg.value().get_str().map_err(Error::InvalidOmegaString)?, + ) + .map_err(Error::InvalidOmegaKey)?, + ) + } + b"proof" => { + proof = Some( + BASE64_STANDARD + .decode(arg.value().get()) + .map_err(|e| Error::InvalidBase64Arg("proof", e))?, + ) + } + b"ot" => ot = arg.value().get_raw() == b"1", + b"root" => { + let data = BASE64_STANDARD + .decode(arg.value().get()) + .map_err(|e| Error::InvalidBase64Arg("root", e))?; + let mut data2 = [0; 32]; + if data.len() != 32 { + return Err(Error::InvalidRootKeyLength(data.len())); + } + data2.copy_from_slice(&data); + root = Some(EccKeyPubEd25519::from_bytes(data2)); + } + _ => {} + }, + } + } + + if !ot { + return Err(Error::OutdatedServer); + } + if l.is_none() || beta_vec.is_none() || server_key.is_none() || proof.is_none() { + return Err(Error::InvalidInitivexpand2); + } + let l = l.unwrap(); + let beta_vec = beta_vec.unwrap(); + let server_key = server_key.unwrap(); + let proof = proof.unwrap(); + let root = root.unwrap_or_else(|| EccKeyPubEd25519::from_bytes(crate::ROOT_KEY)); + + // Check signature of l (proof) + server_key.verify(&l, &proof).map_err(Error::InvalidSignature)?; + + if beta_vec.len() != 54 { + return Err(Error::InvalidBetaLength(beta_vec.len())); + } + + let mut beta = [0; 54]; + beta.copy_from_slice(&beta_vec); + + // Parse license argument + let licenses = Licenses::parse(l).map_err(Error::ParseLicense)?; + // Ephemeral key of server + let server_ek = licenses.derive_public_key(root).map_err(Error::ParseLicense)?; + + // Create own ephemeral key + let ek = EccKeyPrivEd25519::create(); + + let (iv, mac) = algs::compute_iv_mac(&alpha, &beta, &ek, &server_ek); + self.con.params = Some(ConnectedParams::new(server_key, iv, mac)); + + // Send clientek + let ek_pub = ek.to_pub(); + let ek_s = BASE64_STANDARD.encode(ek_pub.0.as_bytes()); + + // Proof: ECDSA signature of ek || beta + let mut all = Vec::with_capacity(32 + 54); + all.extend_from_slice(ek_pub.0.as_bytes()); + all.extend_from_slice(&beta); + let proof = self.private_key.clone().sign(&all); + let proof_s = BASE64_STANDARD.encode(&proof); + + // Send clientek + let mut cmd = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientek"); + cmd.write_arg("ek", &ek_s); + cmd.write_arg("proof", &proof_s); + clientek_id = self.send_packet(cmd.into_packet())?; + } + self.wait_for_ack(clientek_id).await?; + + Ok(()) + } + + /// Filter the incoming items. + pub async fn filter_items Result>>( + &mut self, filter: F, + ) -> Result { + loop { + let item = self.next().await; + match item { + None => return Err(Error::ConnectionEnd), + Some(r) => { + if let Some(r) = filter(self, r?)? { + return Ok(r); + } + } + } + } + } + + /// Filter the incoming items. Drops audio packets. + pub async fn filter_commands Result>>( + &mut self, filter: F, + ) -> Result { + loop { + let item = self.next().await; + match item { + None => return Err(Error::ConnectionEnd), + Some(Err(e)) => return Err(e), + Some(Ok(StreamItem::Error(error))) => { + warn!(%error, "Got connection error"); + } + Some(Ok(StreamItem::AckPacket(_))) => {} + Some(Ok(StreamItem::S2CInit(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::C2SInit(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::Audio(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::Command(packet))) => { + if let Some(r) = filter(self, packet)? { + return Ok(r); + } + } + Some(Ok(StreamItem::NetworkStatsUpdated)) => {} + } + } + } + + pub async fn wait_disconnect(&mut self) -> Result<()> { + loop { + let item = self.next().await; + match item { + None => return Ok(()), + Some(Err(e)) => return Err(e), + Some(Ok(StreamItem::AckPacket(_))) => {} + Some(Ok(StreamItem::Error(error))) => { + warn!(%error, "Got connection error"); + } + Some(Ok(StreamItem::S2CInit(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::C2SInit(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::Audio(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::Command(packet))) => { + self.hand_back_buffer(packet.into_buffer()); + } + Some(Ok(StreamItem::NetworkStatsUpdated)) => {} + } + } + } + + fn handle_command(&mut self, command: InCommandBuf) -> Result> { + let _span = self.con.span.clone().entered(); + let (name, args) = CommandParser::new(command.data().packet().content()); + if name == b"initserver" { + // Handle an initserver + if let Some(params) = &mut self.params { + let mut c_id = None; + for item in args { + match item { + CommandItem::NextCommand => { + return Err(Error::MultipleCommands("initserver")); + } + CommandItem::Argument(arg) => { + if arg.name() == b"aclid" { + c_id = Some( + arg.value() + .get_parse::() + .map_err(|e| { + Error::InvalidClientId( + arg.value().get_raw().to_vec(), + e, + ) + })?, + ); + break; + } + } + } + } + + if let Some(c_id) = c_id { + params.c_id = c_id; + } else { + return Err(Error::NoClientId); + } + } else { + return Err(Error::EarlyInitserver); + } + + // Notify the resender that we are connected + let this = &mut **self; + this.resender.set_state(ResenderState::Connected); + } else if name == b"notifyclientleftview" { + // Handle disconnect + if let Some(params) = &mut self.params { + let mut own_client = false; + for item in args { + match item { + CommandItem::NextCommand => {} + CommandItem::Argument(arg) => { + if arg.name() == b"clid" { + let c_id = arg + .value() + .get_parse::() + .map_err(|e| { + Error::InvalidClientId(arg.value().get_raw().to_vec(), e) + })?; + own_client |= c_id == params.c_id; + } + } + } + } + + if own_client { + // We are disconnected + let this = &mut **self; + this.resender.set_state(ResenderState::Disconnected); + } + } + } else if name == b"notifyplugincmd" { + let mut is_getversion = false; + let mut is_getversion_request = false; + let mut sender: Option = None; + for item in args.chain(std::iter::once(CommandItem::NextCommand)) { + match item { + CommandItem::Argument(arg) => match arg.name() { + b"name" => is_getversion = arg.value().get_raw() == b"getversion", + b"data" => is_getversion_request = arg.value().get_raw() == b"request", + b"invokerid" => { + if let Ok(id) = arg.value().get_parse::() { + sender = Some(id); + } + } + _ => {} + }, + CommandItem::NextCommand => { + if let Some(sender) = sender { + if is_getversion && is_getversion_request { + let mut version = format!( + "{} {}", + env!("CARGO_PKG_NAME"), + git_testament::render_testament!(crate::TESTAMENT), + ); + #[cfg(debug_assertions)] + version.push_str(" (Debug)"); + #[cfg(not(debug_assertions))] + version.push_str(" (Release)"); + + let mut cmd = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "plugincmd", + ); + cmd.write_arg("name", &"getversion"); + cmd.write_arg("data", &version); + cmd.write_arg("targetmode", &2); + cmd.write_arg("target", &sender); + self.send_packet(cmd.into_packet())?; + } + } + } + } + } + } + + Ok(Some(command)) + } +} + +impl Deref for Client { + type Target = Connection; + fn deref(&self) -> &Self::Target { &self.con } +} + +impl DerefMut for Client { + fn deref_mut(&mut self) -> &mut Self::Target { &mut self.con } +} + +/// Return queued errors and inspect packets. +impl Stream for Client { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + loop { + match Pin::new(&mut self.con).poll_next(cx) { + Poll::Ready(Some(Ok(StreamItem::Command(command)))) => { + match self.handle_command(command) { + Err(e) => return Poll::Ready(Some(Err(e))), + Ok(Some(cmd)) => { + return Poll::Ready(Some(Ok(StreamItem::Command(cmd)))); + } + Ok(None) => {} + } + } + Poll::Ready(Some(Err(e))) => return Poll::Ready(Some(Err(e.into()))), + Poll::Ready(Some(Ok(r))) => return Poll::Ready(Some(Ok(r))), + Poll::Ready(None) => return Poll::Ready(None), + Poll::Pending => return Poll::Pending, + } + } + } +} + +#[cfg(test)] +mod tests { + use std::cell::Cell; + use std::collections::VecDeque; + use std::io; + use std::sync::{Arc, Mutex}; + use std::task::Waker; + + use anyhow::{Result, bail}; + use num_traits::ToPrimitive; + use once_cell::sync::Lazy; + use tokio::io::ReadBuf; + use tokio::sync::oneshot; + use tokio::time::{self, Duration}; + + use super::*; + use crate::connection::Event; + use crate::resend::PartialPacketId; + + static TRACING: Lazy<()> = Lazy::new(|| tracing_subscriber::fmt().with_test_writer().init()); + + #[derive(Clone, Debug)] + struct SimulatedSocketState { + buffer: [VecDeque>; 2], + wakers: [Option; 2], + } + + /// Simulate a connection + #[derive(Clone, Debug)] + struct SimulatedSocket { + state: Arc>, + /// Index into the wakers list. + i: usize, + addr: SocketAddr, + } + + #[derive(Clone, Debug)] + struct SimulatedMixSocketState { + /// The order in which packets are sent to the inner socket. + /// + /// The default (if the list is empty) is `0, 1, 2, 3, 4, ...`. + /// To send the third packet first use `2, 0, 1, 3, 4, ...`. + order: Vec, + /// Queued packets that are waiting to be sent to the inner socket + send_buffer: Vec>, + } + + /// Simulate a connection but mix the packet order + #[derive(Debug)] + struct SimulatedMixSocket { + inner: SimulatedSocket, + state: Mutex, + } + + impl SimulatedSocketState { + fn new() -> Self { Self { buffer: Default::default(), wakers: Default::default() } } + } + + impl SimulatedSocket { + fn new(state: Arc>, i: usize, addr: SocketAddr) -> Self { + Self { state, i, addr } + } + + /// Create a pair of simulated sockets which are connected with each + /// other. + fn pair(addr0: SocketAddr, addr1: SocketAddr) -> (SimulatedSocket, SimulatedSocket) { + let state = Arc::new(Mutex::new(SimulatedSocketState::new())); + // Switch addresses as we use them as address from receiving packets + (Self::new(state.clone(), 0, addr1), Self::new(state, 1, addr0)) + } + } + + impl Socket for SimulatedSocket { + fn poll_recv_from( + &self, cx: &mut Context, buf: &mut ReadBuf, + ) -> Poll> { + let mut state = self.state.lock().unwrap(); + if let Some(packet) = state.buffer[self.i].pop_front() { + let len = std::cmp::min(buf.remaining(), packet.len()); + buf.put_slice(&packet[..len]); + info!(packet = ?&packet[..len], "{} receives packet", self.i); + Poll::Ready(Ok(self.addr)) + } else { + state.wakers[self.i] = Some(cx.waker().clone()); + Poll::Pending + } + } + + fn poll_send_to( + &self, _: &mut Context, buf: &[u8], _: SocketAddr, + ) -> Poll> { + let mut state = self.state.lock().unwrap(); + info!(packet = ?buf, "{} sends packet", self.i); + state.buffer[1 - self.i].push_back(buf.to_vec()); + if let Some(waker) = state.wakers[1 - self.i].take() { + waker.wake(); + } + Poll::Ready(Ok(buf.len())) + } + + fn local_addr(&self) -> io::Result { Ok(self.addr) } + } + + impl SimulatedMixSocket { + fn new(inner: SimulatedSocket, order: Vec) -> Self { + let mut check_order = order.clone(); + check_order.sort(); + assert!(check_order.is_empty() || check_order.windows(2).all(|win| win[0] != win[1])); + Self { + inner, + state: Mutex::new(SimulatedMixSocketState { + order, + send_buffer: Default::default(), + }), + } + } + + fn pair( + addr0: SocketAddr, addr1: SocketAddr, order0: Vec, order1: Vec, + ) -> (SimulatedMixSocket, SimulatedMixSocket) { + let (inner0, inner1) = SimulatedSocket::pair(addr0, addr1); + (Self::new(inner0, order0), Self::new(inner1, order1)) + } + } + + impl Socket for SimulatedMixSocket { + fn poll_recv_from( + &self, cx: &mut Context, buf: &mut ReadBuf, + ) -> Poll> { + self.inner.poll_recv_from(cx, buf) + } + + fn poll_send_to( + &self, cx: &mut Context, buf: &[u8], target: SocketAddr, + ) -> Poll> { + let mut state = self.state.lock().unwrap(); + state.send_buffer.push(buf.to_vec()); + + // Send packets from send_buffer which are ready + while !state.order.is_empty() { + let next = state.order[0]; + if state.send_buffer.len() <= next { + break; + } + state.order.remove(0); + info!("Sending packet {}", next); + let packet = state.send_buffer.remove(next); + let send_res = self.inner.poll_send_to(cx, &packet, target); + let Poll::Ready(Ok(len)) = send_res else { + panic!("Unexpected send result {:?}", send_res) + }; + assert_eq!(len, packet.len()); + + // Shift all following packet ids + // After sending packet 2 + // 2, 0, 1, 3, 4 + // becomes + // 0, 1, 2, 3 + for order in &mut state.order { + if *order > next { + *order -= 1; + } + } + } + + if state.order.is_empty() { + for packet in std::mem::take(&mut state.send_buffer) { + // Send all packets in order + info!("Sending packet in order"); + let send_res = self.inner.poll_send_to(cx, &packet, target); + let Poll::Ready(Ok(len)) = send_res else { + panic!("Unexpected send result {:?}", send_res) + }; + assert_eq!(len, packet.len()); + } + } + + Poll::Ready(Ok(buf.len())) + } + + fn local_addr(&self) -> io::Result { self.inner.local_addr() } + } + + pub struct TestConnection { + pub client: Client, + pub server: Client, + } + + impl TestConnection { + pub fn new() -> Result { + let addr = "127.0.0.1:0".parse()?; + let (socket0, socket1) = SimulatedSocket::pair(addr, addr); + Self::new_with_sockets(Box::new(socket0), Box::new(socket1)) + } + + pub fn new_with_sockets( + socket0: Box, socket1: Box, + ) -> Result { + Lazy::force(&TRACING); + + let addr = "127.0.0.1:0".parse()?; + let client_key = EccKeyPrivP256::create(); + let server_key = EccKeyPrivP256::create(); + + let mut client = Client::new(addr, socket0, client_key); + let mut server = Client::new(addr, socket1, server_key); + server.is_client = false; + + // TODO Span is = "client" + crate::log::add_logger_with_verbosity(3, &mut client); + // TODO Span is = "server" + crate::log::add_logger_with_verbosity(3, &mut server); + + Ok(Self { client, server }) + } + + pub fn set_connected(&mut self) { + Self::set_con_connected(&mut self.client, self.server.private_key.to_pub()); + Self::set_con_connected(&mut self.server, self.client.private_key.to_pub()); + } + + /// Set the connection to connected. + fn set_con_connected(con: &mut Client, other_key: EccKeyPubP256) { + let con = &mut **con; + con.resender.set_state(ResenderState::Connected); + + con.codec.outgoing_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + con.codec.incoming_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + con.codec.outgoing_p_ids[PacketType::Ack.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + con.codec.incoming_p_ids[PacketType::Ack.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + + // Set params + let mut params = ConnectedParams::new(other_key, [0; 64], [0x42; 8]); + params.c_id = 1; + con.params = Some(params); + } + } + + /// Check if init packet is sent and connect timeout is working. + #[tokio::test] + async fn connect_timeout() -> Result<()> { + let mut state = TestConnection::new()?; + + let (send, recv) = oneshot::channel(); + let send = Cell::new(Some(send)); + let listener = move |event: &Event| { + if let Event::ReceivePacket(packet) = event { + if packet.header().packet_type() == PacketType::Init { + if let Some(s) = send.replace(None) { + s.send(()).unwrap(); + } + } + } + }; + + state.server.event_listeners.push(Box::new(listener)); + + tokio::select!( + (r, err) = future::join( + time::timeout(Duration::from_secs(10), recv), + state.client.connect(), + ) => { + r??; + assert!(err.is_err(), "Connect should timeout"); + } + _ = state.server.wait_disconnect() => { + bail!("Server should just run in the background"); + } + ); + Ok(()) + } + + #[tokio::test] + async fn disconnect_timeout() -> Result<()> { + let mut state = TestConnection::new()?; + state.set_connected(); + + let (send, recv) = oneshot::channel(); + let send = Cell::new(Some(send)); + let listener = move |event: &Event| { + if let Event::ReceivePacket(packet) = event { + if packet.header().packet_type() == PacketType::Command { + send.replace(None).unwrap().send(()).unwrap(); + } + } + }; + + state.server.event_listeners.push(Box::new(listener)); + + let mut cmd = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "clientdisconnect", + ); + cmd.write_arg("reasonid", &8); + cmd.write_arg("reasonmsg", &"Bye"); + + state.client.send_packet(cmd.into_packet())?; + + tokio::select!( + (r, err) = future::join( + time::timeout(Duration::from_secs(10), recv), + state.client.wait_disconnect(), + ) => { + r??; + assert!(err.is_err(), "Disconnect should timeout"); + } + _ = state.server.wait_disconnect() => { + bail!("Server should just run in the background"); + } + ); + Ok(()) + } + + #[tokio::test] + async fn timeout() -> Result<()> { + let mut state = TestConnection::new()?; + state.set_connected(); + + let r = state.client.wait_disconnect().await; + assert!( + matches!(r, super::Result::<()>::Err(Error::TsProto(crate::Error::Timeout(_)))), + "Connection should timeout (result: {:?})", + r + ); + Ok(()) + } + + /// Send ping and check that a pong is received. + #[tokio::test] + async fn pong() -> Result<()> { + let mut state = TestConnection::new()?; + state.set_connected(); + + let packet = OutPacket::new_with_dir(Direction::S2C, Flags::UNENCRYPTED, PacketType::Ping); + state.server.send_packet(packet.clone())?; + state.server.send_packet(packet.clone())?; + + let (send, recv) = oneshot::channel(); + let send = Cell::new(Some(send)); + let counter = Cell::new(0u8); + let listener = move |event: &Event| { + if let Event::ReceivePacket(packet) = event { + if packet.header().packet_type() == PacketType::Pong { + counter.set(counter.get() + 1); + // Until 2 pongs are received + if counter.get() == 2 { + send.replace(None).unwrap().send(()).unwrap(); + } + } + } + }; + + state.server.event_listeners.push(Box::new(listener)); + + tokio::select!( + r = time::timeout(Duration::from_secs(5), recv) => { + r??; + return Ok(()); + } + _ = state.client.wait_disconnect() => {} + _ = state.server.wait_disconnect() => {} + ); + bail!("Unexpected disconnect") + } + + /// Check that the packet id wraps around. + #[tokio::test] + async fn generation_id() -> Result<()> { + let mut state = TestConnection::new()?; + state.set_connected(); + + // Sending 70 000 messages takes about 7 minutes in debug mode so we + // start at 65 500 and send only 100. + let count = 100; + + // Set current id + for c in [&mut state.client, &mut state.server] { + c.codec.outgoing_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 65_500 }; + c.codec.incoming_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 65_500 }; + c.codec.outgoing_p_ids[PacketType::Ack.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 65_500 }; + c.codec.incoming_p_ids[PacketType::Ack.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 65_500 }; + } + + let (send, recv) = oneshot::channel(); + let send = Cell::new(Some(send)); + let counter = Cell::new(0u8); + let listener = move |event: &Event| { + if let Event::ReceivePacket(packet) = event { + if packet.header().packet_type() == PacketType::Command { + counter.set(counter.get() + 1); + if counter.get() == count { + send.replace(None).unwrap().send(()).unwrap(); + } + } + } + }; + + state.client.event_listeners.push(Box::new(listener)); + + for i in 0..count { + let mut cmd = OutCommand::new( + Direction::S2C, + Flags::empty(), + PacketType::Command, + "notifytextmessage", + ); + cmd.write_arg("msg", &format!("message {}", i)); + state.server.send_packet(cmd.into_packet())?; + } + + tokio::select!( + r = recv => { + r?; + return Ok(()); + } + _ = state.client.wait_disconnect() => {} + _ = state.server.wait_disconnect() => {} + ); + bail!("Unexpected disconnect") + } + + /// Check that out of order packets are decoded in the correct order. + async fn out_of_order_test(order: Vec) -> Result<()> { + let addr = "127.0.0.1:0".parse()?; + let (socket0, socket1) = SimulatedMixSocket::pair(addr, addr, vec![], order); + let mut state = TestConnection::new_with_sockets(Box::new(socket0), Box::new(socket1))?; + state.set_connected(); + + let count = 10; + + let (send, recv) = oneshot::channel(); + let send = Cell::new(Some(send)); + let counter = Cell::new(0u8); + let listener = move |event: &Event| { + if let Event::ReceivePacket(packet) = event { + if packet.header().packet_type() == PacketType::Command { + let Some(content) = + packet.content().strip_prefix(b"notifytextmessage msg=message\\s") + else { + panic!("Expected text message but got '{:?}'", packet.content()) + }; + let i: u8 = std::str::from_utf8(content).unwrap().parse().unwrap(); + let cnt = counter.get(); + assert_eq!(cnt, i, "Messages are not in the correct order"); + counter.set(cnt + 1); + if counter.get() == count { + send.replace(None).unwrap().send(()).unwrap(); + } + } + } + }; + + state.client.event_listeners.push(Box::new(listener)); + + for i in 0..count { + let mut cmd = OutCommand::new( + Direction::S2C, + Flags::empty(), + PacketType::Command, + "notifytextmessage", + ); + cmd.write_arg("msg", &format!("message {}", i)); + state.server.send_packet(cmd.into_packet())?; + } + + tokio::select!( + r = recv => { + r?; + return Ok(()); + } + _ = state.client.wait_disconnect() => {} + _ = state.server.wait_disconnect() => {} + ); + bail!("Unexpected disconnect") + } + + // Check that out of order packets are decoded in the correct order. + + #[tokio::test] + async fn in_order() -> Result<()> { out_of_order_test(vec![]).await } + + #[tokio::test] + async fn single_out_of_order() -> Result<()> { out_of_order_test(vec![2]).await } + + #[tokio::test] + async fn reversed_order() -> Result<()> { + out_of_order_test(vec![9, 8, 7, 6, 5, 4, 3, 2, 1, 0]).await + } + + #[tokio::test] + async fn some_out_of_order() -> Result<()> { + out_of_order_test(vec![5, 3, 7, 8, 2, 0, 6, 1]).await + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/connection.rs b/native/vendor/tsclientlib/tsproto/src/connection.rs new file mode 100644 index 0000000..dd4ee7a --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/connection.rs @@ -0,0 +1,449 @@ +use std::collections::VecDeque; +use std::io; +use std::mem; +use std::net::SocketAddr; +use std::pin::Pin; +use std::task::{Context, Poll}; + +use futures::prelude::*; +use generic_array::GenericArray; +use generic_array::typenum::consts::U16; +use num_traits::ToPrimitive; +use tokio::io::ReadBuf; +use tokio::net::UdpSocket; +use tracing::{Span, info_span}; +use tsproto_packets::packets::*; +use tsproto_types::crypto::EccKeyPubP256; + +use crate::packet_codec::PacketCodec; +use crate::resend::{PacketId, PartialPacketId, Resender, ResenderState}; +use crate::{Error, MAX_UDP_PACKET_LENGTH, Result, UDP_SINK_CAPACITY}; + +/// The needed functions, this can be used to abstract from the underlying +/// transport and allows simulation. +pub trait Socket { + fn poll_recv_from(&self, cx: &mut Context, buf: &mut ReadBuf) -> Poll>; + fn poll_send_to( + &self, cx: &mut Context, buf: &[u8], target: SocketAddr, + ) -> Poll>; + fn local_addr(&self) -> io::Result; +} + +/// A cache for the key and nonce for a generation id. +/// This has to be stored for each packet type. +#[derive(Debug)] +pub struct CachedKey { + pub generation_id: u32, + pub key: GenericArray, + pub nonce: GenericArray, +} + +/// Data that has to be stored for a connection when it is connected. +pub struct ConnectedParams { + /// The client id of this connection. + pub c_id: u16, + /// If voice packets should be encrypted + pub voice_encryption: bool, + + /// The public key of the other side. + pub public_key: EccKeyPubP256, + /// The iv used to encrypt and decrypt packets. + pub shared_iv: [u8; 64], + /// The mac used for unencrypted packets. + pub shared_mac: [u8; 8], + /// Cached key and nonce per packet type and for server to client (without + /// client id inside the packet) and client to server communication. + pub key_cache: [[CachedKey; 2]; 8], +} + +/// An event that originates from a tsproto raw connection. +#[derive(Debug)] +pub enum Event<'a> { + ReceiveUdpPacket(&'a InUdpPacket<'a>), + ReceivePacket(&'a InPacket<'a>), + SendUdpPacket(&'a OutUdpPacket), + SendPacket(&'a OutPacket), +} + +/// An item that originates from a tsproto raw event stream. +/// +/// The disconnected event is signaled by returning `None` from the stream. +#[derive(Debug)] +pub enum StreamItem { + Command(InCommandBuf), + Audio(InAudioBuf), + C2SInit(InC2SInitBuf), + S2CInit(InS2CInitBuf), + /// All packets with an id less or equal to this id were acknowledged. + AckPacket(PacketId), + /// The network statistics were updated. + NetworkStatsUpdated, + Error(Error), +} + +type EventListener = Box Fn(&'a Event<'a>) + Send>; + +/// Represents a currently alive connection. +pub struct Connection { + pub is_client: bool, + pub span: Span, + /// The parameters of this connection, if it is already established. + pub params: Option, + /// The address of the other side, where packets are coming from and going + /// to. + pub address: SocketAddr, + + pub resender: Resender, + pub codec: PacketCodec, + pub udp_socket: Box, + udp_buffer: Vec, + + /// A buffer of packets that should be returned from the stream. + /// + /// If a new udp packet is received and we already received the following + /// ids, we can get multiple packets back at once. As we can only return one + /// from the stream, the rest is stored here. + pub(crate) stream_items: VecDeque, + + /// The queue of non-command packets that should be sent. + /// + /// These packets are not influenced by congestion control. + /// If it gets too long, we don't poll from the `udp_socket` anymore. + acks_to_send: VecDeque, + + pub event_listeners: Vec, +} + +impl Socket for UdpSocket { + fn poll_recv_from(&self, cx: &mut Context, buf: &mut ReadBuf) -> Poll> { + self.poll_recv_from(cx, buf) + } + + fn poll_send_to( + &self, cx: &mut Context, buf: &[u8], target: SocketAddr, + ) -> Poll> { + self.poll_send_to(cx, buf, target) + } + + fn local_addr(&self) -> io::Result { self.local_addr() } +} + +impl Default for CachedKey { + fn default() -> Self { + CachedKey { generation_id: u32::MAX, key: [0; 16].into(), nonce: [0; 16].into() } + } +} + +impl ConnectedParams { + /// Fills the parameters for a connection with their default state. + pub fn new(public_key: EccKeyPubP256, shared_iv: [u8; 64], shared_mac: [u8; 8]) -> Self { + Self { + c_id: 0, + voice_encryption: true, + public_key, + shared_iv, + shared_mac, + key_cache: Default::default(), + } + } +} + +impl Connection { + pub fn new(is_client: bool, address: SocketAddr, udp_socket: Box) -> Self { + let span = info_span!("connection", local_addr = %udp_socket.local_addr().unwrap(), + remote_addr = %address); + + let mut res = Self { + is_client, + span, + params: None, + address, + resender: Default::default(), + codec: Default::default(), + udp_socket, + udp_buffer: Default::default(), + + stream_items: Default::default(), + acks_to_send: Default::default(), + event_listeners: Default::default(), + }; + if is_client { + // The first command is sent as part of the C2SInit::Init4 packet + // so it does not get registered automatically. + res.codec.outgoing_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + } else { + res.codec.incoming_p_ids[PacketType::Command.to_usize().unwrap()] = + PartialPacketId { generation_id: 0, packet_id: 1 }; + } + res + } + + /// Check if a given id is in the receive window. + /// + /// Returns + /// 1. If the packet id is inside the receive window + /// 1. The generation of the packet + /// 1. The minimum accepted packet id + /// 1. The maximum accepted packet id + pub(crate) fn in_receive_window(&self, p_type: PacketType, p_id: u16) -> (bool, u32, u16, u16) { + if p_type == PacketType::Init { + return (true, 0, 0, 0); + } + let type_i = p_type.to_usize().unwrap(); + // Receive window is the next half of ids + let cur_next = self.codec.incoming_p_ids[type_i].packet_id; + let (limit, next_gen) = cur_next.overflowing_add(u16::MAX / 2); + let gen = self.codec.incoming_p_ids[type_i].generation_id; + let in_recv_win = (!next_gen && p_id >= cur_next && p_id < limit) + || (next_gen && (p_id >= cur_next || p_id < limit)); + let gen_id = if in_recv_win { + if next_gen && p_id < limit { gen + 1 } else { gen } + } else if p_id < cur_next { + gen + } else { + gen - 1 + }; + + (in_recv_win, gen_id, cur_next, limit) + } + + pub fn send_event(&self, event: &Event) { + for l in &self.event_listeners { + l(event) + } + } + + pub fn hand_back_buffer(&mut self, buffer: Vec) { + if self.udp_buffer.capacity() < MAX_UDP_PACKET_LENGTH + && buffer.capacity() >= MAX_UDP_PACKET_LENGTH + { + self.udp_buffer = buffer; + } + } + + fn poll_send_acks(&mut self, cx: &mut Context) -> Result<()> { + // Poll acks_to_send + while let Some(packet) = self.acks_to_send.front() { + match self.poll_send_udp_packet(cx, packet) { + Poll::Ready(Ok(())) => { + self.resender.handle_loss_outgoing(packet); + } + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => break, + } + self.acks_to_send.pop_front(); + } + Ok(()) + } + + fn poll_incoming_udp_packet(&mut self, cx: &mut Context) -> Poll> { + if self.acks_to_send.len() >= UDP_SINK_CAPACITY { + return Poll::Pending; + } + + loop { + // Poll udp_socket + if self.udp_buffer.len() != MAX_UDP_PACKET_LENGTH { + self.udp_buffer.resize(MAX_UDP_PACKET_LENGTH, 0); + } + + let mut read_buf = ReadBuf::new(&mut self.udp_buffer); + match self.udp_socket.poll_recv_from(cx, &mut read_buf) { + Poll::Ready(Ok(addr)) => { + let size = read_buf.filled().len(); + let mut udp_buffer = mem::take(&mut self.udp_buffer); + udp_buffer.truncate(size); + match self.handle_udp_packet(cx, udp_buffer, addr) { + Ok(()) => { + if let Some(item) = self.stream_items.pop_front() { + return Poll::Ready(Ok(item)); + } + } + Err(e) => { + return Poll::Ready(Err(e)); + } + } + } + // Udp socket closed + Poll::Ready(Err(e)) => return Poll::Ready(Err(Error::Network(e))), + Poll::Pending => return Poll::Pending, + } + } + } + + fn handle_udp_packet( + &mut self, cx: &mut Context, udp_buffer: Vec, addr: SocketAddr, + ) -> Result<()> { + let _span = self.span.clone().entered(); + if addr != self.address { + self.stream_items.push_back(StreamItem::Error(Error::WrongAddress)); + return Ok(()); + } + + let dir = if self.is_client { Direction::S2C } else { Direction::C2S }; + let packet = InUdpPacket(match InPacket::try_new(dir, &udp_buffer) { + Ok(r) => r, + Err(e) => { + self.stream_items.push_back(StreamItem::Error(Error::PacketParse("udp", e))); + return Ok(()); + } + }); + let event = Event::ReceiveUdpPacket(&packet); + self.send_event(&event); + + self.resender.received_packet(); + PacketCodec::handle_udp_packet(self, cx, udp_buffer)?; + + Ok(()) + } + + /// Try to send an ack packet. + /// + /// If it does not work, add it to the ack queue. + pub(crate) fn send_ack_packet(&mut self, cx: &mut Context, packet: OutPacket) -> Result<()> { + self.send_event(&Event::SendPacket(&packet)); + let mut udp_packets = PacketCodec::encode_packet(self, packet)?; + assert_eq!( + udp_packets.len(), + 1, + "Encoding an ack packet should only yield a single packet" + ); + let packet = udp_packets.pop().unwrap(); + + match self.poll_send_udp_packet(cx, &packet) { + Poll::Ready(r) => { + if r.is_ok() { + self.resender.handle_loss_outgoing(&packet); + } + r + } + Poll::Pending => { + self.acks_to_send.push_back(packet); + Ok(()) + } + } + } + + /// Add a packet to the send queue. + /// + /// This function buffers indefinitely, to prevent using a large amount of + /// memory, check `is_send_queue_full` first and only send a packet if this + /// function returns `false`. + /// + /// When the `PacketId` which is returned by this function is acknowledged, + /// the packet was successfully received by the other side of the + /// connection. + pub fn send_packet(&mut self, packet: OutPacket) -> Result { + self.send_event(&Event::SendPacket(&packet)); + let udp_packets = PacketCodec::encode_packet(self, packet)?; + + let id = udp_packets.last().unwrap().into(); + for p in udp_packets { + self.send_udp_packet(p); + } + Ok(id) + } + + /// Add an udp packet to the send queue. + pub fn send_udp_packet(&mut self, packet: OutUdpPacket) { + let _span = self.span.clone().entered(); + match packet.packet_type() { + PacketType::Init | PacketType::Command | PacketType::CommandLow => { + Resender::send_packet(self, packet); + } + _ => self.acks_to_send.push_back(packet), + } + } + + pub fn poll_send_udp_packet( + &self, cx: &mut Context, packet: &OutUdpPacket, + ) -> Poll> { + Self::static_poll_send_udp_packet( + &*self.udp_socket, + self.address, + &self.event_listeners, + cx, + packet, + ) + } + + /// Remember to add the size of the sent packet to the stats in the resender. + pub fn static_poll_send_udp_packet( + udp_socket: &dyn Socket, address: SocketAddr, event_listeners: &[EventListener], + cx: &mut Context, packet: &OutUdpPacket, + ) -> Poll> { + let data = packet.data().data(); + match udp_socket.poll_send_to(cx, data, address).map_err(Error::Network)? { + Poll::Pending => Poll::Pending, + Poll::Ready(size) => { + let event = Event::SendUdpPacket(packet); + for l in event_listeners { + l(&event) + } + + if size != data.len() { + Poll::Ready(Err(Error::Network(std::io::Error::new( + std::io::ErrorKind::Other, + "Failed to send whole udp packet", + )))) + } else { + Poll::Ready(Ok(())) + } + } + } + } + + pub fn is_send_queue_full(&self) -> bool { self.resender.is_full() } + pub fn is_send_queue_empty(&self) -> bool { self.resender.is_empty() } +} + +/// Pull for events. +/// +/// `Ok(StreamItem::Error)` is recoverable, `Err()` is not. +/// +/// Polling does a few things in round robin fashion: +/// 1. Check for new udp packets +/// 2. Use the resender to resend packets if necessary +/// 3. Use the resender to send ping packets if necessary +impl Stream for Connection { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let _span = self.span.clone().entered(); + if let Err(e) = self.poll_send_acks(cx) { + return Poll::Ready(Some(Err(e))); + } + + if self.resender.get_state() == ResenderState::Disconnected { + // Send all ack packets and return `None` afterwards + if self.acks_to_send.is_empty() { + return Poll::Ready(None); + } + } + + // Use the resender to resend packets + match Resender::poll_resend(&mut self, cx) { + Ok(()) => {} + Err(e) => return Poll::Ready(Some(Err(e))), + } + + // Use the resender to send pings + match Resender::poll_ping(&mut self, cx) { + Ok(()) => {} + Err(e) => return Poll::Ready(Some(Err(e))), + } + + // Return existing stream_items + if let Some(item) = self.stream_items.pop_front() { + return Poll::Ready(Some(Ok(item))); + } + + // Check for new udp packets + match self.poll_incoming_udp_packet(cx) { + Poll::Ready(r) => return Poll::Ready(Some(r)), + Poll::Pending => {} + } + + Poll::Pending + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/lib.rs b/native/vendor/tsclientlib/tsproto/src/lib.rs new file mode 100644 index 0000000..44cce8c --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/lib.rs @@ -0,0 +1,255 @@ +//! This library implements the TeamSpeak3 protocol. +//! +//! For a usable library to build clients and bots, you should take a look at +//! [`tsclientlib`](https://github.com/ReSpeak/tsclientlib), which provides a +//! convenient interface to this library. +//! +//! If you are searching for a usable client, [Qint](https://github.com/ReSpeak/Qint) +//! is a cross-platform TeamSpeak client, which is using this library (more +//! correctly, it is using `tsclientlib`). +//! +//! For more info on this project, take a look at the +//! [tsclientlib README](https://github.com/ReSpeak/tsclientlib). + +use std::fmt; +use std::num::ParseIntError; + +use base64::prelude::*; +use serde::de::{Unexpected, Visitor}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use thiserror::Error; +use tsproto_packets::packets; +use tsproto_types::crypto::EccKeyPrivP256; + +pub mod algorithms; +pub mod client; +pub mod connection; +pub mod license; +pub mod log; +pub mod packet_codec; +pub mod resend; +pub mod utils; + +use algorithms as algs; + +// The build environment of tsproto. +git_testament::git_testament!(TESTAMENT); +#[doc(hidden)] +pub fn get_testament() -> &'static git_testament::GitTestament<'static> { &TESTAMENT } + +type Result = std::result::Result; + +/// The maximum number of bytes for a fragmented packet. +/// +/// The maximum packet size is 500 bytes, as used by +/// `algorithms::compress_and_split`. +/// We pick the ethernet MTU for possible future compatibility, it is unlikely +/// that a packet will get bigger. +pub const MAX_UDP_PACKET_LENGTH: usize = 1500; + +/// The maximum number of bytes for a fragmented packet. +#[allow(clippy::unreadable_literal)] +const MAX_FRAGMENTS_LENGTH: usize = 40960; + +/// The maximum number of packets which are stored, if they are received +/// out-of-order. +// A high-latency initial channel burst can span more than 200 packet IDs +// before a missing command is retransmitted. Keep a bounded reorder window. +const MAX_QUEUE_LEN: u16 = 2048; + +/// The maximum decompressed size of a packet. +#[allow(clippy::unreadable_literal)] + +/// On large servers with more than 2000 channels, the notifychannelsubscribed packet can be +/// 50 kB large (uncompressed). A maximum size to 2 MiB should allow for even larger servers. +const MAX_DECOMPRESSED_SIZE: u32 = 2 * 1024 * 1024; +const FAKE_KEY: [u8; 16] = *b"c:\\windows\\syste"; +const FAKE_NONCE: [u8; 16] = *b"m\\firewall32.cpl"; + +/// The root key in the TeamSpeak license system. +pub const ROOT_KEY: [u8; 32] = [ + 0xcd, 0x0d, 0xe2, 0xae, 0xd4, 0x63, 0x45, 0x50, 0x9a, 0x7e, 0x3c, 0xfd, 0x8f, 0x68, 0xb3, 0xdc, + 0x75, 0x55, 0xb2, 0x9d, 0xcc, 0xec, 0x73, 0xcd, 0x18, 0x75, 0x0f, 0x99, 0x38, 0x12, 0x40, 0x8a, +]; + +/// The maximum amount of ack pachets that a connection intermediately stores. +/// +/// When this amount is stored, no new packets will be polled from the UDP +/// connection. +const UDP_SINK_CAPACITY: usize = 50; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + #[error("Failed to create ack packet: {0}")] + CreateAck(#[source] tsproto_packets::Error), + #[error("Failed to decompress packet: {0}")] + DecompressPacket(#[source] quicklz::Error), + #[error(transparent)] + IdentityCrypto(tsproto_types::crypto::Error), + #[error("Failed to parse int: {0}")] + InvalidHex(#[source] ParseIntError), + #[error("Maximum length exceeded for {0}")] + MaxLengthExceeded(&'static str), + #[error("Network error: {0}")] + Network(#[source] std::io::Error), + #[error("Packet {id} not in receive window [{next};{limit}) for type {p_type:?}")] + NotInReceiveWindow { id: u16, next: u16, limit: u16, p_type: packets::PacketType }, + #[error("Failed to parse {0} packet: {1}")] + PacketParse(&'static str, #[source] tsproto_packets::Error), + #[error("Connection timed out: {0}")] + Timeout(&'static str), + #[error("Got unallowed unencrypted packet")] + UnallowedUnencryptedPacket, + #[error("Got unexpected init packet")] + UnexpectedInitPacket, + #[error("Packet has wrong client id {0}")] + WrongClientId(u16), + #[error("Received udp packet from wrong address")] + WrongAddress, + #[error("{p_type:?} Packet {generation_id}:{packet_id} has a wrong mac")] + WrongMac { p_type: packets::PacketType, generation_id: u32, packet_id: u16 }, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Identity { + #[serde(serialize_with = "serialize_id_key", deserialize_with = "deserialize_id_key")] + key: EccKeyPrivP256, + /// The `client_key_offset`/counter for hash cash. + counter: u64, + /// The maximum counter that was tried, this is greater or equal to + /// `counter` but may yield a lower level. + max_counter: u64, +} + +struct IdKeyVisitor; +impl<'de> Visitor<'de> for IdKeyVisitor { + type Value = EccKeyPrivP256; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "a P256 private ecc key") + } + + fn visit_str(self, s: &str) -> std::result::Result { + EccKeyPrivP256::import_str(s) + .map_err(|_| serde::de::Error::invalid_value(Unexpected::Str(s), &self)) + } +} + +fn serialize_id_key( + key: &EccKeyPrivP256, s: S, +) -> std::result::Result { + s.serialize_str(&BASE64_STANDARD.encode(key.to_short())) +} + +fn deserialize_id_key<'de, D: Deserializer<'de>>( + d: D, +) -> std::result::Result { + d.deserialize_str(IdKeyVisitor) +} + +impl Identity { + #[inline] + pub fn create() -> Self { + let mut res = Self::new(EccKeyPrivP256::create(), 0); + res.upgrade_level(8); + res + } + + #[inline] + pub fn new(key: EccKeyPrivP256, counter: u64) -> Self { + Self::new_with_max_counter(key, counter, counter) + } + + #[inline] + pub fn new_with_max_counter(key: EccKeyPrivP256, counter: u64, max_counter: u64) -> Self { + Self { key, counter, max_counter } + } + + #[inline] + pub fn new_from_str(key: &str) -> Result { + if let Ok(identity) = Identity::new_from_ts_str(key) { + return Ok(identity); + } + let mut res = Self::new(EccKeyPrivP256::import_str(key).map_err(Error::IdentityCrypto)?, 0); + res.upgrade_level(8); + Ok(res) + } + + pub fn new_from_ts_str(key: &str) -> Result { + let counter_separator = key + .find('V') + .ok_or(Error::IdentityCrypto(tsproto_types::crypto::Error::NoCounterBlock))?; + let counter = key[..counter_separator] + .parse::() + .map_err(|_| Error::IdentityCrypto(tsproto_types::crypto::Error::NoCounterBlock))?; + let ecc_key = EccKeyPrivP256::import_str(&key[(counter_separator + 1)..]) + .map_err(Error::IdentityCrypto)?; + Ok(Self::new(ecc_key, counter)) + } + + #[inline] + pub fn new_from_bytes(key: &[u8]) -> Result { + let mut res = Self::new(EccKeyPrivP256::import(key).map_err(Error::IdentityCrypto)?, 0); + res.upgrade_level(8); + Ok(res) + } + + #[inline] + pub fn key(&self) -> &EccKeyPrivP256 { &self.key } + #[inline] + pub fn counter(&self) -> u64 { self.counter } + #[inline] + pub fn max_counter(&self) -> u64 { self.max_counter } + + #[inline] + pub fn set_key(&mut self, key: EccKeyPrivP256) { self.key = key } + #[inline] + pub fn set_counter(&mut self, counter: u64) { self.counter = counter; } + #[inline] + pub fn set_max_counter(&mut self, max_counter: u64) { self.max_counter = max_counter; } + + /// Compute the current hash cash level. + #[inline] + pub fn level(&self) -> u8 { + let omega = self.key.to_pub().to_ts(); + algs::get_hash_cash_level(&omega, self.counter) + } + + /// Compute a better hash cash level. + pub fn upgrade_level(&mut self, target: u8) { + let omega = self.key.to_pub().to_ts(); + let mut offset = self.max_counter; + while offset < u64::MAX && algs::get_hash_cash_level(&omega, offset) < target { + offset += 1; + } + self.counter = offset; + self.max_counter = offset; + } +} + +#[cfg(test)] +mod identity_tests { + use super::*; + + const TEST_PRIV_KEY: &str = + "MG8DAgeAAgEgAiEA6rtKxDn/o/Bo50rNtAE5Ph3h2RKLHQ0gbFkvm2yA79kCIQCrfzAZts/\ + vHP+3MOetKLjNnpZXt4c6U3UB4gWLKR4H9AIgYTyJofmztcTBjq3KZcDdxu+G4RPVwE5vg8VaN2jbQao="; + const TEST_UID: &str = "test/9PZ9vww/Bpf5vJxtJhpz80="; + + #[test] + fn parse_ts_base64() { + let identity = Identity::new_from_str(TEST_PRIV_KEY).unwrap(); + let uid = identity.key().to_pub().get_uid(); + assert_eq!(TEST_UID, &uid); + } + + #[test] + fn parse_ts_base64_with_offset() { + let ident_str = String::from("2792354V") + TEST_PRIV_KEY; + let identity = Identity::new_from_str(&ident_str).unwrap(); + let uid = identity.key().to_pub().get_uid(); + assert_eq!(TEST_UID, &uid); + assert_eq!(identity.level(), 21u8); + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/license.rs b/native/vendor/tsclientlib/tsproto/src/license.rs new file mode 100644 index 0000000..ad40c7e --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/license.rs @@ -0,0 +1,932 @@ +use std::convert::{TryFrom, TryInto}; +use std::fmt; +use std::io::Cursor; +use std::str; + +use curve25519_dalek_ng::edwards::EdwardsPoint; +use curve25519_dalek_ng::scalar::Scalar; +use num_derive::{FromPrimitive, ToPrimitive}; +use num_traits::{FromPrimitive as _, ToPrimitive as _}; +use omnom::{ReadExt, WriteExt}; +use sha2::{Digest, Sha512}; +use thiserror::Error; +use time::OffsetDateTime; +use time::format_description::well_known::Rfc3339; +use tracing::trace; +use tsproto_packets::HexSlice; +use tsproto_types::{ + LicenseType, + crypto::{EccKeyPrivEd25519, EccKeyPubEd25519}, +}; + +pub const TIMESTAMP_OFFSET: i64 = 0x50e2_2700; + +const BLOCK_MIN_LEN: usize = 42; +const BLOCK_TYPE_OFFSET: usize = 33; +const BLOCK_NOT_VALID_BEFORE_OFFSET: usize = 34; +const BLOCK_NOT_VALID_AFTER_OFFSET: usize = 38; + +type Result = std::result::Result; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + #[error( + "License must not exceed bounds {outer_start} - {outer_end} but has {inner_start} - \ + {inner_end}" + )] + Bounds { + outer_start: OffsetDateTime, + outer_end: OffsetDateTime, + inner_start: OffsetDateTime, + inner_end: OffsetDateTime, + }, + #[error("Failed to deserialize license: {0}")] + Deserialize(#[source] std::io::Error), + #[error("Failed to deserialize license: {0}")] + DeserializeString(#[source] std::str::Utf8Error), + #[error("Failed to deserialize date: {0}")] + DeserializeDate(#[source] time::error::ComponentRange), + #[error("License is only valid between {start} and {end}")] + Expired { start: OffsetDateTime, end: OffsetDateTime }, + #[error("Cannot uncompress license public key")] + InvalidPublicKey, + #[error("Invalid data {0:#x} in intermediate license")] + IntermediateInvalidData(u32), + #[error("Invalid public root key for license")] + InvalidRootKey, + #[error("Non-null-terminated string")] + NonterminatedString, + #[error("License contains no private key")] + NoPrivateKey, + #[error("Too many license blocks: {0}")] + TooManyBlocks(usize), + #[error("License too short ({0}): {1}")] + TooShort(usize, &'static str), + #[error("Unknown license block type {0}")] + UnknownBlockType(u8), + #[error("Unknown license type {0}")] + UnknownLicenseType(u8), + #[error("Unsupported license version {0}")] + UnsupportedVersion(u8), + #[error("Wrong key kind {0} in license")] + WrongKeyKind(u8), + #[error("There is no {0} in this block")] + NoSuchProperty(&'static str), + #[error("Wrong property type for id {id}: Expected type {expected} but got type {actual}")] + WrongPropertyType { id: u8, expected: u8, actual: u8 }, + #[error( + "Property with id {id} and type {typ} has wrong length: Expected length {expected} but \ + got length {actual}" + )] + WrongPropertyLength { id: u8, typ: u8, expected: u8, actual: u8 }, +} + +/// A single block of a license +#[derive(Clone, Debug)] +pub struct License { + /// Length of the block + pub len: usize, + /// A private key for the block to derive a private key + pub private_key: Option, + pub inner: InnerLicense, +} + +/// Helper struct to debug print a license block. +pub struct DebugLicense<'a>(&'a License, &'a [u8]); + +#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, FromPrimitive, ToPrimitive)] +pub enum LicenseBlockType { + Intermediate, + Website, + /// Ts3_Server + Server, + Code, + // Not existing in the license parameter: + // 4: Token, 5: License_Sign, 6: MyTsId_Sign, 7: Updater + /// Ts_Server_License + Ts5Server = 8, + /// 32, Ephemeral_Key + Ephemeral = 32, +} + +#[derive(Debug, Clone)] +pub enum InnerLicense { + Ts5Server { + /// Properties from the license, offset from the start of properties for every field + properties: Vec, + }, + Other, +} + +/// A list of blocks, forming a complete license +#[derive(Clone)] +pub struct Licenses { + pub data: Vec, + pub blocks: Vec, +} + +#[derive(Clone, Debug)] +pub enum LicenseProperty<'a> { + /// Unknown property with id 1 and type 1 + Unknown1(u32), + Issuer(&'a str), + MaxClients(u32), + Unknown { + id: u8, + typ: u8, + data: &'a [u8], + }, +} + +#[derive(Debug)] +pub struct LicenseBuilder<'a> { + licenses: &'a mut Licenses, +} + +#[derive(Debug)] +pub struct LicenseBlockBuilder<'a, 'b> { + builder: &'b mut LicenseBuilder<'a>, + /// The start offset for the new block + offset: usize, + typ: LicenseBlockType, +} + +type LicenseTimeBounds = (OffsetDateTime, OffsetDateTime); + +impl Licenses { + pub fn new() -> Self { Self::default() } + + /// Parse a license but ignore expired licenses. + /// + /// This is useful for tests but should not be used otherwise. + pub fn parse_ignore_expired(data: Vec) -> Result { Self::parse_internal(data, false) } + + pub fn parse(data: Vec) -> Result { Self::parse_internal(data, true) } + + pub fn parse_internal(data: Vec, check_expired: bool) -> Result { + let version = data[0]; + if version != 0 && version != 1 { + return Err(Error::UnsupportedVersion(version)); + } + // Read licenses + let mut blocks = Vec::new(); + + let now = OffsetDateTime::now_utc(); + let mut offset = 1; + let mut bounds = None; + while data.len() > offset { + if blocks.len() >= 8 { + // Accept only 8 blocks + return Err(Error::TooManyBlocks(blocks.len())); + } + + // Read next license + let (license, b) = Self::parse_block(&data[offset..], check_expired, now, bounds)?; + offset += license.len; + bounds = Some(b); + + blocks.push(license); + } + + Ok(Licenses { data, blocks }) + } + + fn parse_block( + data: &[u8], check_expired: bool, now: OffsetDateTime, bounds: Option, + ) -> Result<(License, LicenseTimeBounds)> { + let license = License::parse(data)?; + let license_data = &data[..license.len]; + + // Check if the certificate is valid + let new_bounds = ( + license.get_not_valid_before(license_data)?, + license.get_not_valid_after(license_data)?, + ); + if new_bounds.0 > now && check_expired { + return Err(Error::Expired { start: new_bounds.0, end: new_bounds.1 }); + } + if new_bounds.1 < now && check_expired { + return Err(Error::Expired { start: new_bounds.0, end: new_bounds.1 }); + } + if let Some((start, end)) = bounds { + // The inner license must not have wider bounds + if new_bounds.0 < start || new_bounds.1 > end { + return Err(Error::Bounds { + outer_start: start, + outer_end: end, + inner_start: new_bounds.0, + inner_end: new_bounds.1, + }); + } + } + Ok((license, new_bounds)) + } + + pub fn derive_public_key(&self, root: EccKeyPubEd25519) -> Result { + let mut last_round = root.0.decompress().ok_or(Error::InvalidRootKey)?; + let mut offset = 1; + trace!("Deriving public key for license"); + for l in &self.blocks { + trace!(current_key = %HexSlice((&last_round.compress().0) as &[u8])); + last_round = l.derive_public_key(&self.data[offset..offset + l.len], &last_round)?; + offset += l.len; + } + trace!( + final_key = %HexSlice((&last_round.compress().0) as &[u8]), + "Finished deriving public key" + ); + Ok(last_round) + } + + /// Derive the private key of this license, starting with a specific block. + /// + /// The keys which are stored inside the licenses from the starting block on + /// have to be private keys. + /// + /// # Arguments + /// + /// `starting_block`: The index of the first block for the key computation. + /// `first_key`: The starting private key (the key of a parent block or the + /// root private key). + /// + /// # Panics + /// + /// Panics if `starting_block` is not a valid license block index. + pub fn derive_private_key( + &self, starting_block: usize, first_key: EccKeyPrivEd25519, + ) -> Result { + let mut res = first_key; + let mut offset = 1; + for (i, l) in self.blocks.iter().enumerate() { + if i >= starting_block { + res = l.derive_private_key(&self.data[offset..offset + l.len], &res)?; + } + offset += l.len; + } + Ok(res) + } + + pub fn build(mut self, f: F) -> Result { + let len = self.data.len(); + + f(LicenseBuilder { licenses: &mut self }); + + // Parse new blocks + let now = OffsetDateTime::now_utc(); + let mut offset = len; + let mut bounds = self + .blocks + .last() + .map(|b| { + let b_offset = len - b.len; + let b_data = &self.data[b_offset..len]; + Ok((b.get_not_valid_before(b_data)?, b.get_not_valid_after(b_data)?)) + }) + .transpose()?; + + while self.data.len() > offset { + if self.blocks.len() >= 8 { + // Accept only 8 blocks + return Err(Error::TooManyBlocks(self.blocks.len())); + } + + // Read next license + let (license, b) = Self::parse_block(&self.data[offset..], false, now, bounds)?; + offset += license.len; + bounds = Some(b); + + self.blocks.push(license); + } + + Ok(self) + } + + pub fn is_valid(&self) -> Result<()> { + let mut offset = 1; + for b in &self.blocks { + b.is_valid(&self.data[offset..offset + b.len])?; + offset += b.len; + } + Ok(()) + } +} + +impl Default for Licenses { + fn default() -> Self { Self { data: vec![1], blocks: Default::default() } } +} + +impl fmt::Debug for Licenses { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Licenses ")?; + let mut offset = 1; + f.debug_list() + .entries(self.blocks.iter().map(|b| { + let o = offset; + offset += b.len; + DebugLicense(b, &self.data[o..o + b.len]) + })) + .finish()?; + Ok(()) + } +} + +impl License { + /// Parse license and return read length. + pub fn parse(data: &[u8]) -> Result { + let len = data.len(); + if data.len() < BLOCK_MIN_LEN { + return Err(Error::TooShort(len, "less than minimum block length")); + } + if data[0] != 0 { + return Err(Error::WrongKeyKind(data[0])); + } + + let typ_i = data[BLOCK_TYPE_OFFSET]; + let typ = LicenseBlockType::from_u8(typ_i).ok_or(Error::UnknownBlockType(typ_i))?; + let data = &data[BLOCK_MIN_LEN..]; + let (inner, extra_len) = match typ { + LicenseBlockType::Intermediate => { + if data.len() < 5 { + return Err(Error::TooShort( + len, + "less than minimum length of intermediate license", + )); + } + // 4 byte unknown + // Issuer string + + let len = if let Some(len) = data[4..].iter().position(|&b| b == 0) { + len + } else { + return Err(Error::NonterminatedString); + }; + (InnerLicense::Other, 5 + len) + } + LicenseBlockType::Server => { + if data.len() < 6 { + return Err(Error::TooShort( + len, + "less than minimum length of TS3 server license", + )); + } + // 1 byte server license type + // 4 byte max clients + // Issuer string + let len = if let Some(len) = data[5..].iter().position(|&b| b == 0) { + len + } else { + return Err(Error::NonterminatedString); + }; + + (InnerLicense::Other, 6 + len) + } + LicenseBlockType::Ts5Server => { + if data.len() < 2 { + return Err(Error::TooShort( + len, + "less than minimum length of TS5 server license", + )); + } + // 1 byte server license type + // Property count and properties + let property_count = data[1]; + let mut pos = 2; + + let properties = (0..property_count) + .map(|_| { + let p = pos - 2; + if pos >= data.len() { + return Err(Error::TooShort(len, "missing TS5 license property")); + } + let len = usize::from(data[pos]); + pos += 1; + if pos + len >= data.len() { + return Err(Error::TooShort(len, "cut off TS5 license property")); + } + pos += len; + Ok(p) + }) + .collect::>()?; + + (InnerLicense::Ts5Server { properties }, pos) + } + LicenseBlockType::Ephemeral => (InnerLicense::Other, 0), + _ => { + return Err(Error::UnknownBlockType(typ_i)); + } + }; + + Ok(License { len: BLOCK_MIN_LEN + extra_len, private_key: None, inner }) + } + + pub fn get_type(&self, data: &[u8]) -> Result { + let typ_i = data[BLOCK_TYPE_OFFSET]; + LicenseBlockType::from_u8(typ_i).ok_or(Error::UnknownBlockType(typ_i)) + } + + pub fn get_public_key(&self, data: &[u8]) -> Result { + let k = EccKeyPubEd25519::from_bytes(data[1..33].try_into().unwrap()); + k.0.decompress().ok_or(Error::InvalidPublicKey) + } + + fn get_timestamp(&self, data: &[u8], block_offset: usize) -> Result { + let num: u32 = (&data[block_offset..]).read_be().map_err(Error::Deserialize)?; + OffsetDateTime::from_unix_timestamp(i64::from(num) + TIMESTAMP_OFFSET) + .map_err(Error::DeserializeDate) + } + + pub fn get_not_valid_before(&self, data: &[u8]) -> Result { + self.get_timestamp(data, BLOCK_NOT_VALID_BEFORE_OFFSET) + } + + pub fn get_not_valid_after(&self, data: &[u8]) -> Result { + self.get_timestamp(data, BLOCK_NOT_VALID_AFTER_OFFSET) + } + + pub fn get_license_type(&self, data: &[u8]) -> Result { + if ![LicenseBlockType::Server, LicenseBlockType::Ts5Server].contains(&self.get_type(data)?) + { + return Err(Error::NoSuchProperty("license type")); + } + LicenseType::from_u8(data[BLOCK_MIN_LEN]) + .ok_or(Error::UnknownLicenseType(data[BLOCK_MIN_LEN])) + } + + pub fn get_issuer<'a>(&self, data: &'a [u8]) -> Result<&'a str> { + let typ = self.get_type(data)?; + + if typ == LicenseBlockType::Ts5Server { + // Search in properties + let res = self + .get_properties(data)? + .find_map(|p| if let Ok(LicenseProperty::Issuer(i)) = p { Some(i) } else { None }) + .ok_or(Error::NoSuchProperty("issuer")); + return res; + } + + let offset = BLOCK_MIN_LEN + + match typ { + LicenseBlockType::Intermediate => 4, + LicenseBlockType::Website | LicenseBlockType::Code => 0, + LicenseBlockType::Server => 5, + _ => return Err(Error::NoSuchProperty("issuer")), + }; + let len = match typ { + LicenseBlockType::Intermediate + | LicenseBlockType::Website + | LicenseBlockType::Code + | LicenseBlockType::Server => self.len - offset - 1, + _ => return Err(Error::NoSuchProperty("issuer")), + }; + str::from_utf8(&data[offset..offset + len]).map_err(Error::DeserializeString) + } + + pub fn get_max_clients(&self, data: &[u8]) -> Result { + let typ = self.get_type(data)?; + + if typ == LicenseBlockType::Ts5Server { + // Search in properties + let res = self + .get_properties(data)? + .find_map( + |p| if let Ok(LicenseProperty::MaxClients(i)) = p { Some(i) } else { None }, + ) + .ok_or(Error::NoSuchProperty("max clients")); + return res; + } + + let offset = BLOCK_MIN_LEN + + match typ { + LicenseBlockType::Intermediate => 0, + LicenseBlockType::Server => 1, + _ => return Err(Error::NoSuchProperty("max clients")), + }; + (&data[offset..offset + 4]).read_be().map_err(Error::Deserialize) + } + + pub fn get_properties<'a: 'b, 'b>( + &'b self, data: &'a [u8], + ) -> Result>> + 'b> { + if let InnerLicense::Ts5Server { properties } = &self.inner { + Ok(properties.iter().map(move |p| { + let o = BLOCK_MIN_LEN + 2 + p; + let len = data[o]; + let len_usize = len as usize; + let id = data[o + 1]; + let typ = data[o + 2]; + + // Check length + if let Some(expected) = match typ { + // String, check that it is null-terminated + 0 => { + if data[o + len_usize] != 0 { + return Err(Error::NonterminatedString); + } + None + } + 1 | 3 => Some(4), + 2 | 4 => Some(8), + _ => None, + } { + if len != expected { + return Err(Error::WrongPropertyLength { id, typ, expected, actual: len }); + } + } + + match id { + 1 => { + if typ != 1 { + return Err(Error::WrongPropertyType { id, expected: 1, actual: typ }); + } + Ok(LicenseProperty::Unknown1( + (&data[o + 3..o + 3 + 4]).read_be().map_err(Error::Deserialize)?, + )) + } + 2 => { + if typ != 0 { + return Err(Error::WrongPropertyType { id, expected: 0, actual: typ }); + } + let s = str::from_utf8(&data[o + 3..o + len_usize]) + .map_err(Error::DeserializeString)?; + Ok(LicenseProperty::Issuer(s)) + } + 3 => { + if typ != 1 { + return Err(Error::WrongPropertyType { id, expected: 1, actual: typ }); + } + Ok(LicenseProperty::MaxClients( + (&data[o + 3..o + 3 + 4]).read_be().map_err(Error::Deserialize)?, + )) + } + _ => { + Ok(LicenseProperty::Unknown { id, typ, data: &data[o + 3..o + len_usize] }) + } + } + })) + } else { + Err(Error::NoSuchProperty("properties")) + } + } + + /// Get the private key from the hash of this license block. + pub fn get_hash_key(&self, data: &[u8]) -> Scalar { + // Make a valid private key from the hash + let mut hash_key = Sha512::digest(&data[1..]); + hash_key[0] &= 248; + hash_key[31] &= 63; + hash_key[31] |= 64; + Scalar::from_bytes_mod_order(hash_key.as_slice()[..32].try_into().unwrap()) + } + + pub fn derive_public_key( + &self, data: &[u8], parent_key: &EdwardsPoint, + ) -> Result { + let pub_key = self.get_public_key(data)?; + let hash_key = self.get_hash_key(data); + Ok(pub_key * hash_key + parent_key) + } + + /// Derive the private key of this license block. + /// + /// The key which is stored inside this license has to be a private key. + /// + /// # Arguments + /// + /// `parent_key`: The resulting private key of the previous block. + pub fn derive_private_key( + &self, data: &[u8], parent_key: &EccKeyPrivEd25519, + ) -> Result { + let priv_key = if let Some(k) = &self.private_key { + &k.0 + } else { + return Err(Error::NoPrivateKey); + }; + let hash_key = self.get_hash_key(data); + Ok(EccKeyPrivEd25519(priv_key * hash_key + parent_key.0)) + } + + /// Check if this is a valid license. + /// + /// Does some sanity checking on fields. Does not need to be called for correctness. + pub fn is_valid(&self, data: &[u8]) -> Result<()> { + self.get_public_key(data)?; + self.get_not_valid_before(data)?; + self.get_not_valid_after(data)?; + + if let Err(e) = self.get_license_type(data) { + if !matches!(e, Error::NoSuchProperty(_)) { + return Err(e); + } + } + + if let Err(e) = self.get_issuer(data) { + if !matches!(e, Error::NoSuchProperty(_)) { + return Err(e); + } + } + + match self.get_properties(data) { + Ok(ps) => { + for p in ps { + p?; + } + } + Err(e) => { + if !matches!(e, Error::NoSuchProperty(_)) { + return Err(e); + } + } + } + + Ok(()) + } +} + +impl fmt::Debug for DebugLicense<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let from = self + .0 + .get_not_valid_before(self.1) + .ok() + .and_then(|d| d.format(&Rfc3339).ok()) + .unwrap_or_else(|| "error".to_string()); + let to = self + .0 + .get_not_valid_after(self.1) + .ok() + .and_then(|d| d.format(&Rfc3339).ok()) + .unwrap_or_else(|| "error".to_string()); + + let mut d = f.debug_struct("License"); + let typ = self.0.get_type(self.1).unwrap(); + d.field("type", &typ); + if let Some(key) = &self.0.private_key { + d.field("private_key", key); + } + d.field("not_valid_before", &from).field("not_valid_after", &to); + + match typ { + LicenseBlockType::Intermediate => { + if let Ok(num) = self.0.get_max_clients(self.1) { + d.field("data", &num); + } else { + d.field("data", &"error"); + } + } + LicenseBlockType::Website | LicenseBlockType::Code => { + if let Ok(issuer) = self.0.get_issuer(self.1) { + d.field("issuer", &issuer); + } else { + d.field("issuer", &"error"); + } + } + LicenseBlockType::Server => { + if let Ok(license_type) = self.0.get_license_type(self.1) { + d.field("license_type", &license_type); + } else { + d.field("license_type", &"error"); + } + if let Ok(issuer) = self.0.get_issuer(self.1) { + d.field("issuer", &issuer); + } else { + d.field("issuer", &"error"); + } + if let Ok(max_clients) = self.0.get_max_clients(self.1) { + d.field("max_clients", &max_clients); + } else { + d.field("max_clients", &"error"); + } + } + LicenseBlockType::Ts5Server => { + if let Ok(props) = + self.0.get_properties(self.1).and_then(|ps| ps.collect::>>()) + { + d.field("properties", &props); + } else { + d.field("properties", &"error"); + } + } + LicenseBlockType::Ephemeral => {} + } + + d.finish()?; + + Ok(()) + } +} + +impl LicenseBlockType { + fn min_len(&self) -> usize { + BLOCK_MIN_LEN + + match self { + Self::Intermediate => 5, + Self::Website | Self::Code => 1, + Self::Server => 6, + Self::Ts5Server => 2, + Self::Ephemeral => 0, + } + } +} + +impl<'a> LicenseBuilder<'a> { + pub fn add_block<'b>(&'b mut self, typ: LicenseBlockType) -> LicenseBlockBuilder<'a, 'b> { + let len = self.licenses.data.len(); + self.licenses.data.resize(len + typ.min_len(), 0); + self.licenses.data[len + BLOCK_TYPE_OFFSET] = typ.to_u8().unwrap(); + LicenseBlockBuilder { builder: self, offset: len, typ } + } +} + +impl LicenseBlockBuilder<'_, '_> { + pub fn public_key(&mut self, key: &EccKeyPubEd25519) -> &mut Self { + let o = self.offset + 1; + self.builder.licenses.data[o..o + 32].copy_from_slice(&key.0.0); + self + } + + fn write_timestamp(&mut self, offset: usize, time: OffsetDateTime) -> &mut Self { + let o = self.offset + offset; + Cursor::new(&mut self.builder.licenses.data[o..o + 4]) + .write_be((time.unix_timestamp() - TIMESTAMP_OFFSET) as u32) + .unwrap(); + self + } + + pub fn not_valid_before(&mut self, time: OffsetDateTime) -> &mut Self { + self.write_timestamp(BLOCK_NOT_VALID_BEFORE_OFFSET, time) + } + + pub fn not_valid_after(&mut self, time: OffsetDateTime) -> &mut Self { + self.write_timestamp(BLOCK_NOT_VALID_AFTER_OFFSET, time) + } + + /// Only valid for Server and Ts5Server license types + pub fn server_license_type(&mut self, typ: LicenseType) -> &mut Self { + if ![LicenseBlockType::Server, LicenseBlockType::Ts5Server].contains(&self.typ) { + panic!( + "Setting the license type is only allowed for Server and Ts5Server license types, \ + but this is a {:?}", + self.typ + ); + } + self.builder.licenses.data[self.offset + BLOCK_MIN_LEN] = typ.to_u8().unwrap(); + self + } + + /// Add a property in a TS5 license block. + /// + /// `len` is the length of the content, excluding id, type and length field. + /// Return the byte offset to where the contents of the property starts. + fn ts5_add_property(&mut self, id: u8, typ: u8, len: usize) -> usize { + let o = self.builder.licenses.data.len(); + self.builder.licenses.data.resize(o + len + 3, 0); + // Increment property count + self.builder.licenses.data[self.offset + BLOCK_MIN_LEN + 1] += 1; + self.builder.licenses.data[o] = u8::try_from(len).unwrap() + 2; + self.builder.licenses.data[o + 1] = id; + self.builder.licenses.data[o + 2] = typ; + o + 3 + } + + /// Only valid for Intermediate, Server and Ts5Server license types + pub fn max_clients(&mut self, max_clients: u32) -> &mut Self { + let o = if self.typ == LicenseBlockType::Ts5Server { + self.ts5_add_property(3, 1, 4) + } else { + self.offset + + BLOCK_MIN_LEN + + match self.typ { + LicenseBlockType::Intermediate => 0, + LicenseBlockType::Server => 1, + _ => panic!( + "Setting max clients is only allowed for Intermediate, Server and \ + Ts5Server license types, but this is a {:?}", + self.typ + ), + } + }; + Cursor::new(&mut self.builder.licenses.data[o..o + 4]).write_be(max_clients).unwrap(); + self + } + + /// Only valid for Intermediate, Server and Ts5Server license types + pub fn issuer(&mut self, issuer: &str) -> &mut Self { + // Check that the issuer does not contain null bytes + assert!( + !issuer.contains('\0'), + "The issuer is written as a null-terminated string so it cannot contain null bytes" + ); + + let o = if self.typ == LicenseBlockType::Ts5Server { + self.ts5_add_property(2, 0, issuer.len() + 1) + } else { + if ![LicenseBlockType::Intermediate, LicenseBlockType::Server].contains(&self.typ) { + panic!( + "Setting the issuer is only allowed for Intermediate, Server and Ts5Server \ + license types, but this is a {:?}", + self.typ + ); + } + // Check that no issuer was written so far + assert!( + self.builder.licenses.data.len() - self.offset == self.typ.min_len(), + "Only a single issuer can be written into a license block" + ); + let o = self.builder.licenses.data.len(); + self.builder.licenses.data.resize(o + issuer.len(), 0); + o - 1 + }; + self.builder.licenses.data[o..o + issuer.len()].copy_from_slice(issuer.as_bytes()); + self + } +} + +#[cfg(test)] +mod tests { + use super::*; + use base64::prelude::*; + + #[test] + fn parse_standard_license() { + Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQA1hUFJiiSs0wFXkYuPUJVcDa6XCrZTcsvkB0\ + Ffzz4CmwIITRXgCqeTYAcAAAAgQW5vbnltb3VzAACiIBip9hQaK6P3QhwOJs/BkPn0i\ + oyIDPaNgzJ6M8x0kiAJf4hxCYAxMQ==").unwrap()).unwrap(); + } + + #[test] + fn parse_standard_license_expired() { + assert!(Licenses::parse(BASE64_STANDARD.decode("AQA1hUFJiiSs0wFXkYuPUJVcDa6XCrZTcsvkB0\ + Ffzz4CmwIITRXgCqeTYAcAAAAgQW5vbnltb3VzAACiIBip9hQaK6P3QhwOJs/BkPn0i\ + oyIDPaNgzJ6M8x0kiAJf4hxCYAxMQ==").unwrap()).is_err()); + } + + #[test] + fn parse_aal_license() { + Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQCvbHFTQDY/terPeilrp/ECU9xCH5U3xC92lY\ + TNaY/0KQAJFueAazbsgAAAACVUZWFtU3BlYWsgU3lzdGVtcyBHbWJIAABhl9gwla/UJ\ + p2Eszst9TRVXO/PeE6a6d+CTI6Pg7OEVgAJc5CrL4Nh8gAAACRUZWFtU3BlYWsgc3lz\ + dGVtcyBHbWJIAACvTQIgpv6zmLZq3znh7ygmOSokGFkFjz4bTigrOnetrgIJdIIACdS\ + /gAYAAAAAU29zc2VuU3lzdGVtcy5iaWQAADY7+uV1CQ1niOvYSdGzsu83kPTNWijovr\ + 3B78eHGeePIAm98vQJvpu0").unwrap()).unwrap(); + } + + #[test] + fn parse_ts5_server_license_long() { + // Slightly older format having a block with a Ts5 license block in it + Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQDVsMGbcrMmGif1vSXPWWXNW2CB5\ + Fe9oZ/2uxP29j1EXQAQSfiAazbsgAAAASVUZWFtU3BlYWsgU3lzdGVtcyBHbWJIAAALB6Qfbe\ + JyN+9foJhe+/KPFwyU+i++4MAA0q1/WCnizwARRuEPN1aeBQAAASBUZWFtU3BlYWsgc3lzdGV\ + tcyBHbWJIAADrhbI5gUR3thsS7FqKV5P5h7djnwMSJfF2vi58lm1VcwgRUFMAE0P7gAUCGQIA\ + VGVhbVNwZWFrIFN5c3RlbXMgR21iSAAGAwEAAAAFAAf2KhQ7WLjOvwwY0Bi7LxAcWmQeT+LQt\ + uaOzjhYoA+YIBGNq1kRjlQZ").unwrap()).unwrap(); + } + + #[test] + fn parse_ts5_server_license_long2() { + // Also slightly older, has 3 properties + Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQDVsMGbcrMmGif1vSXPWWXNW2CB5\ + Fe9oZ/2uxP29j1EXQAQSfiAazbsgAAAASVUZWFtU3BlYWsgU3lzdGVtcyBHbWJIAAAtXG5p2n\ + iXlDfpVAGuD88w8hetKYL4vqHRkB5xB8ASRwAR2t/MN+ttjAAAASBUZWFtU3BlYWsgc3lzdGV\ + tcyBHbWJIAAAdZYGtwkeZFhzqnoV1uk+Tcphe8GgcqiPVtELF9y4wOAgR4qmAF4jnAAkDGQIA\ + VGVhbVNwZWFrIFN5c3RlbXMgR21iSAAGAwEAAAAFBgEBAAGGoADzyFvD+9G6uhIxmh0jK+Uo8\ + z8fYGJVH81vWFULDS0l8yATKe4cEyqW3A==").unwrap()).unwrap(); + } + + #[test] + fn parse_ts5_server_license_single_block_with_issuer() { + Licenses::parse_ignore_expired( + BASE64_STANDARD + .decode( + "AQBgjAAqtcBUrw5futTtkl3+EM3OW4Lal6OTPlwuv4xV/\ + gIRFlEAG0NlAAcAAAAgQW5vbnltb3VzAACKNY+/\ + 9qCbonCSxG18vBb7y7zPIgDdjTmcZoAHHclnJSATPa69Ez5XfQ==", + ) + .unwrap(), + ) + .unwrap(); + } + + #[test] + fn parse_ts5_server_license_single_block() { + // Only a single server block and the ephemeral block + Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQAuio9ZxThXKE+hmzQyzBRedysp9\ + 79JBTv2xP3s2oCkiAgQI70AE+YkAAcBBgMBAAAABQBoazM313063zaipPTH06zrXc91ch3huB\ + YrUET9sEbz1CATKgK8EyqrfA==").unwrap()).unwrap(); + } + + #[test] + fn derive_public_key() { + let licenses = Licenses::parse_ignore_expired(BASE64_STANDARD.decode("AQA1hUFJiiSs0wFXkYuPUJVcDa6XCrZTcsvkB0Ffzz4CmwIITRXgCqeTYAcAAAAgQW5vbnltb3VzAAC4R+5mos+UQ/KCbkpQLMI5WRp4wkQu8e5PZY4zU+/FlyAJwaE8CcJJ/A==").unwrap()).unwrap(); + let derived_key = + licenses.derive_public_key(EccKeyPubEd25519::from_bytes(crate::ROOT_KEY)).unwrap(); + + let expected_key = [ + 0x40, 0xe9, 0x50, 0xc4, 0x61, 0xba, 0x18, 0x3a, 0x1e, 0xb7, 0xcb, 0xb1, 0x9a, 0xc3, + 0xd8, 0xd9, 0xc4, 0xd5, 0x24, 0xdb, 0x38, 0xf7, 0x2d, 0x3d, 0x66, 0x75, 0x77, 0x2a, + 0xc5, 0x9c, 0xc5, 0xc6, + ]; + let derived_key = derived_key.compress().0; + assert_eq!(derived_key, expected_key); + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/log.rs b/native/vendor/tsclientlib/tsproto/src/log.rs new file mode 100644 index 0000000..18aadab --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/log.rs @@ -0,0 +1,111 @@ +use std::fmt::Debug; +use std::str; + +use tracing::{debug, debug_span, Span}; +use tsproto_packets::packets::{InUdpPacket, OutUdpPacket, PacketType}; +use tsproto_packets::HexSlice; + +use crate::connection::{Connection, Event}; + +fn prepare_span(is_client: bool, incoming: bool) -> Span { + let dir = if incoming { + if !cfg!(windows) { "\x1b[1;32mIN\x1b[0m" } else { "IN" } + } else if !cfg!(windows) { + "\x1b[1;31mOUT\x1b[0m" + } else { + "OUT" + }; + let to = if is_client { "S" } else { "C" }; + debug_span!("packet", to, %dir) +} + +pub fn log_udp_packet(is_client: bool, incoming: bool, packet: &InUdpPacket) { + let _span = prepare_span(is_client, incoming).entered(); + debug!(header = ?packet.0.header(), content = %HexSlice(packet.0.content()), "UdpPacket"); +} + +pub fn log_out_udp_packet(is_client: bool, incoming: bool, packet: &OutUdpPacket) { + let _span = prepare_span(is_client, incoming).entered(); + debug!( + generation = packet.generation_id(), + header = ?packet.data().header(), + content = %HexSlice(packet.data().content()), + "UdpPacket" + ); +} + +pub fn log_packet(is_client: bool, incoming: bool, packet: &P) { + // packet.header.c_id is not set for newly created packets so we cannot + // detect if a packet is incoming or not. + let _span = prepare_span(is_client, incoming).entered(); + debug!(content = ?packet, "Packet"); +} + +pub fn log_command(is_client: bool, incoming: bool, p_type: PacketType, cmd: &str) { + // packet.header.c_id is not set for newly created packets so we cannot + // detect if a packet is incoming or not. + let _span = prepare_span(is_client, incoming).entered(); + if p_type == PacketType::Command { + debug!(content = cmd, "Command"); + } else { + debug!(content = cmd, "CommandLow"); + } +} + +/// Print the content of all packets +/// +/// 0 - Print commands +/// 1 - Print packets +/// 2 - Print udp packets +pub fn add_logger_with_verbosity(verbosity: u8, con: &mut Connection) { + let log_commands = verbosity > 0; + let log_packets = verbosity > 1; + let log_udp_packets = verbosity > 2; + add_logger(log_commands, log_packets, log_udp_packets, con); +} + +pub fn add_logger( + log_commands: bool, log_packets: bool, log_udp_packets: bool, con: &mut Connection, +) { + if log_commands || log_packets || log_udp_packets { + let is_client = con.is_client; + let listener = Box::new(move |event: &Event| match event { + Event::ReceiveUdpPacket(packet) => { + if log_udp_packets { + log_udp_packet(is_client, true, packet); + } + } + Event::ReceivePacket(packet) => { + if log_packets { + log_packet(is_client, true, packet); + } else if log_commands { + let p_type = packet.header().packet_type(); + if p_type.is_command() { + if let Ok(s) = str::from_utf8(packet.content()) { + log_command(is_client, true, p_type, s); + } + } + } + } + Event::SendUdpPacket(packet) => { + if log_udp_packets { + log_out_udp_packet(is_client, false, packet); + } + } + Event::SendPacket(packet) => { + if log_packets { + log_packet(is_client, false, &packet.packet()); + } else if log_commands { + let p_type = packet.header().packet_type(); + if p_type.is_command() { + if let Ok(s) = str::from_utf8(packet.content()) { + log_command(is_client, false, p_type, s); + } + } + } + } + }); + + con.event_listeners.push(listener); + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/packet_codec.rs b/native/vendor/tsclientlib/tsproto/src/packet_codec.rs new file mode 100644 index 0000000..a77acf6 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/packet_codec.rs @@ -0,0 +1,518 @@ +use std::io::Cursor; +use std::task::Context; + +use num_traits::ToPrimitive; +use omnom::WriteExt; +use tracing::warn; +use tsproto_packets::packets::*; + +use crate::algorithms as algs; +use crate::connection::{Connection, Event, StreamItem}; +use crate::resend::{PartialPacketId, Resender}; +use crate::{Error, Result, MAX_FRAGMENTS_LENGTH, MAX_QUEUE_LEN}; + +/// Encodes outgoing packets. +/// +/// This part does the compression, encryption and fragmentation. +#[derive(Clone, Debug, Default)] +pub struct PacketCodec { + /// The next packet id that should be sent. + /// + /// This list is indexed by the `PacketType`, `PacketType::Init` is an + /// invalid index. + pub outgoing_p_ids: [PartialPacketId; 8], + /// Used for incoming out-of-order packets. + /// + /// Only used for `Command` and `CommandLow` packets. + pub receive_queue: [Vec>; 2], + /// Used for incoming fragmented packets. + /// + /// Contains the accumulated data from fragmented packets, the header of the + /// first packet is at the beginning, all other headers are stripped away. + /// Only used for `Command` and `CommandLow` packets. + pub fragmented_queue: [Option>; 2], + /// The next packet id that is expected. + /// + /// Works like the `outgoing_p_ids`. + pub incoming_p_ids: [PartialPacketId; 8], +} + +impl PacketCodec { + /// Handle a packet for a specific connection. + /// + /// This part does the defragmentation, decryption and decompression. + pub fn handle_udp_packet( + con: &mut Connection, cx: &mut Context, mut packet_data: Vec, + ) -> Result<()> { + let mut ack = false; + + let dir = if con.is_client { Direction::S2C } else { Direction::C2S }; + let packet = InPacket::new(dir, &packet_data); + let p_type = packet.header().packet_type(); + let type_i = p_type.to_usize().unwrap(); + let id = packet.header().packet_id(); + let (in_recv_win, gen_id, cur_next, limit) = con.in_receive_window(p_type, id); + + con.resender.handle_loss_incoming(&packet, in_recv_win, cur_next); + + if let Some(params) = &con.params { + if p_type == PacketType::Init { + con.stream_items.push_back(StreamItem::Error(Error::UnexpectedInitPacket)); + return Ok(()); + } + if !con.is_client { + let c_id = packet.header().client_id().unwrap(); + // Accept any client id for the first few acks + let is_first_ack = gen_id == 0 && id <= 3 && p_type == PacketType::Ack; + if c_id != params.c_id && !is_first_ack { + con.stream_items.push_back(StreamItem::Error(Error::WrongClientId(c_id))); + return Ok(()); + } + } + } + + // Ignore range for acks and audio packets + if [PacketType::Ack, PacketType::AckLow, PacketType::Voice, PacketType::VoiceWhisper] + .contains(&p_type) + || in_recv_win + { + if !packet.header().flags().contains(Flags::UNENCRYPTED) { + if p_type == PacketType::Ack && id == 1 && con.is_client { + // This is the ack packet for the clientinit, we take the + // initserver as ack instead. + return Ok(()); + } + + // If it is the first ack packet of a client, try to fake + // decrypt it. + let new_content = if (p_type == PacketType::Ack && id <= 1 && con.is_client) + || con.params.is_none() + { + match algs::decrypt_fake(&packet).or_else(|_| { + if let Some(params) = &mut con.params { + // Decrypt the packet + algs::decrypt(&packet, gen_id, ¶ms.shared_iv, &mut params.key_cache) + } else { + // Failed to fake decrypt the packet + Err(Error::WrongMac { p_type, generation_id: gen_id, packet_id: id }) + } + }) { + Ok(r) => r, + Err(e) => { + con.stream_items.push_back(StreamItem::Error(e)); + return Ok(()); + } + } + } else if let Some(params) = &mut con.params { + // Decrypt the packet + match algs::decrypt(&packet, gen_id, ¶ms.shared_iv, &mut params.key_cache) { + Ok(r) => r, + Err(e) => { + con.stream_items.push_back(StreamItem::Error(e)); + return Ok(()); + } + } + } else { + // Failed to fake decrypt the packet + con.stream_items.push_back(StreamItem::Error(Error::WrongMac { + p_type, + generation_id: gen_id, + packet_id: id, + })); + return Ok(()); + }; + + let start = packet.header().data().len(); + packet_data[start..].copy_from_slice(&new_content); + } else if algs::must_encrypt(p_type) { + // Check if it is ok for the packet to be unencrypted + con.stream_items.push_back(StreamItem::Error(Error::UnallowedUnencryptedPacket)); + return Ok(()); + } + + let packet = InPacket::new(dir, &packet_data); + match p_type { + PacketType::Command | PacketType::CommandLow => { + ack = true; + + let commands = Self::handle_command_packet(con, packet_data)?; + + // Be careful with command packets, they are guaranteed to + // be in the right order now. + for c in commands { + // Send again + let packet = InPacket::new(dir, &c); + let event = Event::ReceivePacket(&packet); + con.send_event(&event); + + let item = match InCommandBuf::try_new(dir, c) { + Ok(c) => { + // initivexpand2 is the ack for the last init packet + if con.is_client + && c.data().packet().content().starts_with(b"initivexpand2 ") + { + Resender::ack_packet(con, cx, PacketType::Init, 4); + } else if con.is_client + && c.data().packet().content().starts_with(b"initserver ") + { + // initserver acks clientinit + Resender::ack_packet(con, cx, PacketType::Command, 2); + } else if !con.is_client + && c.data().packet().content().starts_with(b"clientek ") + { + // clientek acks initivexpand2 + Resender::ack_packet(con, cx, PacketType::Command, 0); + } + StreamItem::Command(c) + } + Err(e) => return Err(Error::PacketParse("command", e)), + }; + con.stream_items.push_back(item); + } + } + _ => { + if p_type == PacketType::Ping { + ack = true; + } + // Update packet ids + let in_ids = &mut con.codec.incoming_p_ids; + if p_type != PacketType::Init { + let (id, next_gen) = id.overflowing_add(1); + let generation_id = if next_gen { gen_id + 1 } else { gen_id }; + in_ids[type_i] = PartialPacketId { generation_id, packet_id: id }; + } + + match packet.ack_packet() { + Ok(Some(ack_id)) => { + // Remove command packet from send queue if the fitting ack is received. + let p_type = if p_type == PacketType::Ack { + PacketType::Command + } else if p_type == PacketType::AckLow { + PacketType::CommandLow + } else if p_type == PacketType::Pong { + PacketType::Ping + } else { + p_type + }; + Resender::ack_packet(con, cx, p_type, ack_id); + } + Ok(None) => {} + Err(e) => { + con.stream_items.push_back(StreamItem::Error(Error::CreateAck(e))); + return Ok(()); + } + } + + // Send event after handling acks + let event = Event::ReceivePacket(&packet); + con.send_event(&event); + + if p_type.is_voice() { + con.stream_items.push_back(match InAudioBuf::try_new(dir, packet_data) { + Ok(r) => StreamItem::Audio(r), + Err(e) => StreamItem::Error(Error::PacketParse("audio", e)), + }); + } else if p_type == PacketType::Init { + con.stream_items.push_back(if con.is_client { + match InS2CInitBuf::try_new(dir, packet_data) { + Ok(r) => StreamItem::S2CInit(r), + Err(e) => StreamItem::Error(Error::PacketParse("s2cinit", e)), + } + } else { + match InC2SInitBuf::try_new(dir, packet_data) { + Ok(r) => StreamItem::C2SInit(r), + Err(e) => StreamItem::Error(Error::PacketParse("c2sinit", e)), + } + }); + } + } + } + } else { + // Send an ack for the case when it was lost + if p_type == PacketType::Command || p_type == PacketType::CommandLow { + ack = true; + con.resender.handle_loss_resend_ack(); + } + con.stream_items.push_back(StreamItem::Error(Error::NotInReceiveWindow { + id, + next: cur_next, + limit, + p_type, + })); + } + + // Send ack + if ack { + con.send_ack_packet(cx, OutAck::new(dir.reverse(), p_type, id))?; + } + + Ok(()) + } + + /// Handle `Command` and `CommandLow` packets. + /// + /// They have to be handled in the right order. + fn handle_command_packet( + con: &mut Connection, mut packet_data: Vec, + ) -> Result>> { + let dir = if con.is_client { Direction::S2C } else { Direction::C2S }; + let mut packet = InPacket::new(dir, &packet_data); + let header = packet.header(); + let p_type = header.packet_type(); + let mut id = header.packet_id(); + let type_i = p_type.to_usize().unwrap(); + let cmd_i = if p_type == PacketType::Command { 0 } else { 1 }; + let r_queue = &mut con.codec.receive_queue[cmd_i]; + let frag_queue = &mut con.codec.fragmented_queue[cmd_i]; + let in_ids = &mut con.codec.incoming_p_ids[type_i]; + let cur_next = in_ids.packet_id; + if cur_next == id { + // In order + let mut packets = Vec::new(); + loop { + // Update next packet id + *in_ids = *in_ids + 1; + + let flags = packet.header().flags(); + let res_packet = if flags.contains(Flags::FRAGMENTED) { + if let Some(mut frag_queue) = frag_queue.take() { + // Last fragmented packet + frag_queue.extend_from_slice(packet.content()); + let header = InPacket::new(dir, &frag_queue); + // Decompress + if header.header().flags().contains(Flags::COMPRESSED) { + let decompressed = quicklz::decompress( + &mut Cursor::new(header.content()), + crate::MAX_DECOMPRESSED_SIZE, + ) + .map_err(Error::DecompressPacket)?; + let start = header.header().data().len(); + frag_queue.truncate(start); + frag_queue.extend_from_slice(&decompressed); + } + + Some(frag_queue) + } else { + // Enqueue + *frag_queue = Some(packet_data); + None + } + } else if let Some(frag_queue) = frag_queue { + // The packet is fragmented + if frag_queue.len() < MAX_FRAGMENTS_LENGTH { + frag_queue.extend_from_slice(packet.content()); + None + } else { + return Err(Error::MaxLengthExceeded("fragment queue")); + } + } else { + // Decompress + if flags.contains(Flags::COMPRESSED) { + let decompressed = quicklz::decompress( + &mut Cursor::new(packet.content()), + crate::MAX_DECOMPRESSED_SIZE, + ) + .map_err(Error::DecompressPacket)?; + let start = packet.header().data().len(); + packet_data.truncate(start); + packet_data.extend_from_slice(&decompressed); + }; + Some(packet_data) + }; + if let Some(p) = res_packet { + packets.push(p); + } + + // Check if there are following packets in the receive queue. + id = id.wrapping_add(1); + if let Some(pos) = + r_queue.iter().position(|p| InHeader::new(dir, p).packet_id() == id) + { + packet_data = r_queue.remove(pos); + packet = InPacket::new(dir, &packet_data); + } else { + break; + } + } + + Ok(packets) + } else { + // Out of order + warn!(got = id, expected = cur_next, "Out of order command packet"); + let (limit, next_gen) = cur_next.overflowing_add(MAX_QUEUE_LEN); + if (!next_gen && id >= cur_next && id < limit) + || (next_gen && (id >= cur_next || id < limit)) + { + // Retransmissions must not grow the queue or survive as stale duplicates. + if !r_queue.iter().any(|p| InHeader::new(dir, p).packet_id() == id) { + if r_queue.len() >= usize::from(MAX_QUEUE_LEN) { + return Err(Error::MaxLengthExceeded("command queue")); + } + r_queue.push(packet_data); + } + Ok(vec![]) + } else { + Err(Error::MaxLengthExceeded("command queue")) + } + } + } + + pub fn encode_packet(con: &mut Connection, mut packet: OutPacket) -> Result> { + let p_type = packet.header().packet_type(); + let type_i = p_type.to_usize().unwrap(); + + // TODO Needed, commands should set their own flag? + if (p_type == PacketType::Command || p_type == PacketType::CommandLow) && con.is_client { + // Set newprotocol flag + packet.flags(packet.header().flags() | Flags::NEWPROTOCOL); + } + + let p_id = if p_type == PacketType::Init { + PartialPacketId { generation_id: 0, packet_id: 0 } + } else { + con.codec.outgoing_p_ids[type_i] + }; + // We fake encrypt the first command packet of the server (id 0) and the + // first command packet of the client (id 1, clientek). + let mut fake_encrypt = p_type == PacketType::Command + && p_id.generation_id == 0 + && ((!con.is_client && p_id.packet_id == 0) + || (con.is_client && p_id.packet_id == 1 && { + // Test if it is a clientek packet + packet.content().starts_with(b"clientek") + })); + // Also fake encrypt the first ack of the client, which is the response + // for the initivexpand2 packet. + fake_encrypt |= con.is_client + && p_type == PacketType::Ack + && p_id.generation_id == 0 + && p_id.packet_id == 0; + + // Get values from parameters + let should_encrypt; + let c_id; + if let Some(params) = con.params.as_mut() { + should_encrypt = algs::should_encrypt(p_type, params.voice_encryption); + c_id = params.c_id; + } else { + should_encrypt = algs::should_encrypt(p_type, false); + if should_encrypt { + fake_encrypt = true; + } + c_id = 0; + } + + // Client id for clients + if con.is_client { + packet.client_id(c_id); + } + + if !should_encrypt && !fake_encrypt { + packet.flags(packet.header().flags() | Flags::UNENCRYPTED); + if let Some(params) = con.params.as_mut() { + packet.mac().copy_from_slice(¶ms.shared_mac); + } + } + + // Compress and split packet + let packets = if p_type == PacketType::Command || p_type == PacketType::CommandLow { + algs::compress_and_split(con.is_client, packet) + } else { + // Set the inner packet id for voice packets + if con.is_client && (p_type == PacketType::Voice || p_type == PacketType::VoiceWhisper) + { + (&mut packet.content_mut()[..2]) + .write_be(con.codec.outgoing_p_ids[type_i].packet_id) + .unwrap(); + } + + vec![packet] + }; + + let packets = packets + .into_iter() + .map(|mut packet| -> Result<_> { + // Get packet id + let p_id = if p_type == PacketType::Init { + PartialPacketId { generation_id: 0, packet_id: 0 } + } else { + packet.packet_id(con.codec.outgoing_p_ids[type_i].packet_id); + con.codec.outgoing_p_ids[type_i] + }; + + // Encrypt if necessary + if fake_encrypt { + algs::encrypt_fake(&mut packet)?; + } else if should_encrypt { + // The params are set + let params = con.params.as_mut().unwrap(); + algs::encrypt( + &mut packet, + p_id.generation_id, + ¶ms.shared_iv, + &mut params.key_cache, + )?; + } + + // Increment outgoing_p_ids + let p_id = p_id + 1; + if p_type != PacketType::Init { + con.codec.outgoing_p_ids[type_i] = p_id; + } + Ok(OutUdpPacket::new(p_id.generation_id, packet)) + }) + .collect::>>()?; + Ok(packets) + } +} + +#[cfg(test)] +mod reorder_tests { + use super::*; + + fn packet(id: u16, kind: PacketType) -> Vec { + OutPacket::new([0; 8], id, None, Flags::empty(), kind).into_vec() + } + + async fn connection() -> Connection { + let socket = tokio::net::UdpSocket::bind("127.0.0.1:0").await.unwrap(); + Connection::new(true, "127.0.0.1:9987".parse().unwrap(), Box::new(socket)) + } + + #[tokio::test] + async fn burst_waits_for_missing_command_and_drains_in_order() { + let mut con = connection().await; + for id in (1..MAX_QUEUE_LEN).rev() { + assert!(PacketCodec::handle_command_packet(&mut con, packet(id, PacketType::Command)).unwrap().is_empty()); + } + for _ in 0..100 { + PacketCodec::handle_command_packet(&mut con, packet(300, PacketType::Command)).unwrap(); + } + assert_eq!(con.codec.receive_queue[0].len(), usize::from(MAX_QUEUE_LEN - 1)); + assert!(matches!(PacketCodec::handle_command_packet(&mut con, packet(MAX_QUEUE_LEN, PacketType::Command)), Err(Error::MaxLengthExceeded("command queue")))); + let packets = PacketCodec::handle_command_packet(&mut con, packet(0, PacketType::Command)).unwrap(); + assert_eq!(packets.len(), usize::from(MAX_QUEUE_LEN)); + for (id, bytes) in packets.iter().enumerate() { + assert_eq!(InHeader::new(Direction::S2C, bytes).packet_id(), id as u16); + } + assert!(con.codec.receive_queue[0].is_empty()); + } + + #[tokio::test] + async fn reorder_window_wraps_and_command_priorities_remain_independent() { + let mut con = connection().await; + let start = u16::MAX - 100; + con.codec.incoming_p_ids[PacketType::Command as usize].packet_id = start; + for offset in (1..350u16).rev() { + PacketCodec::handle_command_packet(&mut con, packet(start.wrapping_add(offset), PacketType::Command)).unwrap(); + } + PacketCodec::handle_command_packet(&mut con, packet(1, PacketType::CommandLow)).unwrap(); + let packets = PacketCodec::handle_command_packet(&mut con, packet(start, PacketType::Command)).unwrap(); + assert_eq!(packets.len(), 350); + for (offset, bytes) in packets.iter().enumerate() { + assert_eq!(InHeader::new(Direction::S2C, bytes).packet_id(), start.wrapping_add(offset as u16)); + } + assert_eq!(con.codec.receive_queue[1].len(), 1); + assert_eq!(PacketCodec::handle_command_packet(&mut con, packet(0, PacketType::CommandLow)).unwrap().len(), 2); + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/resend.rs b/native/vendor/tsclientlib/tsproto/src/resend.rs new file mode 100644 index 0000000..ba86a33 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/resend.rs @@ -0,0 +1,1067 @@ +use std::cmp::{min, Ord, Ordering}; +use std::collections::{BTreeMap, BinaryHeap}; +use std::convert::From; +use std::fmt; +use std::hash::{Hash, Hasher}; +use std::ops::{Add, Sub}; +use std::pin::Pin; +use std::task::{Context, Poll}; + +use futures::prelude::*; +use num_traits::ToPrimitive; +use pin_project_lite::pin_project; +use tokio::time::{Duration, Instant, Sleep}; +use tracing::{info, trace, warn}; +use tsproto_packets::packets::*; + +use crate::connection::{Connection, StreamItem}; +use crate::{Error, Result, UDP_SINK_CAPACITY}; + +// TODO implement fast retransmit: 2 Acks received but earlier packet not acked -> retransmit +// TODO implement slow start and redo slow start when send window reaches 1, also reset all tries then + +// Use cubic for congestion control: https://en.wikipedia.org/wiki/CUBIC_TCP +// But scaling with number of sent packets instead of time because we might not +// send packets that often. + +/// Congestion windows gets down to 0.3*w_max for BETA=0.7 +const BETA: f32 = 0.7; +/// Increase over w_max after roughly 5 packets (C=0.2 needs seven packets). +const C: f32 = 0.5; +/// Store that many pings, if all of them get lost, it is a timeout. +const PING_COUNT: usize = 30; +/// Duration in seconds between sending two ping packets. +const PING_SECONDS: u64 = 1; +/// Duration in seconds between resetting the statistic counters. +const STAT_SECONDS: u64 = 1; +/// Size of an UDP header in bytes. +const UDP_HEADER_SIZE: u32 = 8; +/// Size of an IPv4 header in bytes. +const IPV4_HEADER_SIZE: u32 = 20; +// TODO Use correct IPv6 header size to compute bandwidth +// Size of an IPv6 header in bytes. +//const IPV6_HEADER_SIZE: u32 = 40; + +/// Events to inform a resender of the current state of a connection. +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] +pub enum ResenderState { + /// The connection is starting, reduce the timeout time. + Connecting, + /// The handshake is completed, this is the normal operation mode. + Connected, + /// The connection is tearing down, reduce the timeout time. + Disconnecting, + /// The connection is gone, we only send ack packets. + Disconnected, +} + +#[derive(Clone, Copy, Default, Eq, Hash, PartialEq)] +pub struct PartialPacketId { + pub generation_id: u32, + pub packet_id: u16, +} + +#[derive(Clone, Copy, Eq, Hash, PartialEq)] +pub struct PacketId { + pub packet_type: PacketType, + pub part: PartialPacketId, +} + +#[derive(Clone, Debug)] +pub struct SendRecordId { + /// The last time when the packet was sent. + pub last: Instant, + /// How often the packet was already resent. + pub tries: usize, + id: PacketId, +} + +/// A record of a packet that can be resent. +#[derive(Debug)] +struct SendRecord { + /// When this packet was originally sent. + pub sent: Instant, + pub id: SendRecordId, + pub packet: OutUdpPacket, +} + +#[derive(Debug)] +struct Ping { + id: PartialPacketId, + /// When the ping packet was sent. + sent: Instant, +} + +/// Enum for different collected packet statistics. +#[derive(Clone, Copy, Debug)] +pub enum PacketStat { + /// Commands and acks + InControl, + /// Ping and Pong + InKeepalive, + /// Voice + InSpeech, + /// Commands and acks + OutControl, + /// Ping and Pong + OutKeepalive, + /// Voice + OutSpeech, +} + +/// Metrics collected to compute packet loss. +/// +/// The count of incoming packets includes packets that were lost. It is computed by the difference +/// of packet ids. +/// +/// Packet losses that are impossible to track: Outgoing voice, incoming commands, outgoing pongs. +#[derive(Clone, Copy, Debug)] +enum PacketLossStat { + /// Count of incoming voice packets. + VoiceInCount, + /// Count of packet ids that we should have received but did not get. + VoiceInLost, + /// Count of outgoing acks. + AckOutCount, + /// Count of already acked commands that were received. + AckOutLost, + /// Count of incoming ack packets. + AckInCount, + /// Count of packet ids that we should have received but did not get. + AckInLost, + /// Count of command packets that were resent. + /// + /// If a command packet needs to be resent, either the command or the ack was lost. + AckInOrCommandOutLost, + /// Count of outgoing command packets. + CommandOutCount, + /// Count of incoming pong packets. + PongInCount, + /// Count of packet ids that we should have received but did not get. + PongInLost, + // Count of ping packets for which we did not get an answer. + // + // If no pong is received for a ping, either the ping or the pong was lost. + // We do not handle many pings, so just use PingOutCount - PongInCount. + //PongInOrPingOutLost, + /// Count of outgoing pings. + PingOutCount, + /// Count of incoming pings. + PingInCount, + /// Count of packet ids that we should have received but did not get. + PingInLost, +} + +/// Network statistics of a connection. +#[derive(Clone)] +pub struct ConnectionStats { + /// Non-smoothed Round Trip Time. + pub rtt: Duration, + /// Deviation of the rtt. + pub rtt_dev: Duration, + /// Total count of packets since start of the connection. Indexed by `PacketStat`. + pub total_packets: [u64; 6], + /// Total count of bytes since start of the connection. Indexed by `PacketStat`. + pub total_bytes: [u64; 6], + /// Stats collected to compute packet loss. Indexed by `PacketLossStat`. + packet_loss: [u32; 13], + /// Bytes in the last second. Indexed by `PacketStat`. + /// + /// For the last 60 seconds, so the per minute stats can be computed. + pub last_second_bytes: [[u32; 6]; 60], + /// The index in `last_second_bytes` that will be written next. + next_second_index: u8, +} + +/// An intermediate struct to collect network statistics. +/// +/// Collected for one second and reset after moving them to `ConnectionStats`. +#[derive(Clone, Debug, Default)] +struct ConnectionStatsCounter { + bytes: [u32; 6], + /// Stats collected to compute packet loss. Indexed by `PacketLossStat`. + packet_loss: [u32; 13], +} + +pin_project! { + /// Timers are extra because they need to be pinned. + #[derive(Debug)] + struct Timers { + // The future to wake us up when the next packet should be resent. + #[pin] + timeout: Sleep, + // The timer used for sending ping packets. + #[pin] + ping_timeout: Sleep, + // The timer used for disconnecting the connection. + #[pin] + state_timeout: Sleep, + // The timer used to update network statistics. + #[pin] + stats_timeout: Sleep, + } +} + +/// Resend command and init packets until the other side acknowledges them. +#[derive(Debug)] +pub struct Resender { + /// Send queue ordered by when a packet has to be sent. + /// + /// The maximum in this queue is the next packet that should be resent. + /// This is a part of `full_send_queue`. + send_queue: BinaryHeap, + /// Send queue ordered by packet id. + /// + /// There is one queue per packet type: `Init`, `Command` and `CommandLow`. + full_send_queue: [BTreeMap; 3], + /// All packets with an id less than this index id are currently in the + /// `send_queue`. Packets with an id greater or equal to this index are not + /// in the send queue. + send_queue_indices: [PartialPacketId; 3], + config: ResendConfig, + state: ResenderState, + /// A list of the last sent pings that were not yet acknowledged. + last_pings: Vec, + /// In progress counters. + stats_counter: ConnectionStatsCounter, + /// Current up to date statistics. + pub stats: ConnectionStats, + + // Congestion control + /// The maximum send window before the last reduction. + w_max: u16, + /// The time when the last packet loss occurred. + /// + /// This is not necessarily the accurate time, but the duration until + /// now/no_congestion_since is accurate. + last_loss: Instant, + /// The send queue was never full since this time. We use this to not + /// increase the send window in this case. + no_congestion_since: Option, + + /// When the last packet was added to the send queue or received. + /// + /// This is used to decide when to send ping packets. + last_receive: Instant, + /// When the last packet was added to the send queue. + /// + /// This is used to handle timeouts when disconnecting. + last_send: Instant, + /// When the statistics were last reset. + last_stat: Instant, + + timers: Pin>, +} + +#[derive(Clone, Debug)] +pub struct ResendConfig { + // Close the connection after no packet is received for this duration. + pub connecting_timeout: Duration, + pub normal_timeout: Duration, + pub disconnect_timeout: Duration, + + /// Smoothed Round Trip Time. + pub srtt: Duration, + /// Deviation of the srtt. + pub srtt_dev: Duration, +} + +impl Ord for PartialPacketId { + fn cmp(&self, other: &Self) -> Ordering { + self.generation_id + .cmp(&other.generation_id) + .then_with(|| self.packet_id.cmp(&other.packet_id)) + } +} + +impl PartialOrd for PartialPacketId { + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } +} + +impl Add for PartialPacketId { + type Output = Self; + fn add(self, rhs: u16) -> Self::Output { + let (packet_id, next_gen) = self.packet_id.overflowing_add(rhs); + Self { + generation_id: if next_gen { + self.generation_id.wrapping_add(1) + } else { + self.generation_id + }, + packet_id, + } + } +} + +impl Sub for PartialPacketId { + type Output = Self; + fn sub(self, rhs: u16) -> Self::Output { + let (packet_id, last_gen) = self.packet_id.overflowing_sub(rhs); + Self { + generation_id: if last_gen { + self.generation_id.wrapping_sub(1) + } else { + self.generation_id + }, + packet_id, + } + } +} + +impl Sub for PartialPacketId { + type Output = i64; + fn sub(self, rhs: Self) -> Self::Output { + let gen_diff = i64::from(self.generation_id) - i64::from(rhs.generation_id); + let id_diff = i64::from(self.packet_id) - i64::from(rhs.packet_id); + + gen_diff * i64::from(u16::MAX) + id_diff + } +} + +impl PartialOrd for PacketId { + fn partial_cmp(&self, other: &Self) -> Option { + if self.packet_type == other.packet_type { Some(self.part.cmp(&other.part)) } else { None } + } +} + +impl From<&OutUdpPacket> for PacketId { + fn from(packet: &OutUdpPacket) -> Self { + Self { + packet_type: packet.packet_type(), + part: PartialPacketId { + generation_id: packet.generation_id(), + packet_id: packet.packet_id(), + }, + } + } +} + +impl fmt::Debug for PacketId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}{:?}", self.packet_type, self.part)?; + Ok(()) + } +} + +impl fmt::Debug for PartialPacketId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({:x}:{:x})", self.generation_id, self.packet_id)?; + Ok(()) + } +} + +impl Ord for SendRecordId { + fn cmp(&self, other: &Self) -> Ordering { + // If the packet was not already sent, it is more important + if self.tries == 0 { + if other.tries != 0 { + return Ordering::Greater; + } + } else if other.tries == 0 { + return Ordering::Less; + } + // The smallest time is the most important time + self.last.cmp(&other.last).reverse().then_with(|| + // Else, the lower packet id is more important + self.id.part.cmp(&other.id.part).reverse()) + } +} + +impl PartialOrd for SendRecordId { + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } +} + +impl PartialEq for SendRecordId { + fn eq(&self, other: &Self) -> bool { self.id.eq(&other.id) } +} +impl Eq for SendRecordId {} + +impl Hash for SendRecordId { + fn hash(&self, state: &mut H) { self.id.hash(state); } +} + +impl Default for Resender { + fn default() -> Self { + let now = Instant::now(); + Self { + send_queue: Default::default(), + full_send_queue: Default::default(), + send_queue_indices: Default::default(), + config: Default::default(), + state: ResenderState::Connecting, + last_pings: Default::default(), + stats: Default::default(), + stats_counter: Default::default(), + + w_max: UDP_SINK_CAPACITY as u16, + last_loss: now, + no_congestion_since: Some(now), + + last_receive: now, + last_send: now, + last_stat: now, + + timers: Box::pin(Timers { + timeout: tokio::time::sleep(std::time::Duration::from_secs(1)), + ping_timeout: tokio::time::sleep(std::time::Duration::from_secs(PING_SECONDS)), + state_timeout: tokio::time::sleep(std::time::Duration::from_secs(1)), + stats_timeout: tokio::time::sleep(std::time::Duration::from_secs(STAT_SECONDS)), + }), + } + } +} + +impl Resender { + fn packet_type_to_index(t: PacketType) -> usize { + match t { + PacketType::Init => 0, + PacketType::Command => 1, + PacketType::CommandLow => 2, + _ => panic!("Resender cannot handle packet type {:?}", t), + } + } + + pub fn ack_packet(con: &mut Connection, cx: &mut Context, p_type: PacketType, p_id: u16) { + if p_type == PacketType::Ping { + Self::ack_ping(con, p_id); + return; + } + + // Remove from ordered queue + let queue = &mut con.resender.full_send_queue[Self::packet_type_to_index(p_type)]; + let mut queue_iter = queue.iter(); + if let Some((first, _)) = queue_iter.next() { + let id = if first.packet_id == p_id { + let p_id = if let Some((_, rec2)) = queue_iter.next() { + // Ack all until the next packet + rec2.id.id.part + } else if p_type == PacketType::Init { + // Ack the current packet + PartialPacketId { generation_id: 0, packet_id: p_id + 1 } + } else { + // Ack all until the next packet to send + con.codec.outgoing_p_ids[p_type.to_usize().unwrap()] + }; + + let id = PacketId { packet_type: p_type, part: p_id - 1 }; + con.stream_items.push_back(StreamItem::AckPacket(id)); + + *first + } else { + PartialPacketId { + generation_id: if p_id < first.packet_id { + first.generation_id.wrapping_add(1) + } else { + first.generation_id + }, + packet_id: p_id, + } + }; + + if let Some(rec) = queue.remove(&id) { + // Update srtt if the packet was not resent + if rec.id.tries == 1 { + let now = Instant::now(); + con.resender.update_srtt(now - rec.sent); + } + + // Notify the waker that we can send another packet from the + // send queue. + cx.waker().wake_by_ref(); + } + } + } + + pub fn ack_ping(con: &mut Connection, p_id: u16) { + if let Ok(i) = con.resender.last_pings.binary_search_by_key(&p_id, |p| p.id.packet_id) { + let ping = con.resender.last_pings.remove(i); + let now = Instant::now(); + con.resender.update_srtt(now - ping.sent); + } + } + + pub fn received_packet(&mut self) { self.last_receive = Instant::now(); } + + pub fn handle_loss_incoming(&mut self, packet: &InPacket, in_recv_win: bool, cur_next: u16) { + let p_type = packet.header().packet_type(); + let id = packet.header().packet_id(); + let id_diff = u32::from(id.wrapping_sub(cur_next)); + let p_stat = PacketStat::from(p_type, true); + let len = (packet.header().data().len() + packet.content().len()) as u32 + + UDP_HEADER_SIZE + + IPV4_HEADER_SIZE; + + self.stats_counter.bytes[p_stat as usize] += len; + self.stats.total_packets[p_stat as usize] += 1; + self.stats.total_bytes[p_stat as usize] += u64::from(len); + + let stats; + if p_type.is_voice() { + stats = Some((PacketLossStat::VoiceInCount, PacketLossStat::VoiceInLost)); + } else if p_type.is_ack() { + stats = Some((PacketLossStat::AckInCount, PacketLossStat::AckInLost)); + } else if p_type == PacketType::Pong { + stats = Some((PacketLossStat::PongInCount, PacketLossStat::PongInLost)); + } else if p_type == PacketType::Ping { + stats = Some((PacketLossStat::PingInCount, PacketLossStat::PingInLost)); + } else { + stats = None; + } + + if let Some((count, lost)) = stats { + if in_recv_win { + self.stats_counter.packet_loss[count as usize] += id_diff + 1; + self.stats_counter.packet_loss[lost as usize] += id_diff; + } else { + self.stats_counter.packet_loss[lost as usize] = + self.stats_counter.packet_loss[lost as usize].saturating_sub(1); + } + } + } + + pub fn handle_loss_outgoing(&mut self, packet: &OutUdpPacket) { + let p_type = packet.data().header().packet_type(); + let p_stat = PacketStat::from(p_type, false); + // 8 byte UDP header + let len = packet.data().data().len() as u32 + UDP_HEADER_SIZE + IPV4_HEADER_SIZE; + self.stats_counter.handle_loss_outgoing(packet, p_stat, len); + self.stats.handle_loss_outgoing(p_stat, u64::from(len)); + } + + pub fn handle_loss_resend_ack(&mut self) { + self.stats_counter.packet_loss[PacketLossStat::AckOutLost as usize] += 1; + } + + fn get_timeout(&self) -> Duration { + match self.state { + ResenderState::Connecting => self.config.connecting_timeout, + ResenderState::Disconnecting | ResenderState::Disconnected => { + self.config.disconnect_timeout + } + ResenderState::Connected => self.config.normal_timeout, + } + } + + /// Inform the resender of state changes of the connection. + pub fn set_state(&mut self, state: ResenderState) { + info!(from = ?self.state, to = ?state, "Resender: Changed state"); + self.state = state; + + self.last_send = Instant::now(); + let new_timeout = self.last_send + self.get_timeout(); + let timers = self.timers.as_mut().project(); + timers.state_timeout.reset(new_timeout); + } + + pub fn get_state(&self) -> ResenderState { self.state } + + /// If the send queue is full if it reached the congestion window size or + /// it contains packets that were not yet sent once. + pub fn is_full(&self) -> bool { self.full_send_queue.len() >= self.get_window() as usize } + + /// If the send queue is empty. + pub fn is_empty(&self) -> bool { self.full_send_queue.iter().all(|q| q.is_empty()) } + + /// Take the first packets from `to_send_ordered` and put them into + /// `to_send`. + /// + /// This is done on packet loss, when the send queue is rebuilt. + fn rebuild_send_queue(&mut self) { + self.send_queue.clear(); + self.send_queue_indices = Default::default(); + self.fill_up_send_queue(); + } + + /// Fill up to the send window size. + fn fill_up_send_queue(&mut self) { + let get_skip_closure = |i: usize| { + let start = self.send_queue_indices[i]; + move |r: &&SendRecord| r.id.id.part < start + }; + let mut iters = [ + self.full_send_queue[0].values().skip_while(get_skip_closure(0)).peekable(), + self.full_send_queue[1].values().skip_while(get_skip_closure(1)).peekable(), + self.full_send_queue[2].values().skip_while(get_skip_closure(2)).peekable(), + ]; + + for _ in self.send_queue.len()..(self.get_window() as usize) { + let mut max_i = None; + let mut min_time = None; + + for (i, iter) in iters.iter_mut().enumerate() { + if let Some(rec) = iter.peek() { + if min_time.map(|t| t < rec.sent).unwrap_or(true) { + max_i = Some(i); + min_time = Some(rec.sent); + } + } + } + + if let Some(max_i) = max_i { + let max = iters[max_i].next().unwrap().id.clone(); + self.send_queue_indices[max_i] = max.id.part + 1; + self.send_queue.push(max); + } else { + if self.no_congestion_since.is_none() { + self.no_congestion_since = Some(Instant::now()); + } + return; + } + } + + if let Some(until) = self.no_congestion_since.take() { + self.last_loss = Instant::now() - (until - self.last_loss); + } + } + + /// The amount of packets that can be in-flight concurrently. + /// + /// The CUBIC congestion control window. + fn get_window(&self) -> u16 { + let time = self.no_congestion_since.unwrap_or_else(Instant::now) - self.last_loss; + let res = C + * (time.as_secs_f32() - (self.w_max as f32 * BETA / C).powf(1.0 / 3.0)).powf(3.0) + + self.w_max as f32; + let max = u16::MAX / 2; + if res > max as f32 { + max + } else if res < 1.0 { + 1 + } else { + res as u16 + } + } + + /// Add another duration to the stored smoothed rtt. + fn update_srtt(&mut self, rtt: Duration) { + let diff = + if rtt > self.config.srtt { rtt - self.config.srtt } else { self.config.srtt - rtt }; + self.config.srtt_dev = self.config.srtt_dev * 3 / 4 + diff / 4; + self.config.srtt = self.config.srtt * 7 / 8 + rtt / 8; + + // Rtt (non-smoothed) + let diff = if rtt > self.stats.rtt { rtt - self.stats.rtt } else { self.stats.rtt - rtt }; + self.stats.rtt_dev = self.stats.rtt_dev * 3 / 4 + diff / 4; + self.stats.rtt = self.stats.rtt / 2 + rtt / 2; + } + + pub fn send_packet(con: &mut Connection, packet: OutUdpPacket) { + con.resender.last_send = Instant::now(); + let rec = SendRecord { + sent: Instant::now(), + id: SendRecordId { last: Instant::now(), tries: 0, id: (&packet).into() }, + packet, + }; + + trace!(record = ?rec, window = con.resender.get_window(), "Adding send record"); + let i = Self::packet_type_to_index(rec.id.id.packet_type); + // Reduce index if necessary (needed e.g. for resending lower init packets) + if con.resender.send_queue_indices[i] > rec.id.id.part { + con.resender.send_queue_indices[i] = rec.id.id.part; + } + + con.resender.full_send_queue[i].insert(rec.id.id.part, rec); + con.resender.fill_up_send_queue(); + trace!(state = ?con.resender.send_queue, indices = ?con.resender.send_queue_indices, "After adding send record"); + } + + /// Returns an error if the timeout is exceeded and the connection is + /// considered dead or another unrecoverable error occurs. + pub fn poll_resend(con: &mut Connection, cx: &mut Context) -> Result<()> { + trace!(state = ?con.resender.send_queue, "Poll resend"); + let timeout = con.resender.get_timeout(); + // Send a packet at least every second + let max_send_rto = Duration::from_secs(1); + + // Check if there are packets to send. + loop { + let now = Instant::now(); + let window = con.resender.get_window(); + + // Retransmission timeout + let mut rto: Duration = con.resender.config.srtt + con.resender.config.srtt_dev * 4; + if rto > max_send_rto { + rto = max_send_rto; + } + let last_threshold = now - rto; + + let mut rec = if let Some(rec) = con.resender.send_queue.peek_mut() { + rec + } else { + break; + }; + trace!("Polling send record"); + + // Skip if not contained in full_send_queue. This happens when the + // packet was acknowledged. + let full_queue = + &mut con.resender.full_send_queue[Self::packet_type_to_index(rec.id.packet_type)]; + let full_rec = if let Some(r) = full_queue.get_mut(&rec.id.part) { + r + } else { + drop(rec); + con.resender.send_queue.pop(); + con.resender.fill_up_send_queue(); + continue; + }; + + // Check if we should resend this packet or not + if rec.tries != 0 && rec.last > last_threshold { + // Schedule next send + let dur = rec.last - last_threshold; + let timers = con.resender.timers.as_mut().project(); + timers.timeout.reset(now + dur); + let timers = con.resender.timers.as_mut().project(); + if let Poll::Ready(()) = timers.timeout.poll(cx) { + continue; + } + break; + } + + if now - full_rec.sent > timeout { + return Err(Error::Timeout("Packet was not acked")); + } + + // Try to send this packet + trace!("Try sending packet"); + match Connection::static_poll_send_udp_packet( + &*con.udp_socket, + con.address, + &con.event_listeners, + cx, + &full_rec.packet, + ) { + Poll::Pending => break, + Poll::Ready(r) => { + r?; + if rec.tries != 0 { + let to_s = if con.is_client { "S" } else { "C" }; + warn!(id = ?rec.id, + tries = rec.tries, + last = %format!("{:?} ago", now - rec.last), + to = to_s, + srtt = ?con.resender.config.srtt, + srtt_dev = ?con.resender.config.srtt_dev, + ?rto, + send_window = window, + "Resend" + ); + con.resender.stats_counter.handle_loss_resend_command(); + } + + // Successfully started sending the packet, update record + rec.last = now; + rec.tries += 1; + full_rec.id = rec.clone(); + + let p_type = full_rec.packet.data().header().packet_type(); + let p_stat = PacketStat::from(p_type, false); + let len = full_rec.packet.data().data().len() as u32 + + UDP_HEADER_SIZE + IPV4_HEADER_SIZE; + con.resender.stats_counter.handle_loss_outgoing(&full_rec.packet, p_stat, len); + con.resender.stats.handle_loss_outgoing(p_stat, u64::from(len)); + + if rec.tries != 1 { + drop(rec); + // Double srtt on packet loss + con.resender.config.srtt *= 2; + if con.resender.config.srtt > timeout { + con.resender.config.srtt = timeout; + } + + // Handle congestion window + con.resender.w_max = con.resender.get_window(); + con.resender.last_loss = Instant::now(); + con.resender.no_congestion_since = None; + con.resender.rebuild_send_queue(); + } else { + drop(rec); + } + } + } + } + + Ok(()) + } + + /// Returns an error if the timeout is exceeded and the connection is + /// considered dead or another unrecoverable error occurs. + pub fn poll_ping(con: &mut Connection, cx: &mut Context) -> Result<()> { + let now = Instant::now(); + let timeout = con.resender.get_timeout(); + + if con.resender.state == ResenderState::Disconnecting { + if now - con.resender.last_send >= timeout { + return Err(Error::Timeout("No disconnect ack received")); + } + + let timers = con.resender.timers.as_mut().project(); + timers.state_timeout.reset(con.resender.last_send + timeout); + let timers = con.resender.timers.as_mut().project(); + if let Poll::Ready(()) = timers.state_timeout.poll(cx) { + return Err(Error::Timeout("No disconnect ack received")); + } + } + + // Update stats + loop { + let next_reset = con.resender.last_stat + Duration::from_secs(STAT_SECONDS); + let timers = con.resender.timers.as_mut().project(); + timers.stats_timeout.reset(next_reset); + + let timers = con.resender.timers.as_mut().project(); + if let Poll::Ready(()) = timers.stats_timeout.poll(cx) { + // Reset stats + con.resender.last_stat = Instant::now(); + let stats = &mut con.resender.stats; + let counter = &mut con.resender.stats_counter; + let second_index = stats.next_second_index; + stats.last_second_bytes[second_index as usize] = counter.bytes; + stats.next_second_index = (second_index + 1) % stats.last_second_bytes.len() as u8; + stats.packet_loss = counter.packet_loss; + counter.reset(); + + con.stream_items.push_back(StreamItem::NetworkStatsUpdated); + } else { + break; + } + } + + if con.resender.get_state() == ResenderState::Connected + && !con.resender.full_send_queue.iter().any(|q| !q.is_empty()) + { + // Send pings if we are connected and there are no packets in the queue + loop { + let now = Instant::now(); + let mut next_ping = con.resender.last_receive + Duration::from_secs(PING_SECONDS); + if let Some(p) = con.resender.last_pings.last() { + if p.sent > con.resender.last_receive { + next_ping = p.sent + Duration::from_secs(PING_SECONDS); + } else { + // We received a packet, clear the ping queue + con.resender.last_pings.clear(); + } + } + let timers = con.resender.timers.as_mut().project(); + timers.ping_timeout.reset(next_ping); + + let timers = con.resender.timers.as_mut().project(); + if let Poll::Ready(()) = timers.ping_timeout.poll(cx) { + // Check for timeouts + if con.resender.last_pings.len() >= PING_COUNT { + let diff = con.resender.last_pings.last().unwrap().id + - con.resender.last_pings.first().unwrap().id; + // We did not receive a pong in between the last pings + if diff as usize == con.resender.last_pings.len() - 1 { + return Err(Error::Timeout("Server did not respond to pings")); + } + } + + // Send ping + let dir = if con.is_client { Direction::C2S } else { Direction::S2C }; + let packet = OutPacket::new_with_dir(dir, Flags::empty(), PacketType::Ping); + let p_id = con.send_packet(packet)?; + con.resender.last_pings.push(Ping { id: p_id.part, sent: now }); + if con.resender.last_pings.len() > PING_COUNT { + con.resender.last_pings.remove(0); + } + } else { + break; + } + } + } + + Ok(()) + } +} + +impl ConnectionStatsCounter { + fn handle_loss_outgoing(&mut self, packet: &OutUdpPacket, p_stat: PacketStat, len: u32) { + let p_type = packet.data().header().packet_type(); + + self.bytes[p_stat as usize] += len; + + if p_type.is_ack() { + self.packet_loss[PacketLossStat::AckOutCount as usize] += 1; + } else if p_type == PacketType::Ping { + self.packet_loss[PacketLossStat::PingOutCount as usize] += 1; + } else if p_type.is_command() { + self.packet_loss[PacketLossStat::CommandOutCount as usize] += 1; + } + } + + pub(crate) fn handle_loss_resend_command(&mut self) { + self.packet_loss[PacketLossStat::AckInOrCommandOutLost as usize] += 1; + } + + fn reset(&mut self) { *self = Default::default(); } +} + +impl ConnectionStats { + fn handle_loss_outgoing(&mut self, p_stat: PacketStat, len: u64) { + self.total_packets[p_stat as usize] += 1; + self.total_bytes[p_stat as usize] += len; + } + + pub fn get_last_second_bytes(&self) -> &[u32; 6] { + &self.last_second_bytes[((self.next_second_index + 60 - 1) % 60) as usize] + } + + pub fn get_last_minute_bytes(&self) -> [u64; 6] { + let mut bytes = [0; 6]; + for bs in &self.last_second_bytes[..] { + for (i, b) in bs.iter().enumerate() { + bytes[i] += u64::from(*b); + } + } + bytes + } + + // Packetloss stats for TeamSpeak + pub fn get_packetloss_s2c_speech(&self) -> f32 { + let count = self.packet_loss[PacketLossStat::VoiceInCount as usize]; + if count == 0 { + 0.0 + } else { + self.packet_loss[PacketLossStat::VoiceInLost as usize] as f32 / count as f32 + } + } + + pub fn get_packetloss_s2c_keepalive(&self) -> f32 { + let count = self.packet_loss[PacketLossStat::PingInCount as usize] + + self.packet_loss[PacketLossStat::PongInCount as usize]; + if count == 0 { + 0.0 + } else { + (self.packet_loss[PacketLossStat::PingInLost as usize] as f32 + + self.packet_loss[PacketLossStat::PongInLost as usize] as f32) + / count as f32 + } + } + + pub fn get_packetloss_s2c_control(&self) -> f32 { + let count = self.packet_loss[PacketLossStat::AckInCount as usize]; + if count == 0 { + 0.0 + } else { + self.packet_loss[PacketLossStat::AckInLost as usize] as f32 / count as f32 + } + } + + pub fn get_packetloss_s2c_total(&self) -> f32 { + let count = self.packet_loss[PacketLossStat::VoiceInCount as usize] + + self.packet_loss[PacketLossStat::PingInCount as usize] + + self.packet_loss[PacketLossStat::PongInCount as usize] + + self.packet_loss[PacketLossStat::AckInCount as usize]; + if count == 0 { + 0.0 + } else { + (self.packet_loss[PacketLossStat::VoiceInLost as usize] as f32 + + self.packet_loss[PacketLossStat::PingInLost as usize] as f32 + + self.packet_loss[PacketLossStat::PongInLost as usize] as f32 + + self.packet_loss[PacketLossStat::AckInLost as usize] as f32) + / count as f32 + } + } + + /// Compute the average incoming and outgoing packet loss. + pub fn get_packetloss(&self) -> f32 { + let count = self.packet_loss[PacketLossStat::VoiceInCount as usize] + + self.packet_loss[PacketLossStat::PingInCount as usize] + + self.packet_loss[PacketLossStat::PongInCount as usize] + + self.packet_loss[PacketLossStat::AckInCount as usize] + + self.packet_loss[PacketLossStat::AckOutCount as usize] + + self.packet_loss[PacketLossStat::CommandOutCount as usize]; + // Do not use ping count, it is unreliable + if count == 0 { + 0.0 + } else { + let command_out_lost = min( + self.packet_loss[PacketLossStat::AckInOrCommandOutLost as usize] + .saturating_sub(self.packet_loss[PacketLossStat::AckInLost as usize]), + self.packet_loss[PacketLossStat::CommandOutCount as usize], + ); + + (self.packet_loss[PacketLossStat::VoiceInLost as usize] as f32 + + self.packet_loss[PacketLossStat::PingInLost as usize] as f32 + + self.packet_loss[PacketLossStat::PongInLost as usize] as f32 + + self.packet_loss[PacketLossStat::AckInLost as usize] as f32 + + self.packet_loss[PacketLossStat::AckOutLost as usize] as f32 + + command_out_lost as f32) + / count as f32 + } + } +} + +impl Default for ResendConfig { + fn default() -> Self { + Self { + connecting_timeout: Duration::from_secs(5), + normal_timeout: Duration::from_secs(30), + disconnect_timeout: Duration::from_secs(5), + + srtt: Duration::from_millis(500), + srtt_dev: Duration::from_millis(0), + } + } +} + +impl Default for ConnectionStats { + fn default() -> Self { + Self { + rtt: Duration::from_millis(0), + rtt_dev: Duration::from_millis(0), + total_packets: Default::default(), + total_bytes: Default::default(), + packet_loss: Default::default(), + last_second_bytes: [Default::default(); 60], + next_second_index: Default::default(), + } + } +} + +impl fmt::Debug for ConnectionStats { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("ConnectionStats") + .field("rtt", &self.rtt) + .field("rtt_dev", &self.rtt_dev) + .field("total_packets", &self.total_packets) + .field("total_bytes", &self.total_bytes) + .field("packet_loss", &self.packet_loss) + .field("last_second_bytes", self.get_last_second_bytes()) + .field("next_second_index", &self.next_second_index) + .finish() + } +} + +impl PacketStat { + fn from(t: PacketType, incoming: bool) -> Self { + match t { + PacketType::Voice | PacketType::VoiceWhisper => { + if incoming { + PacketStat::InSpeech + } else { + PacketStat::OutSpeech + } + } + PacketType::Command + | PacketType::CommandLow + | PacketType::Ack + | PacketType::AckLow + | PacketType::Init => { + if incoming { + PacketStat::InControl + } else { + PacketStat::OutControl + } + } + PacketType::Ping | PacketType::Pong => { + if incoming { + PacketStat::InKeepalive + } else { + PacketStat::OutKeepalive + } + } + } + } +} diff --git a/native/vendor/tsclientlib/tsproto/src/utils.rs b/native/vendor/tsclientlib/tsproto/src/utils.rs new file mode 100644 index 0000000..b7c86d7 --- /dev/null +++ b/native/vendor/tsclientlib/tsproto/src/utils.rs @@ -0,0 +1,47 @@ +use std::net::IpAddr; + +use crate::{Error, Result}; + +/// Try to approximate the not stabilized ip.is_global(). +pub fn is_global_ip(ip: &IpAddr) -> bool { + if !ip.is_unspecified() && !ip.is_loopback() && !ip.is_multicast() { + match *ip { + IpAddr::V4(ref ip) => !ip.is_broadcast() && !ip.is_link_local() && !ip.is_private(), + IpAddr::V6(_) => true, + } + } else { + false + } +} + +pub fn read_hex(s: &str) -> Result> { + // Detect hex format + if s.chars().nth(2) == Some(':') { + // Wireshark + Ok(s.split(':') + .map(|s| u8::from_str_radix(s, 16)) + .collect::<::std::result::Result, _>>() + .map_err(Error::InvalidHex)?) + } else if s.chars().nth(2) == Some(' ') { + // Wireshark + Ok(s.split(' ') + .map(|s| u8::from_str_radix(s, 16)) + .collect::<::std::result::Result, _>>() + .map_err(Error::InvalidHex)?) + } else if s.starts_with("0x") { + let s: String = s.chars().filter(|c| !c.is_whitespace()).collect(); + // Own dumps + Ok(s[2..] + .split(',') + .map(|s| u8::from_str_radix(s.trim_start_matches("0x"), 16)) + .collect::<::std::result::Result, _>>() + .map_err(Error::InvalidHex)?) + } else { + let s: String = s.chars().filter(|c| !c.is_whitespace()).collect(); + Ok(s.as_bytes() + .chunks(2) + .map(|s| u8::from_str_radix(::std::str::from_utf8(s).unwrap(), 16)) + .collect::<::std::result::Result, _>>() + .map_err(Error::InvalidHex)?) + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/Cargo.toml b/native/vendor/tsclientlib/utils/ts-bookkeeping/Cargo.toml new file mode 100644 index 0000000..155fe46 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "ts-bookkeeping" +version = "0.1.0" +authors = ["Flakebi "] +description = "Structs to store the state of a TeamSpeak server, with its clients and channels." +repository = "https://github.com/ReSpeak/tsclientlib/tree/master/utils/ts-bookkeeping" +readme = "README.md" +keywords = ["teamspeak3", "ts3"] +license = "MIT OR Apache-2.0" +build = "build/build.rs" +edition = "2018" +autobenches = false +include = [ + "/Cargo.toml", + "/README.md", + "**/*.rs", + "**/*.tt", +] + +[dependencies] +base64 = "0.22" +num-traits = "0.2" +num-derive = "0.4" +serde = { version = "1", features = ["derive"] } +thiserror = "2" +time = { version = "0.3", features = ["serde"] } +tracing = "0.1" +tsproto-packets = { path = "../tsproto-packets", version = "0.1" } +tsproto-types = { path = "../tsproto-types", version = "0.1" } + +[build-dependencies] +heck = "0.5" +itertools = "0.14" +t4rust-derive = "0.3" +tsproto-structs = { path = "../tsproto-structs", version = "0.2" } + +[dev-dependencies] +criterion = "0.8" +once_cell = "1" +tracing-subscriber = "0.3" + +[[bench]] +name = "command" +harness = false diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/README.md b/native/vendor/tsclientlib/utils/ts-bookkeeping/README.md new file mode 100644 index 0000000..54d6fcc --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/README.md @@ -0,0 +1,21 @@ +# ts-bookkeeping [![docs.rs](https://docs.rs/ts-bookkeeping/badge.svg)](https://docs.rs/ts-bookkeeping) +`ts-bookkeeping` contains structs to store the state of a TeamSpeak server, with its clients and +channels. + +The crate can be used to keep track of the state on a server by processing all incoming +commands, which is why it is called “bookkeeping”. It also contains generated structs for all +TeamSpeak commands. + +Incoming commands can be applied to the state and generate [`events`]. The main struct is +[`data::Connection`]. + +The structs have methods to create packets for various actions. The generated packets can be +sent to a server. + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/README.tpl b/native/vendor/tsclientlib/utils/ts-bookkeeping/README.tpl new file mode 100644 index 0000000..d79d809 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/README.tpl @@ -0,0 +1,10 @@ +# ts-bookkeeping [![docs.rs](https://docs.rs/ts-bookkeeping/badge.svg)](https://docs.rs/ts-bookkeeping) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/benches/command.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/benches/command.rs new file mode 100644 index 0000000..0f9843f --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/benches/command.rs @@ -0,0 +1,44 @@ +use std::iter; + +use criterion::{criterion_group, criterion_main, Bencher, Criterion}; +use once_cell::sync::Lazy; +use ts_bookkeeping::messages::s2c::{self, InMessage}; +use tsproto_packets::packets::{Direction, Flags, OutPacket, PacketType}; + +const SHORT_CMD: &[u8] = b"notifyclientleftview cfid=1 ctid=0 clid=61"; +const LONG_CMD: &[u8] = b"channellist cid=2 cpid=0 channel_name=Trusted\\sChannel channel_topic channel_codec=0 channel_codec_quality=0 channel_maxclients=0 channel_maxfamilyclients=-1 channel_order=1 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=0 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic channel_icon_id=0 channel_flag_private=0|cid=4 cpid=2 channel_name=Ding\\s\xe2\x80\xa2\\s1\\s\\p\\sSplamy\xc2\xb4s\\sBett channel_topic channel_codec=4 channel_codec_quality=7 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=0 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic=Neo\\sSeebi\\sEvangelion channel_icon_id=0 channel_flag_private=0|cid=6 cpid=2 channel_name=Ding\\s\xe2\x80\xa2\\s2\\s\\p\\sThe\\sBook\\sof\\sHeavy\\sMetal channel_topic channel_codec=2 channel_codec_quality=7 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=4 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic=Not\\senought\\sChannels channel_icon_id=0 channel_flag_private=0|cid=30 cpid=2 channel_name=Ding\\s\xe2\x80\xa2\\s3\\s\\p\\sSenpai\\sGef\xc3\xa4hrlich channel_topic channel_codec=2 channel_codec_quality=7 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=6 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic=The\\strashcan\\shas\\sthe\\strash channel_icon_id=0 channel_flag_private=0"; + +static TRACING: Lazy<()> = Lazy::new(|| tracing_subscriber::fmt().with_test_writer().init()); + +fn parse(b: &mut Bencher, cmd: &[u8]) { + Lazy::force(&TRACING); + let header = OutPacket::new_with_dir(Direction::S2C, Flags::empty(), PacketType::Command); + + b.iter(|| InMessage::new(&header.header(), cmd).unwrap()); +} + +fn write(b: &mut Bencher, cmd: &[u8]) { + Lazy::force(&TRACING); + let header = OutPacket::new_with_dir(Direction::S2C, Flags::empty(), PacketType::Command); + let msg = InMessage::new(&header.header(), cmd).unwrap(); + match msg { + InMessage::ClientLeftView(msg) => { + let out_part = msg.iter().next().unwrap().as_out(); + b.iter(|| s2c::OutClientLeftViewMessage::new(&mut iter::once(out_part.clone()))); + } + InMessage::ChannelList(msg) => { + let out_part = msg.iter().next().unwrap().as_out(); + b.iter(|| s2c::OutChannelListMessage::new(&mut iter::once(out_part.clone()))); + } + _ => unreachable!("This command type is not supported in this test"), + } +} + +fn parse_short(c: &mut Criterion) { c.bench_function("parse short", |b| parse(b, SHORT_CMD)); } +fn parse_long(c: &mut Criterion) { c.bench_function("parse long", |b| parse(b, LONG_CMD)); } + +fn write_short(c: &mut Criterion) { c.bench_function("write short", |b| write(b, SHORT_CMD)); } +fn write_long(c: &mut Criterion) { c.bench_function("write long", |b| write(b, LONG_CMD)); } + +criterion_group!(benches, parse_short, parse_long, write_short, write_long); +criterion_main!(benches); diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookDeclarations.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookDeclarations.tt new file mode 100644 index 0000000..58085e7 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookDeclarations.tt @@ -0,0 +1,14 @@ +<#@ template cleanws="true" #> +<# for struc in &self.0.structs { #> +<#= doc_comment(&struc.doc) #> +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct <#= struc.name #> { +<# for p in struc.get_all_properties() { + if let Some(ref doc) = p.get_doc() { #> +<#= indent(doc_comment(doc), 1) #> +<# } #> + pub <#= p.get_attr_name(&struc) #>: <#= p.get_type(&self.0.structs)? #>, +<# } #> +} + +<# } #> diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookToMessages.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookToMessages.tt new file mode 100644 index 0000000..ed83c62 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/BookToMessages.tt @@ -0,0 +1,232 @@ +<#@ template cleanws="true" #> +<# +use std::{fmt, iter}; + +use tsproto_structs::messages::{MessageDeclarations, MessageGroup}; + +fn get_all_arguments<'a>(e: &'a Event<'a>, r: Option<&'a RuleKind<'a>>) -> String { + let mut args = String::new(); + for r in e.ids.iter().chain(r.iter().cloned()) { + match r { + RuleKind::ArgumentMap { .. } | + RuleKind::ArgumentFunction { .. } => { + let arg = r.get_argument(); + if !arg.is_empty() { + args.push_str(", "); + args.push_str(&arg); + } + } + _ => {} + } + } + args +} + +fn get_all_id_arguments<'a>(e: &'a Event<'a>) -> String { + let mut args = String::new(); + for r in &e.ids { + match r { + RuleKind::ArgumentMap { .. } | + RuleKind::ArgumentFunction { .. } => { + let arg = r.get_argument(); + if !arg.is_empty() { + args.push_str(&arg); + args.push_str(", "); + } + } + _ => {} + } + } + args +} + +fn create_message( + _fmt: &mut fmt::Formatter, e: &Event, rule: Option<&RuleKind>, + msg_group: &MessageGroup, messages: &MessageDeclarations, +) -> fmt::Result { + for r in e.ids.iter().chain(rule.iter().cloned()) { + call_func(_fmt, r)?; + } + #> + c2s::Out<#= e.msg.name #>Part { + <# + for a in &e.msg.attributes { + let field = messages.get_field(a); + + let (from_rule, found) = find_rule(e, rule, field); + let from = match found { + Some(RuleKind::Map { from, .. }) => { + let from_self = if from_rule { "" } else { "self." }; + Some(format!("{}{}", from_self, from.name.to_snake_case())) + } + Some(found@RuleKind::ArgumentMap { .. }) => Some(found.from_name().to_snake_case()), + Some(RuleKind::Function { .. }) + | Some(RuleKind::ArgumentFunction { .. }) => Some(field.get_rust_name()), + None => None, + }; + + if let Some(from) = from { + if field.is_opt(&e.msg) { #> + <#= field.get_rust_name() #>: Some(<#= from #>.into()), + <# } else { #> + <#= field.get_rust_name() #>: <#= from #>.into(), + <# } + } else { #> + <#= field.get_rust_name() #>: None, + <# } + } #> + } + <# + Ok(()) +} + +/// Calls function if it is one, otherwise does nothing. +fn call_func(_fmt: &mut fmt::Formatter, r: &RuleKind) -> fmt::Result { + match r { + RuleKind::Function { name, to, .. } => { #> + let <#= get_to_list(to.as_slice()) #> = self.<#= name.to_snake_case() #>(); + <# } + RuleKind::ArgumentFunction { from, to, name, .. } => { #> + let <#= get_to_list(to.as_slice()) + #> = self.<#= name.to_snake_case() #>(<#= from.to_snake_case() #>); + <# } + _ => {} + } + Ok(()) +} + +/// Calls function if it is one, otherwise does nothing. +fn call_func2(_fmt: &mut fmt::Formatter, struct_name: &str, r: &RuleKind) -> fmt::Result { + match r { + RuleKind::Function { name, to, .. } => { #> + let <#= get_to_list(to.as_slice()) #> = <#= struct_name #>::<#= name.to_snake_case() #>(); + <# } + RuleKind::ArgumentFunction { from, to, name, .. } => { #> + let <#= get_to_list(to.as_slice()) + #> = <#= struct_name #>::<#= name.to_snake_case() #>(<#= from.to_snake_case() #>); + <# } + _ => {} + } + Ok(()) +} + +for e in &self.decls { + let msg_group = self.messages.get_message_group(&e.msg); + let uses_lifetime = self.messages.uses_lifetime(&e.msg); + // Update + if e.op == RuleOp::Update { + let small_change_name = e.get_small_name(); + let change_name = e.get_change_name(); + #> + +impl <#= e.book_struct.name #> { + pub fn <#= change_name.to_snake_case() #><# if uses_lifetime { #><'a><# } #>(&self, <#= + get_all_id_arguments(e).replace('&', "&'a ") #> + <# if e.msg.attributes.is_empty() { #> + ) -> OutCommand + <# } else { #> + ) -> c2s::Out<#= e.msg.name #>Part<# if uses_lifetime { #><'a><# } #> + <# } #> + { + <# if e.msg.attributes.is_empty() { #> + c2s::Out<#= e.msg.name #>Message::new() + <# } else { #> + <# create_message(_fmt, e, None, msg_group, &self.messages)?; #> + <# } #> + } +} + +<# if !e.rules.is_empty() { #> +pub trait M2B<#= e.msg.name #>Ext<# if uses_lifetime { #><'a><# } #> { +<# for r in &e.rules { + let name = r.from_name(); + #> + fn set_<#= name.to_snake_case() #>(self, <#= r.get_argument_no_option() + .replace('&', "&'a ") #>) -> Self; +<# } #> +} + +impl<# if uses_lifetime { #><'a><# } #> M2B<#= e.msg.name #>Ext<# if uses_lifetime { #><'a><# } #> for c2s::Out<#= e.msg.name #>Part<# if uses_lifetime { #><'a><# } #> { +<# for r in &e.rules { + let name = r.from_name(); + let from_name; + match r { + RuleKind::Map { from, .. } => { + from_name = format!("self.{}", from.name.to_snake_case()); + } + RuleKind::ArgumentMap { .. } => from_name = r.from_name().to_snake_case(), + RuleKind::Function { .. } + | RuleKind::ArgumentFunction { .. } => from_name = r.from_name().to_snake_case(), + } + #> + fn set_<#= name.to_snake_case() #>(mut self, <#= r.get_argument_no_option() + .replace('&', "&'a ") #>) -> Self { + <# call_func2(_fmt, &e.book_struct.name, r)?; #> + <# match r { + RuleKind::Map { to, .. } + | RuleKind::ArgumentMap { to, .. } => { #> + self.<#= to.get_rust_name() #> = Some(<#= r.from_name().to_snake_case() #>.into()); + <# } + RuleKind::Function { to, .. } + | RuleKind::ArgumentFunction { to, .. } => { + for t in to { #> + self.<#= t.get_rust_name() #> = Some(<#= t.get_rust_name() #>.into()); + <# } + } + } #> + self + } +<# } #> +} +<# } #> +<# + } else if e.op == RuleOp::Remove { + if e.rules.is_empty() { + let args = get_all_arguments(e, None); + let name_add = if !args.is_empty() { + format!("_{}", &args[2..args.find(':').unwrap()]) + } else { + "".into() + }; #> + +impl <#= e.book_struct.name #> { + pub fn remove<#= name_add #>(&self<#= args #>) -> OutCommand { + c2s::Out<#= e.msg.name #>Message::new(&mut std::iter::once({ + <# create_message(_fmt, e, None, msg_group, &self.messages)?; #> + })<# if msg_group.default.response { #>, None<# } #>) + } +} +<# } else { + // Remove the property + for r in &e.rules { + let args = get_all_arguments(e, Some(r)); + let name_add = if !args.is_empty() { + format!("_{}", &args[2..args.find(':').unwrap()]) + } else { + "".into() + }; #> + +impl <#= e.book_struct.name #> { + pub fn remove<#= name_add #>(&self<#= args #>) -> OutCommand { + c2s::Out<#= e.msg.name #>Message::new(&mut std::iter::once({ + <# create_message(_fmt, e, Some(r), msg_group, &self.messages)?; #> + })<# if msg_group.default.response { #>, None<# } #>) + } +} + <# } + } + } else if e.op == RuleOp::Add { + for r in &e.rules { + let name = r.from_name_singular(); + #> + +impl <#= e.book_struct.name #> { + pub fn add_<#= name.to_snake_case() #>(&self<#= get_all_arguments(e, Some(r)) #>) -> OutCommand { + c2s::Out<#= e.msg.name #>Message::new(&mut std::iter::once({ + <# create_message(_fmt, e, Some(r), msg_group, &self.messages)?; #> + })<# if msg_group.default.response { #>, None<# } #>) + } +} + <# } + } +} #> diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Events.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Events.tt new file mode 100644 index 0000000..bd7b93a --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Events.tt @@ -0,0 +1,88 @@ +<#@ template cleanws="true" #> +/// A `PropertyId` identifies a single attribute in the data structure of a +/// connection. +#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[non_exhaustive] +pub enum PropertyId { +<# for struc in &self.structs { #> + <#= struc.name #><#= struc.get_ids(&self.structs) #>, +<# } #> + +<# for struc in self.structs.iter().filter(|s| !s.opt) { + for p in struc.get_properties(&self.structs) { #> + <#= struc.name #><#= p.get_name() #><#= p.get_ids(&self.structs, struc) #>, +<# } +} #> +} + +/// A `PropertyValue` contains the value of an attribute in the data structures. +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +#[non_exhaustive] +pub enum PropertyValue { +<# for struc in &self.structs { #> + <#= struc.name #>(<#= struc.get_type()? #>), +<# } #> + +<# +let mut done = HashSet::new(); +for struc in self.structs.iter().filter(|s| !s.opt) { + for p in struc.get_properties(&self.structs) { + let type_s = p.get_inner_type()?; + if !done.insert(type_s.to_string()) { + continue; + } + #> + <#= p.get_inner_type_as_name()? #>(<#= type_s #>), +<# } +} #> +} + +/// A `PropertyValueRef` contains a reference to the value of an attribute in +/// the data structures. +/// +/// See [`PropertyValue`] for the owned variant. +#[derive(Clone, Debug, PartialEq)] +#[non_exhaustive] +pub enum PropertyValueRef<'a> { +<# for struc in &self.structs { #> + <#= struc.name #>(<#= struc.get_type()?.lifetime(true).to_ref(true) #>), +<# } #> + +<# +let mut done = HashSet::new(); +for struc in self.structs.iter().filter(|s| !s.opt) { + for p in struc.get_properties(&self.structs) { + let type_s = p.get_inner_type()?; + if !done.insert(type_s.to_string()) { + continue; + } + #> + <#= p.get_inner_type_as_name()? #>(<#= p.get_inner_type()?.lifetime(true).to_ref(true) #>), +<# } +} #> +} + +impl PropertyValue { + pub fn as_ref(&self) -> PropertyValueRef<'_> { + match self { +<# for struc in &self.structs { #> + PropertyValue::<#= struc.name #>(s) => PropertyValueRef::<#= struc.name #>(<#= struc.get_type()?.code_as_ref("s").trim_start_matches('&') #>), +<# } #> + +<# +let mut done = HashSet::new(); +for struc in self.structs.iter().filter(|s| !s.opt) { + for p in struc.get_properties(&self.structs) { + let inner_type = p.get_inner_type()?; + if !done.insert(inner_type.to_string()) { + continue; + } + let name = inner_type.to_name(); + let has_ref = inner_type.lifetime(true).to_ref(true).uses_lifetime(); + #> + PropertyValue::<#= name #>(s) => PropertyValueRef::<#= name #>(<#= inner_type.wrap_ref().code_as_ref("s").trim_start_matches('&') #>), +<# } +} #> + } + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessageDeclarations.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessageDeclarations.tt new file mode 100644 index 0000000..873f577 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessageDeclarations.tt @@ -0,0 +1,340 @@ +<#@ template cleanws="true" #> +use std::borrow::Cow; +// Needed for vector serialization +#[allow(unused_imports)] +use std::fmt::Write as _; +use std::str; + +use base64::prelude::*; +use num_traits::{FromPrimitive, ToPrimitive}; +use tracing::{instrument, warn}; +use tsproto_packets::commands::{CommandItem, CommandParser}; +use tsproto_packets::packets::*; + +#[derive(Clone, Debug)] +#[non_exhaustive] +pub enum InMessage { +<# for msg_group in &self.0.msg_group { + for msg in &msg_group.msg { #> + <#= msg.name #>(In<#= msg.name #>), +<# } +} #> +} + +impl InMessage { + /// Parse a message into a struct. + pub fn new(header: &InHeader, cmd: &[u8]) -> Result { + let (name, args) = CommandParser::new(cmd); + match name { + <# + let mut msgs: Vec<_> = self.0.msg_group.iter() + .flat_map(|g| g.msg.iter()) + .filter(|m| m.notify.is_some()) + .collect(); + msgs.sort_unstable_by_key(|m| m.notify.as_ref().map(|s| s.as_str()).unwrap()); + for (notify, group) in &msgs.iter().group_by(|m| m.notify.as_ref().map(|s| s.as_str()).unwrap()) { + let group: Vec<_> = group.collect(); + let (msg, group) = group.split_last().unwrap(); + #> + b"<#= notify #>" => <# for msg in group { + #>if let Ok(r) = In<#= msg.name #>::new(header, args.clone()) { + Ok(InMessage::<#= msg.name #>(r)) + } else <# + } #>{ + Ok(InMessage::<#= msg.name #>(In<#= msg.name #>::new(header, args)?)) + } + <# } #> + s => Err(ParseError::UnknownCommand(str::from_utf8(s)?.to_string())), + } + } + + pub fn get_command_name(&self) -> &'static str { + match self { + <# for msg_group in &self.0.msg_group { + for msg in &msg_group.msg { #> + InMessage::<#= msg.name #>(_) => "<#= if let Some(s) = &msg.notify { s } else { &msg.name } #>", + <# } + } #> + } + } +} + +<# for msg_group in &self.0.msg_group { + for msg in &msg_group.msg { + let has_attributes = !msg.attributes.is_empty(); #> +#[derive(Clone, Debug)] +pub struct In<#= msg.name #> { + <# if msg_group.default.response { #> + pub return_code: Option, + <# } + if has_attributes { #> + list: VecPart>, + <# } #> +} +<# if has_attributes { #> + +#[derive(Clone, Debug)] +pub struct In<#= msg.name #>Part { + <# for a in &msg.attributes { + let field = self.0.get_field(a); + if field.get_rust_name() != field.ts { #> + /// `<#= field.ts #>` in TeamSpeak + <# } #> + pub <#= field.get_rust_name() #>: <#= field.get_type(a)? #>, + <# } #> +} +<# } #> + +impl InMessageTrait for In<#= msg.name #> { + #[instrument(name = "parse_message", skip(header, <# if !has_attributes { #>_<# } #>args))] + fn new(header: &InHeader, <# if !has_attributes { #>_<# } #>args: CommandParser) -> Result { + // TODO newprotocol + //if <#= if msg_group.default.np { "!" } else { "" } #>header.flags().contains(Flags::NEWPROTOCOL) { return Err(ParseError::WrongNewprotocol(<#= if msg_group.default.np { "false" } else { "true" } #>)); } + if header.packet_type() != PacketType::Command<#= if msg_group.default.low { "Low" } else { "" } #> { return Err(ParseError::WrongPacketType(header.packet_type())); } + <# if !msg_group.default.s2c { #> + if header.direction() == Direction::S2C { return Err(ParseError::WrongDirection(header.direction())); } + <# } #> + <# if !msg_group.default.c2s { #> + if header.direction() == Direction::C2S { return Err(ParseError::WrongDirection(header.direction())); } + <# } #> + + <# if msg_group.default.response { #> + let mut return_code = None; + <# } #> + <# for a in &msg.attributes { #> + let mut <#= self.0.get_field(a).get_rust_name() #> = None; + <# } #> + + <# if !has_attributes { #> + Ok(In<#= msg.name #> {<# if msg_group.default.response { #> return_code <# } #>}) + <# } else { #> + let mut list = Vec::Part>::new(); + for item in args.chain(std::iter::once(CommandItem::NextCommand)) { + match item { + CommandItem::NextCommand => { + // Build command + let new = In<#= msg.name #>Part { + <# for a in &msg.attributes { + let field = self.0.get_field(a); + let transform_func = if !field.get_type(a)?.is_primitive() { + ".clone()" + } else { + "" + }; #> + <#= field.get_rust_name() #>: <#= field.get_rust_name() #> + <# if !a.ends_with('?') { /* is not optional */ #> + .take() + .or_else(|| list.first().map(|p| p.<#= field.get_rust_name() #><#= transform_func #>)) + .ok_or(ParseError::ParameterNotFound { arg: "<#= field.pretty #>", name: "<#= msg.name #>", })?, + <# } else { #> + .take() + .or_else(|| list.first().and_then(|p| p.<#= field.get_rust_name() #><#= transform_func #>)), + <# } #> + <# } #> + }; + list.push(new); + } + CommandItem::Argument(arg) => { + match arg.name() { + <# for a in &msg.attributes { + let field = self.0.get_field(a); #> + b"<#= field.ts #>" => { + let val = arg.value().get_str()?; + let val = val.as_ref(); + <#= field.get_rust_name() #> = Some({ + <# #><#= generate_deserializer(field) #> + }); + } + <# } #> + <# if msg_group.default.response { #> + b"return_code" => { + if return_code.is_some() { + warn!(command = "<#= msg.name #>", "Got multiple return codes"); + } + return_code = Some(arg.value().get_str()?.into_owned()); + } + <# } #> + s => warn!(command = "<#= msg.name #>", argument = ?str::from_utf8(s), + "Unknown argument"), + } + } + } + } + + Ok(In<#= msg.name #> {<# if msg_group.default.response { #> return_code,<# } #> list }) + <# } #> + } +} + +<# if has_attributes { #> +impl In<#= msg.name #> { + #[inline] + pub fn iter(&self) -> InMessageIteratorPart> { self.into_iter() } +} + +impl<'a> IntoIterator for &'a In<#= msg.name #> { + type Item = &'a In<#= msg.name #>Part; + type IntoIter = InMessageIterator<'a, In<#= msg.name #>Part>; + #[inline] + fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) } +} + +impl In<#= msg.name #>Part { + pub fn get_invoker(&self) -> Option { + <# + let mut has_invoker_id = false; + let mut has_invoker_name = false; + let mut has_invoker_uid = false; + let mut invoker_optional = true; + + for a in &msg.attributes { + let field = self.0.get_field(a); + match field.ts.as_str() { + "invokerid" => { + has_invoker_id = true; + invoker_optional = a.ends_with('?'); + } + "invokername" => has_invoker_name = true, + "invokeruid" => has_invoker_uid = true, + _ => {} + } + } + + if has_invoker_id && has_invoker_name && has_invoker_uid { #> + <# if invoker_optional { #> + let id = self.invoker_id?; + let name = self.invoker_name.clone()?; + let uid = self.invoker_uid.clone(); + <# } else { #> + let id = self.invoker_id; + let name = self.invoker_name.clone(); + let uid = self.invoker_uid.clone(); + <# } #> + Some(Invoker { + id, + name, + uid, + }) + <# } else { #> + None + <# } #> + } + + pub fn as_out(&self) -> Out<#= msg.name #>Part { + Out<#= msg.name #>Part { + <# + let mut uses_lifetime = false; + for a in &msg.attributes { + let field = self.0.get_field(a); + let ty = field.get_type(a)?; + let mut from = ty + .code_as_ref("field") + .replacen("field", &format!("self.{}", field.get_rust_name()), 1); + if ty.to_cow().is_cow() { + if ty.is_opt() { + from.push_str(".map(Cow::Borrowed)"); + } else { + from = format!("Cow::Borrowed({})", from); + } + } #> + <#= field.get_rust_name() #>: <#= from #>, + <# } #> + } + } +} +<# } #> + +<# } +} #> + +/// The iterator is guaranteed to output at least one part. +pub struct InMessageIterator<'a, T>(&'a [T], usize); +impl<'a, T> Iterator for InMessageIterator<'a, T> { + type Item = &'a T; + fn next(&mut self) -> Option { + let i = self.1; + self.1 += 1; + self.0.get(i) + } +} + +<# for msg_group in &self.0.msg_group { + let defs = &msg_group.default; + for msg in &msg_group.msg { + let uses_lifetime = self.0.uses_lifetime(msg); + let has_attributes = msg_group.default.response || !msg.attributes.is_empty(); #> + +<# if has_attributes { #> +#[derive(Clone, Debug)] +pub struct Out<#= msg.name #>Part<# if uses_lifetime { #><'a><# } #> { +<# for a in &msg.attributes { + let field = self.0.get_field(a); + if field.get_rust_name() != field.ts { #> + /// `<#= field.ts #>` in TeamSpeak + <# } #> + pub <#= field.get_rust_name() #>: <#= field.get_type(a)?.to_cow().lifetime(true) #>, +<# } #> +} + +<# +let part_name = format!("Out{}Part{}", msg.name, if uses_lifetime { "<'a>" } else { "" }); +#> +impl<<# if uses_lifetime { #>'a, <# } #>> OutMessage<# if msg_group.default.response { #>WithReturn<# } #>Trait for &mut dyn Iterator> { + fn to_packet(self<# + if msg_group.default.response { #>, return_code: Option<&str><# } #>) -> OutCommand + where Self: Sized { + Out<#= msg.name #>Message::new(self<# + if msg_group.default.response { #>, return_code<# } #>) + } +} + +impl<<# if uses_lifetime { #>'a, <# } #>> OutMessage<# if msg_group.default.response { #>WithReturn<# } #>Trait for <#= part_name #> { + fn to_packet(self<# + if msg_group.default.response { #>, return_code: Option<&str><# } #>) -> OutCommand + where Self: Sized { + Out<#= msg.name #>Message::new(&mut std::iter::once(self)<# + if msg_group.default.response { #>, return_code<# } #>) + } +} + +<# } #> +pub struct Out<#= msg.name #>Message; +impl Out<#= msg.name #>Message { + #[allow(clippy::let_and_return, clippy::new_ret_no_self)] + pub fn new(<# if has_attributes { #>parts: &mut dyn IteratorPart><# + if msg_group.default.response { #>, return_code: Option<&str><# } } #>) -> OutCommand { + let<# if has_attributes { #> mut<# } #> packet = OutCommand::new( + Direction::<#= if msg_group.default.s2c { "S2C" } else { "C2S" } #>, + Flags::<#= if msg_group.default.np { "NEWPROTOCOL" } else { "empty()" } #>, + PacketType::Command<# if msg_group.default.low { #>Low<# } #>, + "<#= msg.notify.as_ref().map(|s| s.as_str()).unwrap_or("") #>", + ); + <# if msg_group.default.response { #> + if let Some(r) = return_code { + packet.write_arg("return_code", &r); + } + <# } #> + <# if !msg.attributes.is_empty() { #> + let mut first = true; + for p in parts { + if first { + first = false; + } else { + packet.start_new_part(); + } + <# for a in &msg.attributes { + let field = self.0.get_field(a); + if a.ends_with('?') { #> + if let Some(val) = p.<#= field.get_rust_name() #> { packet.write_arg("<#= field.ts #>", <#= generate_serializer(field, "val") #>); } + <# } else { #> + packet.write_arg("<#= field.ts #>", <#= generate_serializer(field, &format!("p.{}", field.get_rust_name())) #>); + <# } #> + <# } #> + } + <# } #> + + packet + } +} +<# } +} #> diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessagesToBook.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessagesToBook.tt new file mode 100644 index 0000000..359c749 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/MessagesToBook.tt @@ -0,0 +1,439 @@ +<#@ template cleanws="true" #> +<# +/// Push into events the difference between two arrays. +/// +/// The old value is stored in `old`, the `new` in the book. +fn diff(_fmt: &mut std::fmt::Formatter, new: &str, event: &Event, p: &Property, from: &Field) -> std::fmt::Result { + let mut ids = event.get_id_args("m"); + let type_s = p.get_inner_type_as_name()?; + let added; + let removed; + let modifier = from.modifier.as_ref().unwrap(); + if modifier == "array" { + added = format!("iter().filter(|n| !old.contains(n))"); + removed = format!("into_iter().filter(|o| !{}.contains(o))", new); + } else if modifier == "set" { + added = format!("difference(&old)"); + removed = format!("difference(&{})", new); + } else { + panic!("Unsupported modifier {}", modifier); + } +#> + // Added + for i in <#= new #>.<#= added #> { + events.push(Event::PropertyAdded { + id: PropertyId::<#= event.book_struct.name #><#= p.get_name() #>(<#= ids #>, *i), + invoker: invoker.clone(), + extra: ExtraInfo { + reason, + }, + }); + } + + // Removed + for i in old.<#= removed #> { + events.push(Event::PropertyRemoved { + id: PropertyId::<#= event.book_struct.name #><#= p.get_name() #>(<#= ids #>, i), + old: PropertyValue::<#= type_s #>(i), + invoker: invoker.clone(), + extra: ExtraInfo { + reason, + }, + }); + } +<# + Ok(()) +} + +fn create_event(_fmt: &mut std::fmt::Formatter, event: &Event, change: &str, old: bool) -> std::fmt::Result { + let ids = embrace(&event.get_id_args("m")); + #> + events.push(Event::Property<#= change #> { + id: PropertyId::<#= event.book_struct.name #><#= ids #>, + <# if old { #> + old: PropertyValue::<#= event.book_struct.name #>(old), + <# } #> + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + <# + Ok(()) +} + +fn create_add_rule(_fmt: &mut std::fmt::Formatter, event: &Event) -> std::fmt::Result { + // Create a new object + // First, call all functions + for fun in event.rules.iter().filter(|r| r.is_function()) { + if let RuleKind::Function { name, to } = fun { + let return_match = if to.len() == 1 { + to[0].name.to_snake_case() + } else { + format!("({})", to.iter().map(|p| p.name.to_snake_case()).collect::>().join(", ")) + }; #> + let <#= return_match #> = self.<#= name.to_snake_case() #>(m, &mut events)?; + <# } + } #> + let r = <#= event.book_struct.name #> { + <# + // Add ids + for (id, fld) in event.book_struct.id.iter().zip(event.id.iter()) { #> + <#= PropId::from(id).get_attr_name(&event.book_struct) #>: m.<#= fld.get_rust_name() #>.clone(), + <# } + + let v = vec![]; + // Function return values + for p in event.rules.iter() + .flat_map(|f| if let RuleKind::Function { to, .. } = f { + to + } else { + &v + }) { #> + <#= p.name.to_snake_case() #>, + <# } + for p in event.rules.iter() { + if let RuleKind::Map { from, to, op } = p { + if *op != RuleOp::Update { + panic!("Cannot add or remove when adding a new struct"); + } + let transform_func = if to.is_set() { + // Convert to set + ".iter().cloned().collect()" + } else if !to.get_type()?.is_primitive() { + ".clone()" + } else { + "" + }; + // to is optional, but from not + let from_opt = from.is_opt(&event.msg); #> + <#= to.name.to_snake_case() #>: <# + if to.opt && !from_opt { + #>Some(m.<#= from.get_rust_name() #><#= transform_func #>), + <# } else { + #>m.<#= from.get_rust_name() #><#= transform_func #>, + <# } + } + } #> + }; + <# + Ok(()) +} + +#> +impl Connection { + /// Return if the message was handled and the generated events. + fn handle_command_generated(&mut self, msg: &InMessage) -> Result<(bool, Vec)> { + let mut events = Vec::new(); + match msg { +<# +// Group events by message +let mut groups = HashMap::new(); +for event in &self.decls { + let group = groups.entry(event.msg.name.as_str()).or_insert_with(Vec::new); + group.push(event); +} + +for (msg_name, group) in groups { + let event = &group[0]; #> + InMessage::<#= msg_name #>(m) => for m in m.iter() { + #[allow(unused_variables)] + let invoker = m.get_invoker(); + #[allow(unused_variables)] + <# if event.msg.attributes.iter().any(|a| a == "reasonid") { #> + let reason = Some(m.reason); + <# } else if event.msg.attributes.iter().any(|a| a == "reasonid?") { #> + let reason = m.reason; + <# } else { #> + let reason: Option = None; + <# } #> +<# + for event in group { + let book_name = &event.book_struct.name; +#> + + <# if event.op == RuleOp::Remove { + let function_name = format!("remove_{}", book_name.to_snake_case()); + let mut ids = event.get_id_args("m"); + if !ids.is_empty() { ids.push_str(", "); } + if !event.book_struct.opt { #> + let old = self.<#= function_name #>(<#= ids #>&mut events)? + .ok_or(Error::RemoveNotFound("<#= book_name #>"))?; + <# } else { #> + let old = self.<#= function_name #>(<#= ids #>&mut events)?; + <# } + create_event(_fmt, event, "Removed", true)?; + } else if event.op == RuleOp::Update && !event.book_struct.opt { + // Update the object + // Functions first + let mut rule_count = event.rules.len(); + for rule in &event.rules { + if let RuleKind::Function { name, to } = rule { + rule_count -= 1; #> + self.<#= name.to_snake_case() #>(<#= event.get_id_args("m") #>, m, &mut events)?; + <# } + } + let function_name = format!("get_mut_{}", book_name.to_snake_case()); + + // Only print if necessary + if rule_count > 0 { #> + let r = self.<#= function_name #>(<#= event.get_id_args("m") #>)?; + <# } + for rule in &event.rules { + match rule { + RuleKind::Map { from, to, op } => { + // Put field from packet into bookkeeping struct + match op { + RuleOp::Update => { + let from_opt = from.is_opt(&event.msg); + // to/book is optional, but from/message not + if to.opt && !from_opt { #> + let old = mem::replace(&mut r.<#= to.name.to_snake_case() #>, Some(m.<#= from.get_rust_name() #><# if !to.get_type()?.is_primitive() { #>.clone()<# } #>)); + events.push(Event::PropertyChanged { + id: <#= event.get_property_id(to, from, "m") #>, + old: <#= get_property(to, "old") #>, + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + <# } else if from_opt { + let mut prefix = ""; + let transform_func = if to.is_set() { + ".iter().cloned().collect()" + } else if !to.get_type()?.is_primitive() { + ".clone()" + } else { + prefix = "*"; + "" + }; #> + if let Some(val) = &m.<#= from.get_rust_name() #> { + <# if to.opt { #> + let old = mem::replace(&mut r.<#= to.name.to_snake_case() #>, Some(<#= prefix #>val<#= transform_func #>)); + <# } else { #> + let old = mem::replace(&mut r.<#= to.name.to_snake_case() #>, <#= prefix #>val<#= transform_func #>); + <# } #> + <# if from.modifier.as_ref().map(|s| s == "array" || s == "set").unwrap_or(false) { + diff(_fmt, &format!("r.{}", to.name.to_snake_case()), event, to, from)?; + } else { #> + events.push(Event::PropertyChanged { + id: <#= event.get_property_id(to, from, "m") #>, + old: <#= get_property(to, "old") #>, + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + <# } #> + } + <# } else { + // Nothing is optional + #> + let old = mem::replace(&mut r.<#= to.name.to_snake_case() #>, m.<#= from.get_rust_name() #>.clone()); + events.push(Event::PropertyChanged { + id: <#= event.get_property_id(to, from, "m") #>, + old: <#= get_property(to, "old") #>, + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + <# } + } + // The field in the struct is a vector + RuleOp::Add => { + if to.is_set() { #> + r.<#= to.name.to_snake_case() #>.insert(m.<#= from.get_rust_name() #>.clone()); + <# } else { #> + r.<#= to.name.to_snake_case() #>.push(m.<#= from.get_rust_name() #>.clone()); + <# } #> + events.push(Event::PropertyAdded { + id: <#= event.get_property_id(to, from, "m") #>, + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + <# } + RuleOp::Remove => { + if to.is_set() { #> + if r.<#= to.name.to_snake_case() #>.remove(&m.<#= from.get_rust_name() #>) { + let old = m.<#= from.get_rust_name() #>; + <# } else { #> + // Find index and remove + if let Some(i) = r.<#= to.name.to_snake_case() #>.iter().position(|i| *i == m.<#= from.get_rust_name() #>) { + let old = r.<#= to.name.to_snake_case() #>.remove(i); + <# } #> + events.push(Event::PropertyRemoved { + id: <#= event.get_property_id(to, from, "m") #>, + old: <#= get_property(to, "old") #>, + invoker: invoker.clone(), + extra: ExtraInfo { reason }, + }); + } + <# } + } + } + + RuleKind::Function { to, .. } => {} + } + } + } else if event.op == RuleOp::Update && event.book_struct.opt { + // Optional structs that get only updated as a whole + + // Create a new object + // First, call all functions + for fun in event.rules.iter().filter(|r| r.is_function()) { + if let RuleKind::Function { name, to } = fun { + let return_match = if to.len() == 1 { + to[0].name.to_snake_case() + } else { + format!("({})", to.iter().map(|p| p.name.to_snake_case()).collect::>().join(", ")) + }; #> + let <#= return_match #> = self.<#= name.to_snake_case() #>(m, &mut events)?; + <# } + } + + // Check if all required data are available + // Pairs of (property, string to get the property) + let mut opt_props = Vec::new(); + let mut props = Vec::new(); + let v = Vec::new(); + // Function return values + for p in event.rules.iter() + .flat_map(|f| if let RuleKind::Function { to, .. } = f { + to + } else { + &v + }) { + opt_props.push((p.name.to_snake_case(), p.name.to_snake_case())); + } + + for p in event.rules.iter() { + if let RuleKind::Map { from, to, op } = p { + if *op != RuleOp::Update { + panic!("Cannot add or remove when adding a new struct"); + } + let transform_func = if to.is_set() { + // Convert to set + ".iter().cloned().collect()" + } else if !to.get_type()?.is_primitive() { + ".clone()" + } else { + "" + }; + let from_opt = from.is_opt(&event.msg); + if to.opt && !from_opt { + // to is optional, but from not + let getter = format!("Some(m.{}{})", from.get_rust_name(), transform_func); + props.push((to.name.to_snake_case(), getter)); + } else { + let getter = format!("m.{}{}", from.get_rust_name(), transform_func); + if from_opt && !to.opt { + opt_props.push((to.name.to_snake_case(), getter)); + } else { + props.push((to.name.to_snake_case(), getter)); + } + } + } + } + + if !opt_props.is_empty() { + let mut matcher = opt_props.iter().map(|(p, _)| format!("Some({})", p)).collect::>().join(", "); + let mut getter = opt_props.iter().map(|(_, p)| p.as_str()).collect::>().join(", "); + if opt_props.len() > 1 { + matcher = format!("({})", matcher); + getter = format!("({})", getter); + } + #> + if let <#= matcher #> = <#= getter #> { + <# } #> + let r = <#= event.book_struct.name #> { + <# + // Add ids + for (id, fld) in event.book_struct.id.iter().zip(event.id.iter()) { #> + <#= PropId::from(id).get_attr_name(&event.book_struct) #>: m.<#= fld.get_rust_name() #>.clone(), + <# } + for (p, _) in &opt_props { #> + <#= p #>, + <# } + for (p, g) in &props { + if p != g { #> + <#= p #>: <#= g #>, + <# } else { #> + <#= p #>, + <# } + } #> + }; + <# + let function_name = format!("replace_{}", book_name.to_snake_case()); + let ids = event.get_id_args("m"); + let comma = if ids.is_empty() { "" } else { ", " }; + #> + let old = self.<#= function_name #>(<#= ids #><#= comma #>r, &mut events)?; + <# create_event(_fmt, event, "Changed", true)?; + if !opt_props.is_empty() { #> + } + <# } + } else if event.op == RuleOp::Add { + // Create a new object + // First, call all functions + for fun in event.rules.iter().filter(|r| r.is_function()) { + if let RuleKind::Function { name, to } = fun { + let return_match = if to.len() == 1 { + to[0].name.to_snake_case() + } else { + format!("({})", to.iter().map(|p| p.name.to_snake_case()).collect::>().join(", ")) + }; #> + let <#= return_match #> = self.<#= name.to_snake_case() #>(m, &mut events)?; + <# } + } #> + let r = <#= event.book_struct.name #> { + <# + // Add ids + for (id, fld) in event.book_struct.id.iter().zip(event.id.iter()) { #> + <#= PropId::from(id).get_attr_name(&event.book_struct) #>: m.<#= fld.get_rust_name() #><# if !id.find_property(&self.book.structs).get_type()?.is_primitive() { #>.clone()<# } #>, + <# } + + let v = vec![]; + // Function return values + for p in event.rules.iter() + .flat_map(|f| if let RuleKind::Function { to, .. } = f { + to + } else { + &v + }) { #> + <#= p.name.to_snake_case() #>, + <# } + for p in event.rules.iter() { + if let RuleKind::Map { from, to, op } = p { + if *op != RuleOp::Update { + panic!("Cannot add or remove when adding a new struct"); + } + let transform_func = if to.is_set() { + // Convert to set + ".iter().cloned().collect()" + } else if !to.get_type()?.is_primitive() { + ".clone()" + } else { + "" + }; + // to is optional, but from not + let from_opt = from.is_opt(&event.msg); #> + <#= to.name.to_snake_case() #>: <# + if to.opt && !from_opt { + #>Some(m.<#= from.get_rust_name() #><#= transform_func #>), + <# } else { + #>m.<#= from.get_rust_name() #><#= transform_func #>, + <# } + } + } #> + }; + <# + // TODO Previous function end + let function_name = format!("add_{}", book_name.to_snake_case()); + let ids = event.get_id_args("m"); #> + self.<#= function_name #>(<#= ids #>, r, &mut events)?; + <# create_event(_fmt, event, "Added", false)?; + } #> +<# } #> + } +<# } #> + _ => { + // Ignore unmentioned messages + return Ok((false, events)); + } + } + Ok((true, events)) + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Properties.tt b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Properties.tt new file mode 100644 index 0000000..f0a0e1f --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/Properties.tt @@ -0,0 +1,55 @@ +<#@ template cleanws="true" #> +impl Connection { + /// Get a property by its id. + pub fn get_property(&self, id: &PropertyId) -> Result> { + Ok(match id { +<# for struc in &self.0.structs { + let mut ids = embrace(&get_ids(struc)); + let mut ids2 = get_ids2(&self.0.structs, struc); + ids2 = format!("({})", ids2); #> + PropertyId::<#= struc.name #><#= ids #> => PropertyValueRef::<#= struc.name #>(self.get_<#= struc.name.to_snake_case() #><#= ids2 #>?), +<# } #> + +<# for struc in self.0.structs.iter().filter(|s| !s.opt) { + for p in struc.get_properties(&self.0.structs) { + let type_s = p.get_inner_type_as_name()?; + + let mut ids = get_ids(struc); + if p.modifier.is_some() { + if !ids.is_empty() { + ids.push_str(", "); + } + ids.push_str("m"); + } + ids = embrace(&ids); + + let mut ids2 = format!("({})", get_ids2(&self.0.structs, struc)); + #> + PropertyId::<#= struc.name #><#= p.get_name() #><#= ids + #> => PropertyValueRef::<#= type_s #>(self.get_<#= + struc.name.to_snake_case() #><#= ids2 #>?.<#= + p.name.to_snake_case() #><# + if p.modifier.as_ref().map(|s| s == "map").unwrap_or(false) { + #>.get(*m) + .ok_or_else(|| Error::NotFound("<#= p.name #>", m.to_string()))?<# + } else if p.modifier.as_ref().map(|s| s == "array").unwrap_or(false) { + #>.iter()<# + if p.type_s != "str" { #>.cloned().find(|i| i == m)<# + } else { #>.find(|i| *i == m)<# } #> + .ok_or_else(|| Error::NotFound("<#= p.name #>", m.to_string()))?<# + } else if p.modifier.as_ref().map(|s| s == "set").unwrap_or(false) { + #>.get(m)<# + if p.type_s != "str" { #>.cloned()<# } #> + .ok_or_else(|| Error::NotFound("<#= p.name #>", m.to_string()))?<# + } + + if p.opt && (p.type_s == "str" || p.type_s == "Uid") { + #>.as_ref().map(|r| r.as_ref())<# + } else if p.type_s == "str" || p.type_s == "Uid" || ["TalkPowerRequest", "EccKeyPubP256"].contains(&p.type_s.as_str()) { + #>.as_ref()<# + } #>), +<# } +} #> + }) + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_parser.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_parser.rs new file mode 100644 index 0000000..9aec237 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_parser.rs @@ -0,0 +1,13 @@ +use std::default::Default; + +use t4rust_derive::Template; +use tsproto_structs::*; + +#[derive(Template)] +#[TemplatePath = "build/BookDeclarations.tt"] +#[derive(Debug)] +pub struct BookDeclarations<'a>(pub &'a book::BookDeclarations); + +impl Default for BookDeclarations<'static> { + fn default() -> Self { BookDeclarations(&tsproto_structs::book::DATA) } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_to_messages_parser.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_to_messages_parser.rs new file mode 100644 index 0000000..ac5d6c2 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/book_to_messages_parser.rs @@ -0,0 +1,71 @@ +use std::default::Default; +use std::ops::Deref; + +use heck::*; +use t4rust_derive::Template; +use tsproto_structs::book_to_messages::*; +use tsproto_structs::messages::Field; +use tsproto_structs::*; + +#[derive(Template)] +#[TemplatePath = "build/BookToMessages.tt"] +#[derive(Debug)] +pub struct BookToMessagesDeclarations<'a>(&'a book_to_messages::BookToMessagesDeclarations<'a>); + +impl<'a> Deref for BookToMessagesDeclarations<'a> { + type Target = book_to_messages::BookToMessagesDeclarations<'a>; + fn deref(&self) -> &Self::Target { self.0 } +} + +impl Default for BookToMessagesDeclarations<'static> { + fn default() -> Self { BookToMessagesDeclarations(&DATA) } +} + +fn get_to_list(to: &[&Field]) -> String { + let mut res = String::new(); + if to.len() > 1 { + res.push('('); + } + + let mut first = true; + for t in to { + if !first { + res.push_str(", "); + } else { + first = false; + } + res.push_str(&t.get_rust_name()); + } + + if to.len() > 1 { + res.push(')'); + } + res +} + +/// The prefix is written before from, if from is a mapped argument +fn rule_has_to(r: &RuleKind, field: &Field) -> bool { + match r { + RuleKind::Map { to, .. } | RuleKind::ArgumentMap { to, .. } => to == &field, + RuleKind::ArgumentFunction { to, .. } | RuleKind::Function { to, .. } => { + to.contains(&field) + } + } +} + +/// Finds a matching rule in either the event ids or the given rule. +fn find_rule<'a>( + e: &'a Event, r: Option<&'a RuleKind>, field: &Field, +) -> (bool, Option<&'a RuleKind<'a>>) { + if let Some(r) = r { + if rule_has_to(r, field) { + return (true, Some(r)); + } + } + for r in &e.ids { + if rule_has_to(r, field) { + return (false, Some(r)); + } + } + (false, None) +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/build.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/build.rs new file mode 100644 index 0000000..e80cbc3 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/build.rs @@ -0,0 +1,52 @@ +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::path::Path; + +mod book_parser; +mod book_to_messages_parser; +mod events; +mod message_parser; +mod messages_to_book_parser; +mod properties; + +use crate::book_parser::BookDeclarations; +use crate::book_to_messages_parser::BookToMessagesDeclarations; +use crate::events::EventDeclarations; +use crate::message_parser::MessageDeclarations; +use crate::messages_to_book_parser::MessagesToBookDeclarations; +use crate::properties::Properties; + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap(); + + // Book declarations + let path = Path::new(&out_dir); + let mut structs = File::create(path.join("structs.rs")).unwrap(); + write!(&mut structs, "{}", BookDeclarations::default()).unwrap(); + + // Messages to book + let mut structs = File::create(path.join("m2bdecls.rs")).unwrap(); + write!(&mut structs, "{}", MessagesToBookDeclarations::default()).unwrap(); + + // Write messages + let decls = MessageDeclarations::s2c(); + let mut structs = File::create(path.join("s2c_messages.rs")).unwrap(); + write!(&mut structs, "{}", MessageDeclarations(&decls)).unwrap(); + + let decls = MessageDeclarations::c2s(); + let mut structs = File::create(path.join("c2s_messages.rs")).unwrap(); + write!(&mut structs, "{}", MessageDeclarations(&decls)).unwrap(); + + // Book to messages + let mut structs = File::create(path.join("b2mdecls.rs")).unwrap(); + write!(&mut structs, "{}", BookToMessagesDeclarations::default()).unwrap(); + + // Events + let mut structs = File::create(path.join("events.rs")).unwrap(); + write!(&mut structs, "{}", EventDeclarations::default()).unwrap(); + + // Properties + let mut structs = File::create(path.join("properties.rs")).unwrap(); + write!(&mut structs, "{}", Properties::default()).unwrap(); +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/events.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/events.rs new file mode 100644 index 0000000..0674fc0 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/events.rs @@ -0,0 +1,20 @@ +use std::collections::HashSet; +use std::default::Default; +use std::ops::Deref; + +use t4rust_derive::Template; +use tsproto_structs::book::*; + +#[derive(Template)] +#[TemplatePath = "build/Events.tt"] +#[derive(Debug)] +pub struct EventDeclarations<'a>(&'a BookDeclarations); + +impl<'a> Deref for EventDeclarations<'a> { + type Target = BookDeclarations; + fn deref(&self) -> &Self::Target { self.0 } +} + +impl Default for EventDeclarations<'static> { + fn default() -> Self { EventDeclarations(&DATA) } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/message_parser.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/message_parser.rs new file mode 100644 index 0000000..f1fc849 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/message_parser.rs @@ -0,0 +1,299 @@ +use std::default::Default; + +use itertools::Itertools; +use t4rust_derive::Template; +use tsproto_structs::messages::*; +use tsproto_structs::{indent, messages, InnerRustType, RustType}; + +#[derive(Template)] +#[TemplatePath = "build/MessageDeclarations.tt"] +#[derive(Debug, Clone)] +pub struct MessageDeclarations<'a>(pub &'a messages::MessageDeclarations); + +impl MessageDeclarations<'static> { + pub fn s2c() -> messages::MessageDeclarations { + let mut res = DATA.clone(); + res.msg_group.retain(|g| g.default.s2c); + res + } + + pub fn c2s() -> messages::MessageDeclarations { + let mut res = DATA.clone(); + res.msg_group.retain(|g| g.default.c2s); + res + } +} + +impl Default for MessageDeclarations<'static> { + fn default() -> Self { MessageDeclarations(&DATA) } +} + +pub fn generate_deserializer(field: &Field) -> String { + let rust_type = field.get_type("").unwrap(); + if let InnerRustType::Vec(inner) = rust_type.inner { + vector_value_deserializer(field, (*inner).into()) + } else { + single_value_deserializer(field, &rust_type.to_string()) + } +} + +pub fn single_value_deserializer(field: &Field, rust_type: &str) -> String { + let res = match rust_type { + "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64" => format!( + "val.parse().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?", + field.pretty + ), + "f32" | "f64" => format!( + "val.parse().map_err(|e| ParseError::ParseFloat {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?", + field.pretty + ), + "bool" => format!( + "match val {{ \"0\" => false, \"1\" => true, _ => return Err(ParseError::ParseBool {{ + arg: \"{}\", + value: val.to_string(), + }}), }}", + field.pretty + ), + "UidBuf" => "UidBuf(if let Ok(uid) = BASE64_STANDARD.decode(val) { uid } else { \ + val.as_bytes().to_vec() })" + .into(), + "&str" => "val".into(), + "String" => "val.to_string()".into(), + "IconId" => format!( + "IconId(if val.starts_with('-') {{ + val.parse::().map(|i| i as u32) + }} else {{ + val.parse::().map(|i| i as u32) + }}.map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?)", + field.pretty + ), + "ClientId" | "ClientDbId" | "ChannelId" | "ServerGroupId" | "ChannelGroupId" => format!( + "{}(val.parse().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?)", + rust_type, field.pretty + ), + "IpAddr" | "SocketAddr" => format!( + "val.parse().map_err(|e| ParseError::ParseAddr {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?", + field.pretty + ), + "ClientType" => format!( + "match val {{ + \"0\" => ClientType::Normal, + \"1\" => ClientType::Query {{ admin: false }}, + _ => return Err(ParseError::InvalidValue {{ + arg: \"{}\", + value: val.to_string(), + }}), + }}", + field.pretty + ), + "TextMessageTargetMode" + | "HostMessageMode" + | "HostBannerMode" + | "LicenseType" + | "LogLevel" + | "Codec" + | "CodecEncryptionMode" + | "Reason" + | "GroupNamingMode" + | "GroupType" + | "Permission" + | "PermissionType" + | "TokenType" + | "PluginTargetMode" + | "Error" => format!( + "{}::from_u32(val.parse().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?).ok_or(ParseError::InvalidValue {{ + arg: \"{1}\", + value: val.to_string(), + }})?", + rust_type, field.pretty + ), + "ChannelPermissionHint" | "ClientPermissionHint" => format!( + "{}::from_bits(val.parse().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?).ok_or(ParseError::InvalidValue {{ + arg: \"{1}\", + value: val.to_string(), + }})?", + rust_type, field.pretty + ), + "Duration" => { + if field.type_s == "DurationSeconds" { + format!( + "let val = val.parse::().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?; + if val.checked_mul(1000).is_some() {{ Duration::seconds(val) }} + else {{ return Err(ParseError::InvalidValue {{ + arg: \"{0}\", + value: val.to_string(), + }}); }}", + field.pretty + ) + } else if field.type_s == "DurationMilliseconds" { + format!( + "Duration::milliseconds(val.parse::().map_err(|e| ParseError::ParseInt \ + {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?)", + field.pretty + ) + } else if field.type_s == "DurationMillisecondsFloat" { + format!( + "Duration::microseconds((1000.0 * val.parse::().map_err(|e| \ + ParseError::ParseFloat {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?) as i64)", + field.pretty + ) + } else { + panic!("Unknown original time type {} found.", field.type_s); + } + } + "OffsetDateTime" => format!( + "OffsetDateTime::from_unix_timestamp( + val.parse().map_err(|e| ParseError::ParseInt {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?).map_err(|e| ParseError::ParseDate {{ + arg: \"{}\", + value: val.to_string(), + source: e, + }})?", + field.pretty, field.pretty + ), + _ => panic!("Unknown type '{}' when trying to deserialize {:?}", rust_type, field), + }; + if res.contains('\n') { indent(&res, 2) } else { res } +} + +pub fn vector_value_deserializer(field: &Field, rust_type: RustType) -> String { + format!( + "val.split(',') + .filter_map(|val| {{ + let val = val.trim(); + if val.is_empty() {{ + None + }} else {{ + Some(val) + }} + }}).map(|val| {{ + let val = val.trim(); + Ok({}) + }}).collect::>>()?", + single_value_deserializer(field, &rust_type.to_string()), + rust_type, + ) +} + +pub fn generate_serializer(field: &Field, name: &str) -> String { + let rust_type = field.get_type("").unwrap(); + if let InnerRustType::Vec(inner) = rust_type.inner { + let inner_type: RustType = (*inner).into(); + vector_value_serializer(field, &inner_type.to_string(), name) + } else { + single_value_serializer(field, &rust_type.to_string(), name, false) + } +} + +pub fn single_value_serializer(field: &Field, rust_type: &str, name: &str, is_ref: bool) -> String { + let ref_amp = if is_ref { "" } else { "&" }; + let ref_star = if is_ref { "*" } else { "" }; + match rust_type { + "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64" | "f32" | "f64" | "String" + | "IpAddr" | "SocketAddr" => format!("{}{}", ref_amp, name), + "bool" => format!("if {}{} {{ &\"1\" }} else {{ &\"0\" }}", ref_star, name), + "&str" => name.to_string(), + "UidBuf" | "&Uid" => format!( + "&if {0}.is_server_admin() {{ Cow::Borrowed(\"ServerAdmin\") }} + else {{ Cow::::Owned(BASE64_STANDARD.encode(&{0}.0)) }}", + name, + ), + "ClientId" | "ClientDbId" | "ChannelId" | "ServerGroupId" | "ChannelGroupId" | "IconId" => { + format!("&{}.0", name) + } + "ClientType" => format!( + "match {} {{ + ClientType::Normal => &\"0\", + ClientType::Query {{ .. }} => &\"1\", + }}", + name + ), + "TextMessageTargetMode" + | "HostMessageMode" + | "HostBannerMode" + | "LicenseType" + | "LogLevel" + | "Codec" + | "CodecEncryptionMode" + | "Reason" + | "GroupNamingMode" + | "GroupType" + | "Permission" + | "PermissionType" + | "TokenType" + | "PluginTargetMode" + | "Error" => format!("&{}.to_u32().unwrap()", name), + "ChannelPermissionHint" | "ClientPermissionHint" => format!("&{}.bits()", name), + "Duration" => { + if field.type_s == "DurationSeconds" { + format!("&{}.whole_seconds()", name) + } else if field.type_s == "DurationMilliseconds" { + format!("&{}.whole_milliseconds()", name) + } else if field.type_s == "DurationMillisecondsFloat" { + format!("&({}.whole_microseconds() as f32 / 1000.0)", name) + } else { + panic!("Unknown original time type {} found.", field.type_s); + } + } + "OffsetDateTime" => format!("&{}.unix_timestamp()", name), + _ => panic!("Unknown type '{}'", rust_type), + } +} + +pub fn vector_value_serializer(field: &Field, inner_type: &str, name: &str) -> String { + // TODO Vector serialization creates an intermediate string which is not necessary + format!( + "&{{ let mut s = String::new(); + for val in {}.as_ref() {{ + if !s.is_empty() {{ s += \",\" }} + write!(&mut s, \"{{}}\", {}).unwrap(); + }} + s + }}", + name, + single_value_serializer(field, inner_type, "val", true) + ) +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/messages_to_book_parser.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/messages_to_book_parser.rs new file mode 100644 index 0000000..ad7a72c --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/messages_to_book_parser.rs @@ -0,0 +1,28 @@ +use std::collections::HashMap; +use std::default::Default; +use std::ops::Deref; + +use heck::*; +use t4rust_derive::Template; +use tsproto_structs::book::{PropId, Property}; +use tsproto_structs::messages::Field; +use tsproto_structs::messages_to_book::*; +use tsproto_structs::*; + +#[derive(Template)] +#[TemplatePath = "build/MessagesToBook.tt"] +#[derive(Debug)] +pub struct MessagesToBookDeclarations<'a>(&'a messages_to_book::MessagesToBookDeclarations<'a>); + +impl<'a> Deref for MessagesToBookDeclarations<'a> { + type Target = messages_to_book::MessagesToBookDeclarations<'a>; + fn deref(&self) -> &Self::Target { self.0 } +} + +impl Default for MessagesToBookDeclarations<'static> { + fn default() -> Self { MessagesToBookDeclarations(&DATA) } +} + +fn get_property(p: &Property, name: &str) -> String { + format!("PropertyValue::{}({})", p.get_inner_type_as_name().unwrap(), name) +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/build/properties.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/properties.rs new file mode 100644 index 0000000..d925d69 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/build/properties.rs @@ -0,0 +1,43 @@ +//! Access properties of a connection with the property structs from events. +use std::default::Default; +use std::fmt::Write; + +use heck::*; +use t4rust_derive::Template; +use tsproto_structs::book::*; +use tsproto_structs::embrace; + +#[derive(Template)] +#[TemplatePath = "build/Properties.tt"] +#[derive(Debug)] +pub struct Properties<'a>(&'a BookDeclarations); + +impl Default for Properties<'static> { + fn default() -> Self { Properties(&DATA) } +} + +fn get_ids(struc: &Struct) -> String { + let mut res = String::new(); + for i in 0..struc.id.len() { + if !res.is_empty() { + res.push_str(", "); + } + let _ = write!(res, "s{}", i); + } + res +} + +fn get_ids2(structs: &[Struct], struc: &Struct) -> String { + let mut res = String::new(); + for (i, id) in struc.id.iter().enumerate() { + let p = id.find_property(structs); + if !res.is_empty() { + res.push_str(", "); + } + if p.type_s != "str" { + res.push('*'); + } + let _ = write!(res, "s{}", i); + } + res +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/src/data.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/data.rs new file mode 100644 index 0000000..3a5f3c2 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/data.rs @@ -0,0 +1,1051 @@ +use std::borrow::Cow; +use std::collections::{HashMap, HashSet}; +use std::net::{IpAddr, SocketAddr}; +use std::{iter, mem}; + +use serde::{Deserialize, Serialize}; +use time::{Duration, OffsetDateTime}; +use tsproto_packets::packets::OutCommand; +use tsproto_types::crypto::EccKeyPubP256; +use tsproto_types::*; + +use crate::events::{Event, ExtraInfo, PropertyId, PropertyValue, PropertyValueRef}; +use crate::messages::s2c::InMessage; +use crate::messages::{c2s, s2c}; +use crate::{Error, MessageTarget, Result}; + +include!(concat!(env!("OUT_DIR"), "/m2bdecls.rs")); +include!(concat!(env!("OUT_DIR"), "/structs.rs")); +include!(concat!(env!("OUT_DIR"), "/properties.rs")); + +pub mod exts { + use super::*; + + include!(concat!(env!("OUT_DIR"), "/b2mdecls.rs")); +} + +macro_rules! max_clients { + ($msg:ident) => {{ + if $msg.is_max_clients_unlimited.unwrap_or_default() { + Some(MaxClients::Unlimited) + } else if $msg.max_clients.map(|i| i >= 0 && i <= u16::MAX as i32).unwrap_or_default() { + Some(MaxClients::Limited($msg.max_clients.unwrap() as u16)) + } else { + // Max clients is less than zero or too high so ignore it + None + } + }}; +} + +macro_rules! copy_attrs { + ($from:ident, $to:ident; $($attr:ident),* $(,)*; $($extra:ident: $ex:expr),* $(,)*) => { + $to { + $($attr: $from.$attr.clone(),)* + $($extra: $ex,)* + } + }; +} + +impl Connection { + pub fn new(public_key: EccKeyPubP256, msg: &s2c::InInitServer) -> Self { + let packet = msg.iter().next().unwrap(); + Self { + own_client: packet.client_id, + server: copy_attrs!(packet, Server; + administrative_domain, + ask_for_privilegekey, + codec_encryption_mode, + created, + default_channel_group, + default_server_group, + hostbanner_gfx_interval, + hostbanner_gfx_url, + hostbanner_mode, + hostbanner_url, + hostbutton_gfx_url, + hostbutton_tooltip, + hostbutton_url, + hostmessage_mode, + hostmessage, + icon, + max_clients, + name, + nickname, + phonetic_name, + platform, + priority_speaker_dimm_modificator, + protocol_version, + temp_channel_default_delete_delay, + version, + welcome_message, + ; + + id: packet.virtual_server_id, + public_key: public_key, + ips: packet.ips.clone().unwrap_or_default(), + // TODO Get from license struct + license: LicenseType::NoLicense, + + optional_data: None, + connection_data: None, + ), + clients: HashMap::new(), + channels: HashMap::new(), + channel_groups: HashMap::new(), + server_groups: HashMap::new(), + } + } + + pub fn handle_command(&mut self, msg: &s2c::InMessage) -> Result<(Vec, bool)> { + // Returns if it handled the message so we can warn if a message is + // unhandled. + let (mut handled, mut events) = self.handle_command_generated(msg)?; + // Handle special messages + match msg { + InMessage::TextMessage(msg) => { + for msg in msg.iter() { + let target = match msg.target { + TextMessageTargetMode::Server => MessageTarget::Server, + TextMessageTargetMode::Channel => MessageTarget::Channel, + TextMessageTargetMode::Client => { + let client = if let Some(client) = msg.target_client_id { + client + } else { + return Err(Error::MessageWithoutTargetClientId); + }; + MessageTarget::Client(client) + } + TextMessageTargetMode::Unknown => { + return Err(Error::UnknownTextMessageTargetMode); + } + }; + events.push(Event::Message { + target, + invoker: Invoker { + name: msg.invoker_name.clone(), + id: msg.invoker_id, + uid: msg.invoker_uid.clone(), + }, + message: msg.message.to_string(), + }); + handled = true; + } + } + InMessage::ClientPoke(msg) => { + for msg in msg.iter() { + events.push(Event::Message { + target: MessageTarget::Poke(msg.invoker_id), + invoker: Invoker { + name: msg.invoker_name.clone(), + id: msg.invoker_id, + uid: msg.invoker_uid.clone(), + }, + message: msg.message.to_string(), + }); + handled = true; + } + } + InMessage::CommandError(_) => handled = true, + _ => {} + } + + if let Some(invoker) = events.first().and_then(Event::get_invoker) { + // If we know this client and the name change, adjust the name. + if let Ok(client) = self.get_mut_client(invoker.id) { + if client.name != invoker.name { + let old = mem::replace(&mut client.name, invoker.name.clone()); + events.push(Event::PropertyChanged { + id: PropertyId::ClientName(client.id), + old: PropertyValue::String(old), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + } + } + } + + Ok((events, handled)) + } + + fn get_server(&self) -> Result<&Server> { Ok(&self.server) } + fn get_mut_server(&mut self) -> Result<&mut Server> { Ok(&mut self.server) } + + fn get_channel_group(&self, group: ChannelGroupId) -> Result<&ChannelGroup> { + self.channel_groups + .get(&group) + .ok_or_else(|| Error::NotFound("ChannelGroup", group.to_string())) + } + fn add_channel_group( + &mut self, group: ChannelGroupId, r: ChannelGroup, _: &mut Vec, + ) -> Result> { + Ok(self.channel_groups.insert(group, r)) + } + fn get_server_group(&self, group: ServerGroupId) -> Result<&ServerGroup> { + self.server_groups + .get(&group) + .ok_or_else(|| Error::NotFound("ServerGroup", group.to_string())) + } + fn add_server_group( + &mut self, group: ServerGroupId, r: ServerGroup, _: &mut Vec, + ) -> Result> { + Ok(self.server_groups.insert(group, r)) + } + + fn get_optional_server_data(&self) -> Result> { + Ok(self.server.optional_data.as_ref()) + } + fn replace_optional_server_data( + &mut self, r: OptionalServerData, _: &mut Vec, + ) -> Result> { + Ok(mem::replace(&mut self.server.optional_data, Some(r))) + } + fn remove_optional_server_data( + &mut self, _: &mut Vec, + ) -> Result> { + Ok(self.server.optional_data.take()) + } + + fn get_connection_server_data(&self) -> Result> { + Ok(self.server.connection_data.as_ref()) + } + fn replace_connection_server_data( + &mut self, r: ConnectionServerData, _: &mut Vec, + ) -> Result> { + Ok(mem::replace(&mut self.server.connection_data, Some(r))) + } + + fn get_connection(&self) -> Result<&Connection> { Ok(self) } + + fn get_client(&self, client: ClientId) -> Result<&Client> { + self.clients.get(&client).ok_or_else(|| Error::NotFound("Client", client.to_string())) + } + fn get_mut_client(&mut self, client: ClientId) -> Result<&mut Client> { + self.clients.get_mut(&client).ok_or_else(|| Error::NotFound("Client", client.to_string())) + } + fn add_client( + &mut self, client: ClientId, r: Client, _: &mut Vec, + ) -> Result> { + Ok(self.clients.insert(client, r)) + } + fn remove_client(&mut self, client: ClientId, _: &mut Vec) -> Result> { + Ok(self.clients.remove(&client)) + } + + fn get_connection_client_data( + &self, client: ClientId, + ) -> Result> { + if let Some(c) = self.clients.get(&client) { + Ok(c.connection_data.as_ref()) + } else { + Err(Error::NotFound("Client", client.to_string())) + } + } + fn replace_connection_client_data( + &mut self, client: ClientId, r: ConnectionClientData, _: &mut Vec, + ) -> Result> { + if let Some(client) = self.clients.get_mut(&client) { + Ok(mem::replace(&mut client.connection_data, Some(r))) + } else { + Err(Error::NotFound("Client", client.to_string())) + } + } + + fn get_optional_client_data(&self, client: ClientId) -> Result> { + if let Some(c) = self.clients.get(&client) { + Ok(c.optional_data.as_ref()) + } else { + Err(Error::NotFound("Client", client.to_string())) + } + } + fn replace_optional_client_data( + &mut self, client: ClientId, r: OptionalClientData, _: &mut Vec, + ) -> Result> { + if let Some(c) = self.clients.get_mut(&client) { + Ok(mem::replace(&mut c.optional_data, Some(r))) + } else { + Err(Error::NotFound("Client", client.to_string())) + } + } + + fn get_channel(&self, channel: ChannelId) -> Result<&Channel> { + self.channels.get(&channel).ok_or_else(|| Error::NotFound("Channel", channel.to_string())) + } + fn get_mut_channel(&mut self, channel: ChannelId) -> Result<&mut Channel> { + self.channels + .get_mut(&channel) + .ok_or_else(|| Error::NotFound("Channel", channel.to_string())) + } + fn add_channel( + &mut self, channel: ChannelId, r: Channel, events: &mut Vec, + ) -> Result> { + self.channel_order_insert(r.id, r.order, r.parent, events); + Ok(self.channels.insert(channel, r)) + } + fn remove_channel( + &mut self, channel: ChannelId, events: &mut Vec, + ) -> Result> { + let old = self.channels.remove(&channel); + if let Some(ch) = &old { + self.channel_order_remove(ch.id, ch.order, events); + } + Ok(old) + } + + fn get_optional_channel_data( + &self, channel: ChannelId, + ) -> Result> { + if let Some(c) = self.channels.get(&channel) { + Ok(c.optional_data.as_ref()) + } else { + Err(Error::NotFound("Channel", channel.to_string())) + } + } + fn replace_optional_channel_data( + &mut self, channel: ChannelId, r: OptionalChannelData, _: &mut Vec, + ) -> Result> { + if let Some(c) = self.channels.get_mut(&channel) { + Ok(mem::replace(&mut c.optional_data, Some(r))) + } else { + Err(Error::NotFound("Channel", channel.to_string())) + } + } + fn remove_optional_channel_data( + &mut self, channel: ChannelId, _: &mut Vec, + ) -> Result> { + if let Some(c) = self.channels.get_mut(&channel) { + Ok(c.optional_data.take()) + } else { + Err(Error::NotFound("Channel", channel.to_string())) + } + } + + // Backing functions for MessageToBook declarations + + fn return_false(&self, _: T, _: &mut Vec) -> Result { Ok(false) } + fn return_none(&self, _: T, _: &mut Vec) -> Result> { Ok(None) } + fn return_some_none(&self, _: T, _: &mut Vec) -> Result>> { + Ok(Some(None)) + } + fn void_fun(&self, _: T, _: U, _: V) -> Result<()> { Ok(()) } + + fn max_clients_cc_fun( + &self, msg: &s2c::InChannelCreatedPart, _: &mut Vec, + ) -> Result<(Option, Option)> { + let ch = max_clients!(msg); + let ch_fam = if msg.is_max_family_clients_unlimited.unwrap_or_default() { + Some(MaxClients::Unlimited) + } else if msg.inherits_max_family_clients.unwrap_or_default() { + Some(MaxClients::Inherited) + } else if msg.max_family_clients.map(|i| i >= 0 && i <= u16::MAX as i32).unwrap_or_default() + { + Some(MaxClients::Limited(msg.max_family_clients.unwrap() as u16)) + } else { + // Max clients is less than zero or too high so ignore it + None + }; + Ok((ch, ch_fam)) + } + fn max_clients_ce_fun( + &mut self, channel_id: ChannelId, msg: &s2c::InChannelEditedPart, events: &mut Vec, + ) -> Result<()> { + let channel = self.get_mut_channel(channel_id)?; + + let ch = max_clients!(msg); + if let Some(ch) = ch { + events.push(Event::PropertyChanged { + id: PropertyId::ChannelMaxClients(channel_id), + old: PropertyValue::OptionMaxClients(channel.max_clients.take()), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: Some(msg.reason) }, + }); + channel.max_clients = Some(ch); + } + let ch_fam = if msg.is_max_family_clients_unlimited.unwrap_or_default() { + Some(MaxClients::Unlimited) + } else if msg.inherits_max_family_clients.unwrap_or_default() { + Some(MaxClients::Inherited) + } else if msg.max_family_clients.map(|i| i >= 0 && i <= u16::MAX as i32).unwrap_or_default() + { + Some(MaxClients::Limited(msg.max_family_clients.unwrap() as u16)) + } else { + // Max clients is less than zero or too high so ignore it + None + }; + if let Some(ch_fam) = ch_fam { + events.push(Event::PropertyChanged { + id: PropertyId::ChannelMaxFamilyClients(channel_id), + old: PropertyValue::OptionMaxClients(channel.max_family_clients.take()), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: Some(msg.reason) }, + }); + channel.max_family_clients = Some(ch_fam); + } + Ok(()) + } + fn max_clients_cl_fun( + &self, msg: &s2c::InChannelListPart, _: &mut Vec, + ) -> Result<(Option, Option)> { + let max_clients: i32 = msg.max_clients; + let ch = if msg.is_max_clients_unlimited { + Some(MaxClients::Unlimited) + } else if max_clients >= 0 && max_clients <= u16::MAX as i32 { + Some(MaxClients::Limited(max_clients as u16)) + } else { + // Max clients is less than zero or too high so ignore it + None + }; + + let max_clients: i32 = msg.max_family_clients; + let ch_fam = if msg.is_max_family_clients_unlimited { + Some(MaxClients::Unlimited) + } else if msg.inherits_max_family_clients { + Some(MaxClients::Inherited) + } else if max_clients >= 0 && max_clients <= u16::MAX as i32 { + Some(MaxClients::Limited(max_clients as u16)) + } else { + // Max clients is less than zero or too high so ignore it + Some(MaxClients::Unlimited) + }; + Ok((ch, ch_fam)) + } + + fn channel_type_cc_fun( + &self, msg: &s2c::InChannelCreatedPart, _: &mut Vec, + ) -> Result { + Ok(Self::channel_flags_to_type(msg.is_permanent, msg.is_semi_permanent)) + } + + fn channel_type_ce_fun( + &mut self, channel_id: ChannelId, msg: &s2c::InChannelEditedPart, events: &mut Vec, + ) -> Result<()> { + let channel = self.get_mut_channel(channel_id)?; + + if msg.is_permanent.is_none() && msg.is_semi_permanent.is_none() { + return Ok(()); + } + + let typ = Self::channel_flags_to_type(msg.is_permanent, msg.is_semi_permanent); + events.push(Event::PropertyChanged { + id: PropertyId::ChannelChannelType(channel_id), + old: PropertyValue::ChannelType(channel.channel_type), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: Some(msg.reason) }, + }); + channel.channel_type = typ; + Ok(()) + } + + fn channel_type_cl_fun( + &self, msg: &s2c::InChannelListPart, _: &mut Vec, + ) -> Result { + Ok(Self::channel_flags_to_type(Some(msg.is_permanent), Some(msg.is_semi_permanent))) + } + + fn channel_flags_to_type(perm: Option, semi: Option) -> ChannelType { + match (perm.unwrap_or_default(), semi.unwrap_or_default()) { + (true, _) => ChannelType::Permanent, + (_, true) => ChannelType::SemiPermanent, + (false, false) => ChannelType::Temporary, + } + } + + fn channel_codec_cc_fun( + &self, msg: &s2c::InChannelCreatedPart, _: &mut Vec, + ) -> Result { + Ok(msg.codec.unwrap_or(Codec::OpusVoice)) + } + + fn away_cev_fun( + &self, msg: &s2c::InClientEnterViewPart, _: &mut Vec, + ) -> Result> { + if msg.is_away { Ok(Some(msg.away_message.clone())) } else { Ok(None) } + } + + fn client_type_cev_fun( + &self, msg: &s2c::InClientEnterViewPart, _: &mut Vec, + ) -> Result { + if msg.uid.is_server_admin() { + if let ClientType::Query { .. } = msg.client_type { + return Ok(ClientType::Query { admin: true }); + } + } + Ok(msg.client_type) + } + + fn away_cu_fun( + &mut self, client_id: ClientId, msg: &s2c::InClientUpdatedPart, events: &mut Vec, + ) -> Result<()> { + let client = self.get_mut_client(client_id)?; + + if let Some(is_away) = msg.is_away { + if is_away != client.away_message.is_some() { + let away = + if is_away { Some(msg.away_message.clone().unwrap_or_default()) } else { None }; + events.push(Event::PropertyChanged { + id: PropertyId::ClientAwayMessage(client_id), + old: PropertyValue::OptionString(client.away_message.take()), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: None }, + }); + client.away_message = away; + } + } else if let Some(away_message) = &msg.away_message { + if let Some(cur_msg) = &client.away_message { + if away_message != cur_msg { + events.push(Event::PropertyChanged { + id: PropertyId::ClientAwayMessage(client_id), + old: PropertyValue::OptionString(client.away_message.take()), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: None }, + }); + client.away_message = Some(away_message.clone()); + } + } + } + Ok(()) + } + + fn talk_power_cev_fun( + &self, msg: &s2c::InClientEnterViewPart, _: &mut Vec, + ) -> Result> { + if msg.talk_power_request_time.unix_timestamp() > 0 { + Ok(Some(TalkPowerRequest { + time: msg.talk_power_request_time, + message: msg.talk_power_request_message.clone(), + })) + } else { + Ok(None) + } + } + + fn talk_power_cu_fun( + &mut self, client_id: ClientId, msg: &s2c::InClientUpdatedPart, events: &mut Vec, + ) -> Result<()> { + if let Some(talk_request) = msg.talk_power_request_time { + let client = self.get_mut_client(client_id)?; + + let talk_request = if talk_request.unix_timestamp() > 0 { + Some(TalkPowerRequest { + time: talk_request, + message: msg.talk_power_request_message.clone().unwrap_or_default(), + }) + } else { + None + }; + events.push(Event::PropertyChanged { + id: PropertyId::ClientTalkPowerRequest(client_id), + old: PropertyValue::OptionTalkPowerRequest(client.talk_power_request.take()), + invoker: msg.get_invoker(), + extra: ExtraInfo { reason: None }, + }); + client.talk_power_request = talk_request; + } + Ok(()) + } + + fn address_fun( + &self, msg: &s2c::InClientConnectionInfoPart, _: &mut Vec, + ) -> Result>> { + if let (Some(ip), Some(port)) = (&msg.ip, &msg.port) { + if !ip.is_empty() { + return Ok(Some(Some(SocketAddr::new( + ip.trim_matches(&['[', ']'][..]).parse().map_err(Error::InvalidConnectionIp)?, + *port, + )))); + } + } + Ok(Some(None)) + } + + fn channel_subscribe_fun( + &mut self, channel_id: ChannelId, _: &s2c::InChannelSubscribedPart, events: &mut Vec, + ) -> Result<()> { + let channel = self.get_mut_channel(channel_id)?; + events.push(Event::PropertyChanged { + id: PropertyId::ChannelSubscribed(channel_id), + old: PropertyValue::Bool(channel.subscribed), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + channel.subscribed = true; + Ok(()) + } + + fn channel_unsubscribe_fun( + &mut self, channel_id: ChannelId, _: &s2c::InChannelUnsubscribedPart, + events: &mut Vec, + ) -> Result<()> { + let channel = self.get_mut_channel(channel_id)?; + events.push(Event::PropertyChanged { + id: PropertyId::ChannelSubscribed(channel_id), + old: PropertyValue::Bool(channel.subscribed), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + channel.subscribed = false; + + // Remove all known clients from this channel + let remove_clients = self + .clients + .values() + .filter_map(|c| if c.channel == channel_id { Some(c.id) } else { None }) + .collect::>(); + for id in remove_clients { + events.push(Event::PropertyRemoved { + id: PropertyId::Client(id), + old: PropertyValue::Client(self.clients.remove(&id).unwrap()), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + } + Ok(()) + } + + fn channel_order_remove( + &mut self, channel_id: ChannelId, channel_order: ChannelId, events: &mut Vec, + ) { + // [ C:7 | O:_ ] + // [ C:5 | O:7 ] ─>X + // [ C:_ | O:5 ] (Upd: O -> 7) + self.channels.values_mut().any(|c| { + if c.order == channel_id && c.id != channel_id { + events.push(Event::PropertyChanged { + id: PropertyId::ChannelOrder(c.id), + old: PropertyValue::ChannelId(c.order), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + c.order = channel_order; + true + } else { + false + } + }); + } + + fn channel_order_insert( + &mut self, channel_id: ChannelId, channel_order: ChannelId, channel_parent: ChannelId, + events: &mut Vec, + ) { + // [ C:7 | O:_ ] + // [ <── (New: C:5 | O:7) + // [ C:_ | O:7 ] (Upd: O -> 5) + // + // Also work for the first channel, the order will be 0. + self.channels.values_mut().any(|c| { + if c.order == channel_order && c.parent == channel_parent && c.id != channel_id { + events.push(Event::PropertyChanged { + id: PropertyId::ChannelOrder(c.id), + old: PropertyValue::ChannelId(c.order), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + c.order = channel_id; + true + } else { + false + } + }); + } + + fn channel_order_cc_fun( + &mut self, msg: &s2c::InChannelCreatedPart, events: &mut Vec, + ) -> Result { + self.channel_order_insert(msg.channel_id, msg.order, msg.parent_id, events); + Ok(msg.order) + } + + fn channel_order_ce_fun( + &mut self, channel_id: ChannelId, msg: &s2c::InChannelEditedPart, events: &mut Vec, + ) -> Result<()> { + self.channel_order_move_fun(channel_id, msg.order, msg.parent_id, events) + } + + fn channel_order_cm_fun( + &mut self, channel_id: ChannelId, msg: &s2c::InChannelMovedPart, events: &mut Vec, + ) -> Result<()> { + self.channel_order_move_fun(channel_id, Some(msg.order), Some(msg.parent_id), events) + } + + fn channel_order_move_fun( + &mut self, channel_id: ChannelId, new_order: Option, parent: Option, + events: &mut Vec, + ) -> Result<()> { + if new_order.is_some() || parent.is_some() { + let old_order; + let new_parent; + { + let channel = self.get_mut_channel(channel_id)?; + old_order = channel.order; + new_parent = parent.unwrap_or(channel.parent); + if let Some(order) = new_order { + events.push(Event::PropertyChanged { + id: PropertyId::ChannelOrder(channel.id), + old: PropertyValue::ChannelId(channel.order), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + channel.order = order; + } + } + self.channel_order_remove(channel_id, old_order, events); + self.channel_order_insert( + channel_id, + new_order.unwrap_or(old_order), + new_parent, + events, + ); + } + Ok(()) + } + + fn subscribe_channel_fun( + &mut self, client_id: ClientId, msg: &s2c::InClientMovedPart, events: &mut Vec, + ) -> Result<()> { + if client_id == self.own_client && msg.target_channel_id.0 != 0 { + let channel = self.get_mut_channel(msg.target_channel_id)?; + events.push(Event::PropertyChanged { + id: PropertyId::ChannelSubscribed(msg.target_channel_id), + old: PropertyValue::Bool(channel.subscribed), + invoker: None, + extra: ExtraInfo { reason: None }, + }); + channel.subscribed = true; + } + Ok(()) + } + + // Book to messages + fn away_fun_b2m(msg: Option<&str>) -> (bool, &str) { + if let Some(msg) = msg { (true, msg) } else { (false, "") } + } +} + +impl Client { + // Book to messages + fn password_b2m(password: &str) -> String { + tsproto_types::crypto::encode_password(password.as_bytes()) + } + fn channel_id_b2m(&self, channel: ChannelId) -> ChannelId { channel } + + pub fn send_textmessage(&self, message: &str) -> OutCommand { + c2s::OutSendTextMessageMessage::new(&mut iter::once(c2s::OutSendTextMessagePart { + target: TextMessageTargetMode::Client, + target_client_id: Some(self.id), + message: message.into(), + })) + } + + pub fn poke(&self, message: &str) -> OutCommand { + c2s::OutClientPokeRequestMessage::new(&mut iter::once(c2s::OutClientPokeRequestPart { + client_id: self.id, + message: message.into(), + })) + } +} + +impl Channel { + // Book to messages + fn password_b2m(&self, password: &str) -> String { + tsproto_types::crypto::encode_password(password.as_bytes()) + } + + fn password_b2m2(password: &str) -> String { + tsproto_types::crypto::encode_password(password.as_bytes()) + } + + fn password_flagged_b2m(password: Option<&str>) -> (bool, Cow<'static, str>) { + if let Some(password) = password { + (true, tsproto_types::crypto::encode_password(password.as_bytes()).into()) + } else { + (false, "".into()) + } + } + + fn channel_type_fun_b2m(channel_type: ChannelType) -> (bool, bool) { + match channel_type { + ChannelType::Temporary => (false, false), + ChannelType::SemiPermanent => (true, false), + ChannelType::Permanent => (false, true), + } + } + + fn max_clients_fun_b2m(max_clients: MaxClients) -> (i32, bool) { + match max_clients { + MaxClients::Inherited => (0, false), + MaxClients::Unlimited => (0, true), + MaxClients::Limited(num) => (num.into(), false), + } + } + + fn max_family_clients_fun_b2m(max_clients: MaxClients) -> (i32, bool, bool) { + match max_clients { + MaxClients::Inherited => (0, false, true), + MaxClients::Unlimited => (0, true, false), + MaxClients::Limited(num) => (num.into(), false, false), + } + } + + fn channel_id_b2m(&self, channel: ChannelId) -> ChannelId { channel } + + pub fn set_subscribed(&self, subscribed: bool) -> OutCommand { + if subscribed { + c2s::OutChannelSubscribeMessage::new(&mut iter::once(c2s::OutChannelSubscribePart { + channel_id: self.id, + })) + } else { + c2s::OutChannelUnsubscribeMessage::new(&mut iter::once( + c2s::OutChannelUnsubscribePart { channel_id: self.id }, + )) + } + } +} + +/// The `ChannelOptions` are used to set initial properties of a new channel. +/// +/// A channel can be created with [`ServerMut::add_channel`]. The only necessary +/// property of a channel is the name, all other properties will be set to their +/// default value. +#[derive(Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct ChannelOptions<'a> { + name: &'a str, + description: Option<&'a str>, + parent_id: Option, + codec: Option, + codec_quality: Option, + delete_delay: Option, + password: Option<&'a str>, + is_default: bool, + max_clients: Option, + max_family_clients: Option, + channel_type: Option, + is_unencrypted: Option, + order: Option, + phonetic_name: Option<&'a str>, + topic: Option<&'a str>, +} + +impl<'a> ChannelOptions<'a> { + /// Create new `ChannelOptions` to add a new channel to a server. + /// + /// # Arguments + /// You have to supply a name for the new channel. All other properties are + /// optional. + pub fn new(name: &'a str) -> Self { + Self { + name, + description: None, + parent_id: None, + codec: None, + codec_quality: None, + delete_delay: None, + password: None, + is_default: false, + max_clients: None, + max_family_clients: None, + channel_type: None, + is_unencrypted: None, + order: None, + phonetic_name: None, + topic: None, + } + } + + pub fn description(mut self, description: &'a str) -> Self { + self.description = Some(description); + self + } + + pub fn parent_id(mut self, parent_id: ChannelId) -> Self { + self.parent_id = Some(parent_id); + self + } + + pub fn codec(mut self, codec: Codec) -> Self { + self.codec = Some(codec); + self + } + + pub fn codec_quality(mut self, codec_quality: u8) -> Self { + self.codec_quality = Some(codec_quality); + self + } + + pub fn delete_delay(mut self, delete_delay: Duration) -> Self { + self.delete_delay = Some(delete_delay); + self + } + + pub fn password(mut self, password: &'a str) -> Self { + self.password = Some(password); + self + } + + pub fn default(mut self) -> Self { + self.is_default = true; + self + } + + pub fn max_clients(mut self, max_clients: MaxClients) -> Self { + self.max_clients = Some(max_clients); + self + } + + pub fn max_family_clients(mut self, max_family_clients: MaxClients) -> Self { + self.max_family_clients = Some(max_family_clients); + self + } + + pub fn channel_type(mut self, channel_type: ChannelType) -> Self { + self.channel_type = Some(channel_type); + self + } + + pub fn is_unencrypted(mut self, is_unencrypted: bool) -> Self { + self.is_unencrypted = Some(is_unencrypted); + self + } + + /// The previous order + pub fn order(mut self, order: ChannelId) -> Self { + self.order = Some(order); + self + } + + pub fn phonetic_name(mut self, phonetic_name: &'a str) -> Self { + self.phonetic_name = Some(phonetic_name); + self + } + + pub fn topic(mut self, topic: &'a str) -> Self { + self.topic = Some(topic); + self + } +} + +impl Server { + pub fn add_channel(&self, options: ChannelOptions) -> OutCommand { + let inherits_max_family_clients = options + .max_family_clients + .as_ref() + .and_then(|m| if let MaxClients::Inherited = m { Some(true) } else { None }); + let is_max_family_clients_unlimited = options + .max_family_clients + .as_ref() + .and_then(|m| if let MaxClients::Unlimited = m { Some(true) } else { None }); + let max_family_clients = options + .max_family_clients + .as_ref() + .and_then(|m| if let MaxClients::Limited(n) = m { Some(*n as i32) } else { None }); + let is_max_clients_unlimited = options + .max_clients + .as_ref() + .and_then(|m| if let MaxClients::Unlimited = m { Some(true) } else { None }); + let max_clients = options + .max_clients + .as_ref() + .and_then(|m| if let MaxClients::Limited(n) = m { Some(*n as i32) } else { None }); + + let is_permanent = options + .channel_type + .as_ref() + .and_then(|t| if *t == ChannelType::Permanent { Some(true) } else { None }); + let is_semi_permanent = options + .channel_type + .as_ref() + .and_then(|t| if *t == ChannelType::SemiPermanent { Some(true) } else { None }); + + c2s::OutChannelCreateMessage::new(&mut iter::once(c2s::OutChannelCreatePart { + name: options.name.into(), + description: options.description.map(Into::into), + parent_id: options.parent_id, + codec: options.codec, + codec_quality: options.codec_quality, + delete_delay: options.delete_delay, + has_password: if options.password.is_some() { Some(true) } else { None }, + is_default: if options.is_default { Some(true) } else { None }, + inherits_max_family_clients, + is_max_family_clients_unlimited, + is_max_clients_unlimited, + is_permanent, + is_semi_permanent, + max_family_clients, + max_clients, + is_unencrypted: options.is_unencrypted, + order: options.order, + password: options + .password + .map(|p| tsproto_types::crypto::encode_password(p.as_bytes()).into()), + phonetic_name: options.phonetic_name.map(Into::into), + topic: options.topic.map(Into::into), + })) + } + + pub fn send_textmessage(&self, message: &str) -> OutCommand { + c2s::OutSendTextMessageMessage::new(&mut iter::once(c2s::OutSendTextMessagePart { + target: TextMessageTargetMode::Server, + target_client_id: None, + message: message.into(), + })) + } + + /// Subscribe or unsubscribe from all channels. + pub fn set_subscribed(&self, subscribed: bool) -> OutCommand { + if subscribed { + c2s::OutChannelSubscribeAllMessage::new() + } else { + c2s::OutChannelUnsubscribeAllMessage::new() + } + } + + fn zero_channel_id(&self) -> ChannelId { ChannelId(0) } + + fn empty_string(&self) -> &'static str { "" } + + // Book to messages + fn password_b2m(password: Option<&str>) -> Cow<'static, str> { + if let Some(password) = password { + tsproto_types::crypto::encode_password(password.as_bytes()).into() + } else { + "".into() + } + } +} + +impl Connection { + pub fn send_message(&self, target: MessageTarget, message: &str) -> OutCommand { + match target { + MessageTarget::Server => { + c2s::OutSendTextMessageMessage::new(&mut iter::once(c2s::OutSendTextMessagePart { + target: TextMessageTargetMode::Server, + target_client_id: None, + message: message.into(), + })) + } + MessageTarget::Channel => { + c2s::OutSendTextMessageMessage::new(&mut iter::once(c2s::OutSendTextMessagePart { + target: TextMessageTargetMode::Channel, + target_client_id: None, + message: message.into(), + })) + } + MessageTarget::Client(id) => { + c2s::OutSendTextMessageMessage::new(&mut iter::once(c2s::OutSendTextMessagePart { + target: TextMessageTargetMode::Client, + target_client_id: Some(id), + message: message.into(), + })) + } + MessageTarget::Poke(id) => c2s::OutClientPokeRequestMessage::new(&mut iter::once( + c2s::OutClientPokeRequestPart { client_id: id, message: message.into() }, + )), + } + } + + pub fn disconnect(&self, options: crate::DisconnectOptions) -> OutCommand { + c2s::OutDisconnectMessage::new(&mut iter::once(c2s::OutDisconnectPart { + reason: options.reason, + reason_message: options.message.map(Into::into), + })) + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/src/events.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/events.rs new file mode 100644 index 0000000..cc2b703 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/events.rs @@ -0,0 +1,79 @@ +use serde::{Deserialize, Serialize}; +use time::{Duration, OffsetDateTime}; +use tsproto_types::crypto::EccKeyPubP256; + +use crate::data::{ + Channel, ChannelGroup, Client, Connection, ConnectionClientData, ConnectionServerData, + OptionalChannelData, OptionalClientData, OptionalServerData, Server, ServerGroup, +}; +use crate::*; + +include!(concat!(env!("OUT_DIR"), "/events.rs")); + +/// Additional data for some events. +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] +pub struct ExtraInfo { + /// Set for e.g. new clients to distinguish if they joined or are made available because we + /// subscribed to a channel. + pub reason: Option, +} + +/// An event gets fired when something in the data structure of a connection +/// changes or something happens like we receive a text message or get poked. +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub enum Event { + /// The object with this id was added. + /// + /// You can find the new object inside the connection data structure. + /// + /// Like a client gets assigned a new server group or a new client joins the + /// server. + PropertyAdded { id: PropertyId, invoker: Option, extra: ExtraInfo }, + /// The attribute with this id has changed. + /// + /// The second tuple item holds the old value of the changed attribute. + /// + /// E.g. a client changes its nickname or switches to another channel. + PropertyChanged { + id: PropertyId, + old: PropertyValue, + invoker: Option, + extra: ExtraInfo, + }, + /// The object with this id was removed. + /// + /// The object is not accessible anymore in the connection data structure, + /// but the second tuple item holds the removed object. + /// + /// This happens when a client leaves the server (including our own client) + /// or a channel is removed. + PropertyRemoved { + id: PropertyId, + old: PropertyValue, + invoker: Option, + extra: ExtraInfo, + }, + + Message { + /// Where this message was sent to, in the server or channel chat or + /// directly to client. + /// + /// This is our own client for private messages from others. + target: MessageTarget, + /// The user who wrote the message. + invoker: Invoker, + /// The content of the message. + message: String, + }, +} + +impl Event { + pub fn get_invoker(&self) -> Option<&Invoker> { + match self { + Event::PropertyAdded { invoker, .. } + | Event::PropertyChanged { invoker, .. } + | Event::PropertyRemoved { invoker, .. } => invoker.as_ref(), + Event::Message { invoker, .. } => Some(invoker), + } + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/src/lib.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/lib.rs new file mode 100644 index 0000000..6051de8 --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/lib.rs @@ -0,0 +1,246 @@ +//! `ts-bookkeeping` contains structs to store the state of a TeamSpeak server, with its clients and +//! channels. +//! +//! The crate can be used to keep track of the state on a server by processing all incoming +//! commands, which is why it is called “bookkeeping”. It also contains generated structs for all +//! TeamSpeak commands. +//! +//! Incoming commands can be applied to the state and generate [`events`]. The main struct is +//! [`data::Connection`]. +//! +//! The structs have methods to create packets for various actions. The generated packets can be +//! sent to a server. + +use std::fmt; +use std::net::{IpAddr, SocketAddr}; + +use serde::{Deserialize, Serialize}; +use thiserror::Error; + +pub mod data; +pub mod events; +pub mod messages; + +// Reexports +pub use tsproto_types::errors::Error as TsError; +pub use tsproto_types::versions::Version; +pub use tsproto_types::{ + ChannelGroupId, ChannelId, ChannelPermissionHint, ChannelType, ClientDbId, ClientId, + ClientPermissionHint, ClientType, Codec, CodecEncryptionMode, GroupNamingMode, GroupType, + HostBannerMode, HostMessageMode, IconId, Invoker, InvokerRef, LicenseType, LogLevel, + MaxClients, Permission, PermissionType, PluginTargetMode, Reason, ServerGroupId, + TalkPowerRequest, TextMessageTargetMode, TokenType, Uid, UidBuf, +}; + +type Result = std::result::Result; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + #[error("Target client id missing for a client text message")] + MessageWithoutTargetClientId, + #[error("Unknown TextMessageTargetMode")] + UnknownTextMessageTargetMode, + #[error("{0} {1} not found")] + NotFound(&'static str, String), + #[error("{0} should be removed but does not exist")] + RemoveNotFound(&'static str), + #[error("Failed to parse connection ip: {0}")] + InvalidConnectionIp(#[source] std::net::AddrParseError), +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub enum ServerAddress { + SocketAddr(SocketAddr), + Other(String), +} + +impl From for ServerAddress { + fn from(addr: SocketAddr) -> Self { ServerAddress::SocketAddr(addr) } +} + +impl From for ServerAddress { + fn from(addr: String) -> Self { ServerAddress::Other(addr) } +} + +impl<'a> From<&'a str> for ServerAddress { + fn from(addr: &'a str) -> Self { ServerAddress::Other(addr.to_string()) } +} + +impl fmt::Display for ServerAddress { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + ServerAddress::SocketAddr(a) => fmt::Display::fmt(a, f), + ServerAddress::Other(a) => fmt::Display::fmt(a, f), + } + } +} + +/// All possible targets to send messages. +#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub enum MessageTarget { + Server, + Channel, + Client(ClientId), + Poke(ClientId), +} + +/// The configuration to create a new connection. +#[derive(Deserialize, Serialize)] +pub struct ConnectOptions { + address: ServerAddress, + local_address: Option, + name: String, + version: Version, + log_commands: bool, + log_packets: bool, + log_udp_packets: bool, +} + +impl ConnectOptions { + /// Start creating the configuration of a new connection. + /// + /// # Arguments + /// The address of the server has to be supplied. The address can be a + /// [`SocketAddr`](std::net::SocketAddr), a string or directly a [`ServerAddress`]. A string + /// will automatically be resolved from all formats supported by TeamSpeak. + /// For details, see [`resolver::resolve`]. + #[inline] + pub fn new>(address: A) -> Self { + Self { + address: address.into(), + local_address: None, + name: String::from("TeamSpeakUser"), + version: Version::Linux_3_2_1, + log_commands: false, + log_packets: false, + log_udp_packets: false, + } + } + + /// The address for the socket of our client + /// + /// # Default + /// The default is `0.0.0:0` when connecting to an IPv4 address and `[::]:0` + /// when connecting to an IPv6 address. + #[inline] + pub fn local_address(mut self, local_address: SocketAddr) -> Self { + self.local_address = Some(local_address); + self + } + + /// The name of the user. + /// + /// # Default + /// `TeamSpeakUser` + #[inline] + pub fn name(mut self, name: String) -> Self { + self.name = name; + self + } + + /// The displayed version of the client. + /// + /// # Default + /// `3.2.1 on Linux` + #[inline] + pub fn version(mut self, version: Version) -> Self { + self.version = version; + self + } + + /// If the content of all commands should be written to the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_commands(mut self, log_commands: bool) -> Self { + self.log_commands = log_commands; + self + } + + /// If the content of all packets in high-level form should be written to + /// the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_packets(mut self, log_packets: bool) -> Self { + self.log_packets = log_packets; + self + } + + /// If the content of all udp packets in byte-array form should be written + /// to the logger. + /// + /// # Default + /// `false` + #[inline] + pub fn log_udp_packets(mut self, log_udp_packets: bool) -> Self { + self.log_udp_packets = log_udp_packets; + self + } +} + +impl fmt::Debug for ConnectOptions { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // Error if attributes are added + let ConnectOptions { + address, + local_address, + name, + version, + log_commands, + log_packets, + log_udp_packets, + } = self; + write!( + f, + "ConnectOptions {{ address: {:?}, local_address: {:?}, name: {}, version: {}, \ + log_commands: {}, log_packets: {}, log_udp_packets: {} }}", + address, local_address, name, version, log_commands, log_packets, log_udp_packets, + )?; + Ok(()) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct DisconnectOptions { + reason: Option, + message: Option, +} + +impl Default for DisconnectOptions { + #[inline] + fn default() -> Self { Self { reason: None, message: None } } +} + +impl DisconnectOptions { + #[inline] + pub fn new() -> Self { Self::default() } + + /// Set the reason for leaving. + /// + /// # Default + /// + /// None + #[inline] + pub fn reason(mut self, reason: Reason) -> Self { + self.reason = Some(reason); + self + } + + /// Set the leave message. + /// + /// You also have to set the reason, otherwise the message will not be + /// displayed. + /// + /// # Default + /// + /// None + #[inline] + pub fn message>(mut self, message: S) -> Self { + self.message = Some(message.into()); + self + } +} diff --git a/native/vendor/tsclientlib/utils/ts-bookkeeping/src/messages.rs b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/messages.rs new file mode 100644 index 0000000..0b15cfb --- /dev/null +++ b/native/vendor/tsclientlib/utils/ts-bookkeeping/src/messages.rs @@ -0,0 +1,80 @@ +use std::net::IpAddr; + +use thiserror::Error; +use time::{Duration, OffsetDateTime}; +use tsproto_packets::commands::CommandParser; +use tsproto_packets::packets::{Direction, InHeader, OutCommand, PacketType}; +use tsproto_types::errors::Error; + +use crate::*; + +type Result = std::result::Result; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum ParseError { + #[error(transparent)] + Base64(#[from] base64::DecodeError), + + #[error("Parameter {arg} not found in {name}")] + ParameterNotFound { arg: &'static str, name: &'static str }, + #[error("Parameter {arg} not found in {name}")] + ParameterNotFound2 { arg: String, name: String }, + #[error("Command {0} is unknown")] + UnknownCommand(String), + #[error(transparent)] + StringParse(#[from] std::str::Utf8Error), + #[error(transparent)] + TsProto(#[from] tsproto_packets::Error), + /// Gets thrown when parsing a specific command with the wrong input. + #[error("Command {0} is wrong")] + WrongCommand(String), + #[error("Wrong newprotocol flag ({0})")] + WrongNewprotocol(bool), + #[error("Wrong packet type {0:?}")] + WrongPacketType(PacketType), + #[error("Wrong direction {0:?}")] + WrongDirection(Direction), + #[error("Cannot parse \"{value}\" as int for parameter {arg} ({source})")] + ParseInt { arg: &'static str, value: String, source: std::num::ParseIntError }, + #[error("Cannot parse \"{value}\" as SocketAddr for parameter {arg} ({source})")] + ParseAddr { arg: &'static str, value: String, source: std::net::AddrParseError }, + #[error("Cannot parse \"{value}\" as float for parameter {arg} ({source})")] + ParseFloat { arg: &'static str, value: String, source: std::num::ParseFloatError }, + #[error("Cannot parse \"{value}\" as bool for parameter {arg}")] + ParseBool { arg: &'static str, value: String }, + #[error("Cannot parse \"{value}\" as SocketAddr for parameter {arg} ({source})")] + ParseUid { arg: &'static str, value: String, source: base64::DecodeError }, + #[error("Cannot parse \"{value}\" as DateTimeOffset for parameter {arg} ({source})")] + ParseDate { arg: &'static str, value: String, source: time::error::ComponentRange }, + #[error("Invalid value \"{value}\" for parameter {arg}")] + InvalidValue { arg: &'static str, value: String }, +} + +pub trait InMessageTrait { + fn new(header: &InHeader, args: CommandParser) -> Result + where Self: Sized; +} + +pub trait OutMessageTrait { + fn to_packet(self) -> OutCommand; +} + +pub trait OutMessageWithReturnTrait { + fn to_packet(self, return_code: Option<&str>) -> OutCommand; +} + +impl OutMessageTrait for OutCommand { + fn to_packet(self) -> OutCommand { self } +} + +pub mod s2c { + #![allow(mismatched_lifetime_syntaxes)] + use super::*; + include!(concat!(env!("OUT_DIR"), "/s2c_messages.rs")); +} +pub mod c2s { + #![allow(mismatched_lifetime_syntaxes)] + use super::*; + include!(concat!(env!("OUT_DIR"), "/c2s_messages.rs")); +} diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/Cargo.toml b/native/vendor/tsclientlib/utils/tsproto-packets/Cargo.toml new file mode 100644 index 0000000..ac30b82 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "tsproto-packets" +version = "0.1.0" +authors = ["Flakebi "] +description = "Parse and serialize TeamSpeak packets and commands." +repository = "https://github.com/ReSpeak/tsclientlib/tree/master/utils/tsproto-packets" +readme = "README.md" +keywords = ["teamspeak3", "ts3"] +license = "MIT OR Apache-2.0" +edition = "2018" +include = [ + "/Cargo.toml", + "/README.md", + "/src/*.rs", +] + +[dependencies] +base64 = "0.22" +bitflags = "2" +num-derive = "0.4" +num-traits = "0.2" +omnom = "3" +self_cell = "1" +serde = { version = "1", features = ["derive"] } +thiserror = "2" diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/README.md b/native/vendor/tsclientlib/utils/tsproto-packets/README.md new file mode 100644 index 0000000..0934546 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/README.md @@ -0,0 +1,10 @@ +# tsproto-packets [![docs.rs](https://docs.rs/tsproto-packets/badge.svg)](https://docs.rs/tsproto-packets) +`tsproto-packets` parses and serializes TeamSpeak packets and commands. + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/README.tpl b/native/vendor/tsclientlib/utils/tsproto-packets/README.tpl new file mode 100644 index 0000000..fcd7655 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/README.tpl @@ -0,0 +1,10 @@ +# tsproto-packets [![docs.rs](https://docs.rs/tsproto-packets/badge.svg)](https://docs.rs/tsproto-packets) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/src/commands.rs b/native/vendor/tsclientlib/utils/tsproto-packets/src/commands.rs new file mode 100644 index 0000000..895ab72 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/src/commands.rs @@ -0,0 +1,293 @@ +use std::borrow::Cow; +use std::str::{self, FromStr}; + +use crate::{Error, Result}; + +/// Parses arguments of a command. +#[derive(Clone, Debug)] +pub struct CommandParser<'a> { + data: &'a [u8], + index: usize, +} + +#[derive(Clone, Debug)] +pub enum CommandItem<'a> { + Argument(CommandArgument<'a>), + /// Pipe symbol marking the start of the next command. + NextCommand, +} + +#[derive(Clone, Debug)] +pub struct CommandArgument<'a> { + name: &'a [u8], + value: CommandArgumentValue<'a>, +} + +#[derive(Clone, Debug)] +pub struct CommandArgumentValue<'a> { + raw: &'a [u8], + /// The number of escape sequences in this value. + escapes: usize, +} + +impl<'a> CommandParser<'a> { + /// Returns the name and arguments of the given command. + #[inline] + pub fn new(data: &'a [u8]) -> (&'a [u8], Self) { + let mut name_end = 0; + while name_end < data.len() { + if !data[name_end].is_ascii_alphanumeric() { + if data[name_end] == b' ' { + break; + } + // Not a command name + name_end = 0; + break; + } + name_end += 1; + } + + (&data[..name_end], Self { data, index: name_end }) + } + + fn cur(&self) -> u8 { self.data[self.index] } + fn cur_in(&self, cs: &[u8]) -> bool { cs.contains(&self.cur()) } + /// Advance + fn adv(&mut self) { self.index += 1; } + fn at_end(&self) -> bool { self.index >= self.data.len() } + + fn skip_space(&mut self) { + while !self.at_end() && self.cur_in(b"\x0b\x0c\t\r\n ") { + self.adv(); + } + } +} + +impl<'a> Iterator for CommandParser<'a> { + type Item = CommandItem<'a>; + fn next(&mut self) -> Option { + self.skip_space(); + if self.at_end() { + return None; + } + if self.cur() == b'|' { + self.adv(); + return Some(CommandItem::NextCommand); + } + + let name_start = self.index; + while !self.at_end() && !self.cur_in(b" =|") { + self.adv(); + } + let name_end = self.index; + if self.at_end() || self.cur() != b'=' { + return Some(CommandItem::Argument(CommandArgument { + name: &self.data[name_start..name_end], + value: CommandArgumentValue { raw: &[], escapes: 0 }, + })); + } + + self.adv(); + let value_start = self.index; + let mut escapes = 0; + while !self.at_end() { + if self.cur_in(b"\x0b\x0c\t\r\n| ") { + break; + } + if self.cur() == b'\\' { + escapes += 1; + self.adv(); + if self.at_end() || self.cur_in(b"\x0b\x0c\t\r\n| ") { + break; + } + } + self.adv(); + } + let value_end = self.index; + Some(CommandItem::Argument(CommandArgument { + name: &self.data[name_start..name_end], + value: CommandArgumentValue { raw: &self.data[value_start..value_end], escapes }, + })) + } +} + +impl<'a> CommandArgument<'a> { + #[inline] + pub fn name(&self) -> &'a [u8] { self.name } + #[inline] + pub fn value(&self) -> &CommandArgumentValue<'a> { &self.value } +} + +impl<'a> CommandArgumentValue<'a> { + fn unescape(&self) -> Vec { + let mut res = Vec::with_capacity(self.raw.len() - self.escapes); + let mut i = 0; + while i < self.raw.len() { + if self.raw[i] == b'\\' { + i += 1; + if i == self.raw.len() { + return res; + } + res.push(match self.raw[i] { + b'v' => b'\x0b', + b'f' => b'\x0c', + b't' => b'\t', + b'r' => b'\r', + b'n' => b'\n', + b'p' => b'|', + b's' => b' ', + c => c, + }); + } else { + res.push(self.raw[i]); + } + i += 1; + } + res + } + + #[inline] + pub fn get_raw(&self) -> &'a [u8] { self.raw } + #[inline] + pub fn get(&self) -> Cow<'a, [u8]> { + if self.escapes == 0 { Cow::Borrowed(self.raw) } else { Cow::Owned(self.unescape()) } + } + + #[inline] + pub fn get_str(&self) -> Result> { + if self.escapes == 0 { + Ok(Cow::Borrowed(str::from_utf8(self.raw)?)) + } else { + Ok(Cow::Owned(String::from_utf8(self.unescape())?)) + } + } + + #[inline] + pub fn get_parse(&self) -> std::result::Result + where + E: From<::Err>, + E: From, + { + Ok(self.get_str()?.as_ref().parse()?) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::packets::{Direction, Flags, OutCommand, PacketType}; + use std::str; + + /// Parse and write again. + fn test_loop_with_result(data: &[u8], result: &[u8]) { + let (name, parser) = CommandParser::new(data); + let name = str::from_utf8(name).unwrap(); + + let mut out_command = + OutCommand::new(Direction::S2C, Flags::empty(), PacketType::Command, name); + + println!("\nParsing {}", str::from_utf8(data).unwrap()); + for item in parser { + println!("Item: {:?}", item); + match item { + CommandItem::NextCommand => out_command.start_new_part(), + CommandItem::Argument(arg) => { + out_command.write_arg( + str::from_utf8(arg.name()).unwrap(), + &arg.value().get_str().unwrap(), + ); + } + } + } + + let packet = out_command.into_packet(); + let in_str = str::from_utf8(result).unwrap(); + let out_str = str::from_utf8(packet.content()).unwrap(); + assert_eq!(in_str, out_str); + } + + /// Parse and write again. + fn test_loop(data: &[u8]) { test_loop_with_result(data, data); } + + const TEST_COMMANDS: &[&str] = &[ + "cmd a=1 b=2 c=3", + "cmd a=\\s\\\\ b=\\p c=abc\\tdef", + "cmd a=1 c=3 b=2|b=4|b=5", + "initivexpand2 l=AQCVXTlKF+UQc0yga99dOQ9FJCwLaJqtDb1G7xYPMvHFMwIKVfKADF6zAAcAAAAgQW5vbnltb3VzAAAKQo71lhtEMbqAmtuMLlY8Snr0k2Wmymv4hnHNU6tjQCALKHewCykgcA== beta=\\/8kL8lcAYyMJovVOP6MIUC1oZASyuL\\/Y\\/qjVG06R4byuucl9oPAvR7eqZI7z8jGm9jkGmtJ6 omega=MEsDAgcAAgEgAiBxu2eCLQf8zLnuJJ6FtbVjfaOa1210xFgedoXuGzDbTgIgcGk35eqFavKxS4dROi5uKNSNsmzIL4+fyh5Z\\/+FWGxU= ot=1 proof=MEUCIQDRCP4J9e+8IxMJfCLWWI1oIbNPGcChl+3Jr2vIuyDxzAIgOrzRAFPOuJZF4CBw\\/xgbzEsgKMtEtgNobF6WXVNhfUw= tvd time=1544221457", + + "clientinitiv alpha=41Te9Ar7hMPx+A== omega=MEwDAgcAAgEgAiEAq2iCMfcijKDZ5tn2tuZcH+\\/GF+dmdxlXjDSFXLPGadACIHzUnbsPQ0FDt34Su4UXF46VFI0+4wjMDNszdoDYocu0 ip", + + // Well, that's more corrupted packet, but the parser should be robust + "initserver virtualserver_name=Server\\sder\\sVerplanten \ + virtualserver_welcomemessage=This\\sis\\sSplamys\\sWorld \ + virtualserver_platform=Linux \ + virtualserver_version=3.0.13.8\\s[Build:\\s1500452811] \ + virtualserver_maxclients=32 virtualserver_created=0 \ + virtualserver_nodec_encryption_mode=1 \ + virtualserver_hostmessage=Lé\\sServer\\sde\\sSplamy \ + virtualserver_name=Server_mode=0 virtualserver_default_server \ + group=8 virtualserver_default_channel_group=8 \ + virtualserver_hostbanner_url virtualserver_hostmessagegfx_url \ + virtualserver_hostmessagegfx_interval=2000 \ + virtualserver_priority_speaker_dimm_modificat", + + "channellist cid=2 cpid=0 channel_name=Trusted\\sChannel \ + channel_topic channel_codec=0 channel_codec_quality=0 \ + channel_maxclients=0 channel_maxfamilyclients=-1 channel_order=1 \ + channel_flag_permanent=1 channel_flag_semi_permanent=0 \ + channel_flag_default=0 channel_flag_password=0 \ + channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 \ + channel_delete_delay=0 channel_flag_maxclients_unlimited=0 \ + channel_flag_maxfamilyclients_unlimited=0 \ + channel_flag_maxfamilyclients_inherited=1 \ + channel_needed_talk_power=0 channel_forced_silence=0 \ + channel_name_phonetic channel_icon_id=0 \ + channel_flag_private=0|cid=4 cpid=2 \ + channel_name=Ding\\s•\\s1\\s\\p\\sSplamy´s\\sBett channel_topic \ + channel_codec=4 channel_codec_quality=7 channel_maxclients=-1 \ + channel_maxfamilyclients=-1 channel_order=0 \ + channel_flag_permanent=1 channel_flag_semi_permanent=0 \ + channel_flag_default=0 channel_flag_password=0 \ + channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 \ + channel_delete_delay=0 channel_flag_maxclients_unlimited=1 \ + channel_flag_maxfamilyclients_unlimited=0 \ + channel_flag_maxfamilyclients_inherited=1 \ + channel_needed_talk_power=0 channel_forced_silence=0 \ + channel_name_phonetic=Neo\\sSeebi\\sEvangelion channel_icon_id=0 \ + channel_flag_private=0", //|cid=6 cpid=2 channel_name=Ding\\s\xe2\x80\xa2\\s2\\s\\p\\sThe\\sBook\\sof\\sHeavy\\sMetal channel_topic channel_codec=2 channel_codec_quality=7 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=4 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic=Not\\senought\\sChannels channel_icon_id=0 channel_flag_private=0|cid=30 cpid=2 channel_name=Ding\\s\xe2\x80\xa2\\s3\\s\\p\\sSenpai\\sGef\xc3\xa4hrlich channel_topic channel_codec=2 channel_codec_quality=7 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=6 channel_flag_permanent=1 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic=The\\strashcan\\shas\\sthe\\strash channel_icon_id=0 channel_flag_private=0", + + "notifychannelsubscribed cid=2|cid=4 es=3867|cid=5 es=18694|cid=6 es=18694|cid=7 es=18694|cid=11 es=18694|cid=13 es=18694|cid=14 es=18694|cid=16 es=18694|cid=22 es=18694|cid=23 es=18694|cid=24 es=18694|cid=25 es=18694|cid=30 es=18694|cid=163 es=18694", + + "notifypermissionlist group_id_end=0|group_id_end=7|group_id_end=13|group_id_end=18|group_id_end=21|group_id_end=21|group_id_end=33|group_id_end=47|group_id_end=77|group_id_end=82|group_id_end=83|group_id_end=106|group_id_end=126|group_id_end=132|group_id_end=143|group_id_end=151|group_id_end=160|group_id_end=162|group_id_end=170|group_id_end=172|group_id_end=190|group_id_end=197|group_id_end=215|group_id_end=227|group_id_end=232|group_id_end=248|permname=b_serverinstance_help_view permdesc=Retrieve\\sinformation\\sabout\\sServerQuery\\scommands|permname=b_serverinstance_version_view permdesc=Retrieve\\sglobal\\sserver\\sversion\\s(including\\splatform\\sand\\sbuild\\snumber)|permname=b_serverinstance_info_view permdesc=Retrieve\\sglobal\\sserver\\sinformation|permname=b_serverinstance_virtualserver_list permdesc=List\\svirtual\\sservers\\sstored\\sin\\sthe\\sdatabase", + + // Server query + "cmd=1 cid=2", + "channellistfinished", + // With newlines + "sendtextmessage text=\\nmess\\nage\\n return_code=11", + ]; + + #[test] + fn loop_test() { + for cmd in TEST_COMMANDS { + test_loop(cmd.as_bytes()); + } + } + + #[test] + fn optional_arg() { + test_loop(b"cmd a"); + test_loop(b"cmd a b=1"); + + test_loop_with_result(b"cmd a=", b"cmd a"); + test_loop_with_result(b"cmd a= b=1", b"cmd a b=1"); + } + + #[test] + fn no_slash_escape() { + let in_cmd = "clientinitiv alpha=giGMvmfHzbY3ig== omega=MEsDAgcAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50= ot=1 ip"; + let out_cmd = "clientinitiv alpha=giGMvmfHzbY3ig== omega=MEsDAgcAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC\\/50= ot=1 ip"; + + test_loop_with_result(in_cmd.as_bytes(), out_cmd.as_bytes()); + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/src/lib.rs b/native/vendor/tsclientlib/utils/tsproto-packets/src/lib.rs new file mode 100644 index 0000000..ad125fa --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/src/lib.rs @@ -0,0 +1,62 @@ +//! `tsproto-packets` parses and serializes TeamSpeak packets and commands. + +use std::fmt; + +use thiserror::Error; + +pub mod commands; +pub mod packets; + +type Result = std::result::Result; + +pub const S2C_HEADER_LEN: usize = 11; +pub const C2S_HEADER_LEN: usize = 13; + +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + #[error(transparent)] + Base64(#[from] base64::DecodeError), + #[error(transparent)] + Io(#[from] std::io::Error), + #[error(transparent)] + ParseInt(#[from] std::num::ParseIntError), + #[error(transparent)] + Utf8(#[from] std::str::Utf8Error), + #[error(transparent)] + StringUtf8(#[from] std::string::FromUtf8Error), + + #[error("Invalid init step {0}")] + InvalidInitStep(u8), + #[error("Invalid audio codec {0}")] + InvalidCodec(u8), + #[error("Packet content is too short (length {0})")] + PacketContentTooShort(usize), + #[error("Packet is too short (length {0})")] + PacketTooShort(usize), + #[error("Cannot parse command ({0})")] + ParseCommand(String), + #[error("Got a packet with unknown type ({0})")] + UnknownPacketType(u8), + #[error("Tried to parse a packet from the wrong direction")] + WrongDirection, + #[error("Wrong mac, expected TS3INIT1 but got {0:?}")] + WrongInitMac(Vec), + #[error("Wrong packet type ({0:?})")] + WrongPacketType(packets::PacketType), +} + +pub struct HexSlice<'a, T: fmt::LowerHex + 'a>(pub &'a [T]); + +impl<'a> fmt::Display for HexSlice<'a, u8> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Hex[")?; + if let Some((l, m)) = self.0.split_last() { + for b in m { + write!(f, "{:02x} ", b)?; + } + write!(f, "{:02x}", l)?; + } + write!(f, "]") + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-packets/src/packets.rs b/native/vendor/tsclientlib/utils/tsproto-packets/src/packets.rs new file mode 100644 index 0000000..750d8fe --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-packets/src/packets.rs @@ -0,0 +1,1251 @@ +#![allow(clippy::new_ret_no_self)] +use std::convert::TryInto; +use std::io::prelude::*; +use std::{fmt, io, str}; + +use base64::prelude::*; +use bitflags::bitflags; +use num_derive::{FromPrimitive, ToPrimitive}; +use num_traits::{FromPrimitive as _, ToPrimitive as _}; +use omnom::{ReadExt, WriteExt}; +use serde::{Deserialize, Serialize}; + +use crate::{Error, HexSlice, Result}; + +#[derive( + Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, ToPrimitive, Serialize, +)] +#[repr(u8)] +pub enum PacketType { + Voice, + VoiceWhisper, + Command, + CommandLow, + Ping, + Pong, + Ack, + AckLow, + Init, +} + +#[derive(Clone, Copy, Deserialize, Debug, Eq, PartialEq, Hash, Serialize)] +pub enum Direction { + /// Going from the server to the client. + S2C, + /// Going from the client to the server. + C2S, +} + +bitflags! { + #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct Flags: u8 { + const UNENCRYPTED = 0x80; + const COMPRESSED = 0x40; + const NEWPROTOCOL = 0x20; + const FRAGMENTED = 0x10; + } +} + +impl PacketType { + pub fn is_command(self) -> bool { + self == PacketType::Command || self == PacketType::CommandLow + } + pub fn is_ack(self) -> bool { + self == PacketType::Ack || self == PacketType::AckLow || self == PacketType::Pong + } + pub fn is_voice(self) -> bool { self == PacketType::Voice || self == PacketType::VoiceWhisper } +} + +#[repr(u8)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, FromPrimitive, ToPrimitive)] +pub enum CodecType { + /// Mono, 16 bit, 8 kHz, bitrate dependent on the quality setting + SpeexNarrowband, + /// Mono, 16 bit, 16 kHz, bitrate dependent on the quality setting + SpeexWideband, + /// Mono, 16 bit, 32 kHz, bitrate dependent on the quality setting + SpeexUltrawideband, + /// Mono, 16 bit, 48 kHz, bitrate dependent on the quality setting + CeltMono, + /// Mono, 16 bit, 48 kHz, bitrate dependent on the quality setting, optimized for voice + OpusVoice, + /// Stereo, 16 bit, 48 kHz, bitrate dependent on the quality setting, optimized for music + OpusMusic, +} + +macro_rules! create_buf { + ($($name:ident, $borrow_name:ident, $convert:ident);*) => { + mod rentals { + use super::*; + + $(self_cell::self_cell!( + pub struct $name { + owner: Vec, + #[covariant] + dependent: $borrow_name, + } + + impl {Debug} + );)* + } + + $( + #[derive(Debug)] + pub struct $name(rentals::$name); + + impl $name { + /// `InPacket::try_new` is not checked and must succeed. Otherwise, it + /// panics. + #[inline] + pub fn try_new(direction: Direction, data: Vec) -> Result { + Ok(Self(rentals::$name::try_new(data, |data| InPacket::new(direction, data).$convert())?)) + } + #[inline] + pub fn raw_data(&self) -> &[u8] { self.0.borrow_owner().as_slice() } + #[inline] + pub fn data(&self) -> &$borrow_name<'_> { self.0.borrow_dependent() } + #[inline] + pub fn into_buffer(self) -> Vec { self.0.into_owner() } + } + )* + } +} + +create_buf!(InAudioBuf, InAudio, into_audio; + InCommandBuf, InCommand, into_command; + InC2SInitBuf, InC2SInit, into_c2sinit; + InS2CInitBuf, InS2CInit, into_s2cinit); + +/// Used for debugging. +#[derive(Clone)] +pub struct InUdpPacket<'a>(pub InPacket<'a>); + +impl<'a> InUdpPacket<'a> { + pub fn new(packet: InPacket<'a>) -> Self { Self(packet) } +} + +#[derive(Clone)] +pub struct InHeader<'a> { + direction: Direction, + data: &'a [u8], +} + +#[derive(Clone)] +pub struct InPacket<'a> { + header: InHeader<'a>, + content: &'a [u8], +} + +#[derive(Clone, Debug)] +pub struct InCommand<'a> { + packet: InPacket<'a>, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Hash, Serialize)] +pub struct OutUdpPacket { + generation_id: u32, + data: OutPacket, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Hash, Serialize)] +pub struct OutPacket { + dir: Direction, + data: Vec, +} + +/// The mac has to be `b"TS3INIT1"`. +/// +/// `version` always contains the Teamspeak version as timestamp. +/// +/// `timestamp` contains a current timestamp. +#[derive(Clone)] +pub enum C2SInitData<'a> { + Init0 { + version: u32, + timestamp: u32, + random0: &'a [u8; 4], + }, + Init2 { + version: u32, + random1: &'a [u8; 16], + random0_r: &'a [u8; 4], + }, + Init4 { + version: u32, + x: &'a [u8; 64], + n: &'a [u8; 64], + level: u32, + random2: &'a [u8; 100], + /// y = x ^ (2 ^ level) % n + y: &'a [u8; 64], + /// Has to be a `clientinitiv alpha=… omega=…` command. + command: &'a [u8], + }, +} + +#[derive(Clone)] +pub enum S2CInitData<'a> { + Init1 { random1: &'a [u8; 16], random0_r: &'a [u8; 4] }, + Init3 { x: &'a [u8; 64], n: &'a [u8; 64], level: u32, random2: &'a [u8; 100] }, + Init127 {}, +} + +#[derive(Clone, Debug)] +pub struct InS2CInit<'a> { + packet: InPacket<'a>, + data: S2CInitData<'a>, +} + +#[derive(Clone, Debug)] +pub struct InC2SInit<'a> { + packet: InPacket<'a>, + data: C2SInitData<'a>, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AudioData<'a> { + C2S { + id: u16, + codec: CodecType, + data: &'a [u8], + }, + C2SWhisper { + id: u16, + codec: CodecType, + channels: Vec, + clients: Vec, + data: &'a [u8], + }, + /// When the `Flags::NEWPROTOCOL` is set. + C2SWhisperNew { + id: u16, + codec: CodecType, + whisper_type: u8, + target: u8, + target_id: u64, + data: &'a [u8], + }, + + S2C { + id: u16, + from: u16, + codec: CodecType, + data: &'a [u8], + }, + S2CWhisper { + id: u16, + from: u16, + codec: CodecType, + data: &'a [u8], + }, +} + +#[derive(Clone)] +pub struct InAudio<'a> { + packet: InPacket<'a>, + data: AudioData<'a>, +} + +#[must_use] +pub struct OutCommand(pub OutPacket); +pub struct OutC2SInit0; +pub struct OutC2SInit2; +pub struct OutC2SInit4; +pub struct OutS2CInit1; +pub struct OutS2CInit3; +pub struct OutAck; +pub struct OutAudio; + +/// A helper to escape data while writing into a buffer. +struct EscapedWriter<'a>(&'a mut Vec); + +impl Direction { + #[inline] + pub fn reverse(self) -> Self { + match self { + Direction::S2C => Direction::C2S, + Direction::C2S => Direction::S2C, + } + } +} + +impl<'a> InPacket<'a> { + /// Do some sanity checks before creating the object. + #[inline] + pub fn try_new(direction: Direction, data: &'a [u8]) -> Result { + let header_len = + if direction == Direction::S2C { crate::S2C_HEADER_LEN } else { crate::C2S_HEADER_LEN }; + if data.len() < header_len { + return Err(Error::PacketTooShort(data.len())); + } + + // Check packet type + let p_type = data[header_len - 1] & 0xf; + if p_type > 8 { + return Err(Error::UnknownPacketType(p_type)); + } + + Ok(Self::new(direction, data)) + } + + /// This method expects that `data` holds a valid packet. + /// + /// If not, further function calls may panic. + #[inline] + pub fn new(direction: Direction, data: &'a [u8]) -> Self { + let header = InHeader::new(direction, data); + let header_len = header.data.len(); + + Self { header, content: &data[header_len..] } + } + + #[inline] + pub fn header(&self) -> &InHeader<'a> { &self.header } + #[inline] + pub fn content(&self) -> &[u8] { self.content } + + /// Get the acknowledged packet id if this is an ack packet. + #[inline] + pub fn ack_packet(&self) -> Result> { + let p_type = self.header().packet_type(); + if p_type.is_ack() { + Ok(Some( + self.content() + .read_be() + .map_err(|_| Error::PacketContentTooShort(self.content().len()))?, + )) + } else if p_type == PacketType::Init { + if self.header.direction == Direction::S2C { + Ok(Some( + self.content + .first() + .ok_or_else(|| Error::PacketContentTooShort(self.content().len())) + .and_then(|i| match u16::from(*i) { + 1 => Ok(0), + 3 => Ok(2), + 127 => Ok(2), // Have to restart sending Init0, remove Init2 anyway + _ => Err(Error::InvalidInitStep(*i)), + })?, + )) + } else { + Ok(self + .content + .get(4) + .ok_or_else(|| Error::PacketContentTooShort(self.content().len())) + .and_then(|i| match u16::from(*i) { + 0 => Ok(None), + 2 => Ok(Some(1)), + 4 => Ok(Some(3)), + _ => Err(Error::InvalidInitStep(*i)), + })?) + } + } else { + Ok(None) + } + } + + /// Parse this packet into a voice packet. + pub fn into_audio(self) -> Result> { + let p_type = self.header().packet_type(); + let newprotocol = self.header().flags().contains(Flags::NEWPROTOCOL); + let data = AudioData::parse(p_type, newprotocol, self.header.direction, self.content)?; + + Ok(InAudio { packet: self, data }) + } + + /// Put this packet into a command packet. + pub fn into_command(self) -> Result> { Ok(InCommand { packet: self }) } + + pub fn into_s2cinit(self) -> Result> { + if self.header.direction != Direction::S2C { + return Err(Error::WrongDirection); + } + let p_type = self.header().packet_type(); + if p_type != PacketType::Init { + return Err(Error::WrongPacketType(p_type)); + } + let mac = self.header().mac(); + if mac != b"TS3INIT1" { + return Err(Error::WrongInitMac(mac.to_vec())); + } + + if self.content.is_empty() { + return Err(Error::PacketContentTooShort(self.content.len())); + } + + let data; + if self.content[0] == 1 { + if self.content.len() < 21 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + data = S2CInitData::Init1 { + random1: (&self.content[1..17]).try_into().unwrap(), + random0_r: (&self.content[17..21]).try_into().unwrap(), + }; + } else if self.content[0] == 3 { + if self.content.len() < 233 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + data = S2CInitData::Init3 { + x: (&self.content[1..65]).try_into().unwrap(), + n: (&self.content[65..129]).try_into().unwrap(), + level: (&self.content[129..]).read_be()?, + random2: (&self.content[133..233]).try_into().unwrap(), + }; + } else if self.content[0] == 127 { + data = S2CInitData::Init127 {}; + } else { + return Err(Error::InvalidInitStep(self.content[0])); + } + + Ok(InS2CInit { packet: self, data }) + } + + pub fn into_c2sinit(self) -> Result> { + if self.header.direction != Direction::C2S { + return Err(Error::WrongDirection); + } + let p_type = self.header().packet_type(); + if p_type != PacketType::Init { + return Err(Error::WrongPacketType(p_type)); + } + let mac = self.header().mac(); + if mac != b"TS3INIT1" { + return Err(Error::WrongInitMac(mac.to_vec())); + } + + if self.content.len() < 5 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + + let data; + let version = (&self.content[0..]).read_be()?; + if self.content[4] == 0 { + if self.content.len() < 13 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + data = C2SInitData::Init0 { + version, + timestamp: (&self.content[5..]).read_be()?, + random0: (&self.content[9..13]).try_into().unwrap(), + }; + } else if self.content[4] == 2 { + if self.content.len() < 25 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + data = C2SInitData::Init2 { + version, + random1: (&self.content[5..21]).try_into().unwrap(), + random0_r: (&self.content[21..25]).try_into().unwrap(), + }; + } else if self.content[4] == 4 { + let len = 5 + 128 + 4 + 100 + 64; + if self.content.len() < len + 20 { + return Err(Error::PacketContentTooShort(self.content.len())); + } + data = C2SInitData::Init4 { + version, + x: (&self.content[5..69]).try_into().unwrap(), + n: (&self.content[69..133]).try_into().unwrap(), + level: (&self.content[133..]).read_be()?, + random2: (&self.content[137..237]).try_into().unwrap(), + y: (&self.content[237..301]).try_into().unwrap(), + command: &self.content[len..], + }; + } else { + return Err(Error::InvalidInitStep(self.content[0])); + } + + Ok(InC2SInit { packet: self, data }) + } +} + +impl fmt::Debug for InPacket<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Packet({:?}", self.header())?; + let mut success = false; + match self.header.packet_type() { + PacketType::Voice | PacketType::VoiceWhisper => { + if let Ok(packet) = self.clone().into_audio() { + success = true; + write!(f, ", {:?}", packet)?; + } + } + PacketType::Command | PacketType::CommandLow => { + if let Ok(packet) = str::from_utf8(self.content()) { + success = true; + write!(f, ", {:?}", packet)?; + } + } + PacketType::Ping | PacketType::Pong | PacketType::Ack | PacketType::AckLow => { + success = true; + if !self.content().is_empty() { + write!(f, ", 0x")?; + } + for b in self.content() { + write!(f, "{:02x}", b)?; + } + } + PacketType::Init => { + if self.header.direction == Direction::C2S { + if let Ok(packet) = self.clone().into_c2sinit() { + success = true; + write!(f, ", {:?}", packet.data)?; + } + } else if let Ok(packet) = self.clone().into_s2cinit() { + success = true; + write!(f, ", {:?}", packet.data)?; + } + } + } + + if !success { + write!(f, ", failed to parse, content: {})", HexSlice(self.content()))?; + } + + write!(f, ")")?; + Ok(()) + } +} + +impl fmt::Debug for InUdpPacket<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Packet({:?}, content: {})", self.0.header(), HexSlice(self.0.content()))?; + Ok(()) + } +} + +impl fmt::Debug for InHeader<'_> { + #[rustfmt::skip] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Header(")?; + if self.mac() != &[0; 8] { + write!(f, "mac: {}, ", HexSlice(self.mac()))?; + } + write!(f, "id: {:#x}, ", self.packet_id())?; + if let Some(c_id) = self.client_id() { + write!(f, "c_id: {:#x}, ", c_id)?; + } + write!(f, "{:?}, ", self.packet_type())?; + write!(f, "")?; + let flags = self.flags(); + write!(f, "{}", if flags.contains(Flags::UNENCRYPTED) { "u" } else { "-" })?; + write!(f, "{}", if flags.contains(Flags::COMPRESSED) { "c" } else { "-" })?; + write!(f, "{}", if flags.contains(Flags::NEWPROTOCOL) { "n" } else { "-" })?; + write!(f, "{}", if flags.contains(Flags::FRAGMENTED) { "f" } else { "-" })?; + + write!(f, ")")?; + Ok(()) + } +} + +impl<'a> InHeader<'a> { + #[inline] + pub fn new(direction: Direction, data: &'a [u8]) -> Self { + let header_len = + if direction == Direction::S2C { crate::S2C_HEADER_LEN } else { crate::C2S_HEADER_LEN }; + + Self { direction, data: &data[..header_len] } + } + + /// The offset to the packet type. + #[inline] + fn get_off(&self) -> usize { if self.direction == Direction::S2C { 10 } else { 12 } } + + #[inline] + pub fn direction(&self) -> Direction { self.direction } + #[inline] + pub fn data(&self) -> &'a [u8] { self.data } + #[inline] + pub fn mac(&self) -> &'a [u8; 8] { (&self.data[..8]).try_into().unwrap() } + #[inline] + pub fn packet_id(&self) -> u16 { (&self.data[8..10]).read_be().unwrap() } + + #[inline] + pub fn client_id(&self) -> Option { + if self.direction == Direction::S2C { + None + } else { + Some((&self.data[10..12]).read_be().unwrap()) + } + } + + #[inline] + pub fn flags(&self) -> Flags { Flags::from_bits(self.data[self.get_off()] & 0xf0).unwrap() } + + #[inline] + pub fn packet_type(&self) -> PacketType { + PacketType::from_u8(self.data[self.get_off()] & 0xf).unwrap() + } + + pub fn get_meta(&self) -> &'a [u8] { &self.data[8..] } +} + +impl C2SInitData<'_> { + pub fn get_step(&self) -> u8 { + match self { + C2SInitData::Init0 { .. } => 0, + C2SInitData::Init2 { .. } => 2, + C2SInitData::Init4 { .. } => 4, + } + } +} + +impl<'a> fmt::Debug for C2SInitData<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + C2SInitData::Init0 { .. } => write!(f, "Init0"), + C2SInitData::Init2 { .. } => write!(f, "Init2"), + C2SInitData::Init4 { level, command, .. } => { + write!(f, "Init4(level: {}, ", level)?; + if let Ok(s) = str::from_utf8(command) { + write!(f, "{:?}", s)?; + } else { + write!(f, "{}", HexSlice(command))?; + } + write!(f, ")")?; + Ok(()) + } + } + } +} + +impl S2CInitData<'_> { + pub fn get_step(&self) -> u8 { + match self { + S2CInitData::Init1 { .. } => 1, + S2CInitData::Init3 { .. } => 3, + S2CInitData::Init127 { .. } => 127, + } + } +} + +impl<'a> fmt::Debug for S2CInitData<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + S2CInitData::Init1 { .. } => write!(f, "Init1"), + S2CInitData::Init3 { level, .. } => write!(f, "Init3(level: {})", level), + S2CInitData::Init127 { .. } => write!(f, "Init127"), + } + } +} + +impl<'a> InCommand<'a> { + #[inline] + pub fn packet(&self) -> &InPacket<'a> { &self.packet } +} + +impl<'a> AudioData<'a> { + pub fn parse( + p_type: PacketType, newprotocol: bool, dir: Direction, content: &'a [u8], + ) -> Result { + let id = (&content[..]).read_be()?; + if p_type == PacketType::Voice { + if dir == Direction::S2C { + if content.len() < 5 { + return Err(Error::PacketContentTooShort(content.len())); + } + Ok(AudioData::S2C { + id, + from: (&content[2..]).read_be()?, + codec: CodecType::from_u8(content[4]) + .ok_or_else(|| Error::InvalidCodec(content[4]))?, + data: &content[5..], + }) + } else { + if content.len() < 3 { + return Err(Error::PacketContentTooShort(content.len())); + } + Ok(AudioData::C2S { + id, + codec: CodecType::from_u8(content[2]) + .ok_or_else(|| Error::InvalidCodec(content[4]))?, + data: &content[3..], + }) + } + } else if dir == Direction::S2C { + if content.len() < 5 { + return Err(Error::PacketContentTooShort(content.len())); + } + Ok(AudioData::S2CWhisper { + id, + from: (&content[2..]).read_be()?, + codec: CodecType::from_u8(content[4]) + .ok_or_else(|| Error::InvalidCodec(content[4]))?, + data: &content[5..], + }) + } else { + if content.len() < 3 { + return Err(Error::PacketContentTooShort(content.len())); + } + let codec = + CodecType::from_u8(content[2]).ok_or_else(|| Error::InvalidCodec(content[4]))?; + if newprotocol { + if content.len() < 14 { + return Err(Error::PacketContentTooShort(content.len())); + } + Ok(AudioData::C2SWhisperNew { + id, + codec, + whisper_type: content[3], + target: content[4], + target_id: (&content[5..]).read_be()?, + data: &content[13..], + }) + } else { + if content.len() < 5 { + return Err(Error::PacketContentTooShort(content.len())); + } + let channel_count = content[3] as usize; + let client_count = content[4] as usize; + let channel_off = 5; + let client_off = channel_off + channel_count * 8; + let off = client_off + client_count * 2; + if content.len() < off { + return Err(Error::PacketContentTooShort(content.len())); + } + + Ok(AudioData::C2SWhisper { + id, + codec, + channels: (0..channel_count) + .map(|i| (&content[channel_off + i * 8..]).read_be()) + .collect::<::std::result::Result, _>>()?, + clients: (0..client_count) + .map(|i| (&content[client_off + i * 2..]).read_be()) + .collect::<::std::result::Result, _>>()?, + data: &content[off..], + }) + } + } + } + + #[inline] + pub fn direction(&self) -> Direction { + match self { + AudioData::C2S { .. } => Direction::C2S, + AudioData::C2SWhisper { .. } => Direction::C2S, + AudioData::C2SWhisperNew { .. } => Direction::C2S, + AudioData::S2C { .. } => Direction::S2C, + AudioData::S2CWhisper { .. } => Direction::S2C, + } + } + + #[inline] + pub fn packet_type(&self) -> PacketType { + match self { + AudioData::C2S { .. } => PacketType::Voice, + AudioData::C2SWhisper { .. } => PacketType::VoiceWhisper, + AudioData::C2SWhisperNew { .. } => PacketType::VoiceWhisper, + AudioData::S2C { .. } => PacketType::Voice, + AudioData::S2CWhisper { .. } => PacketType::VoiceWhisper, + } + } + + #[inline] + pub fn codec(&self) -> CodecType { + match self { + AudioData::C2S { codec, .. } => *codec, + AudioData::C2SWhisper { codec, .. } => *codec, + AudioData::C2SWhisperNew { codec, .. } => *codec, + AudioData::S2C { codec, .. } => *codec, + AudioData::S2CWhisper { codec, .. } => *codec, + } + } + + #[inline] + pub fn id(&self) -> u16 { + match self { + AudioData::C2S { id, .. } => *id, + AudioData::C2SWhisper { id, .. } => *id, + AudioData::C2SWhisperNew { id, .. } => *id, + AudioData::S2C { id, .. } => *id, + AudioData::S2CWhisper { id, .. } => *id, + } + } + + #[inline] + pub fn flags(&self) -> Flags { + match self { + AudioData::C2S { .. } => Flags::empty(), + AudioData::C2SWhisper { .. } => Flags::empty(), + AudioData::C2SWhisperNew { .. } => Flags::NEWPROTOCOL, + AudioData::S2C { .. } => Flags::empty(), + AudioData::S2CWhisper { .. } => Flags::empty(), + } + } + + #[inline] + pub fn data(&self) -> &[u8] { + match self { + AudioData::C2S { data, .. } => data, + AudioData::C2SWhisper { data, .. } => data, + AudioData::C2SWhisperNew { data, .. } => data, + AudioData::S2C { data, .. } => data, + AudioData::S2CWhisper { data, .. } => data, + } + } +} + +impl<'a> InS2CInit<'a> { + #[inline] + pub fn packet(&self) -> &InPacket<'a> { &self.packet } + #[inline] + pub fn data(&self) -> &S2CInitData<'a> { &self.data } +} + +impl<'a> InC2SInit<'a> { + #[inline] + pub fn packet(&self) -> &InPacket<'a> { &self.packet } + #[inline] + pub fn data(&self) -> &C2SInitData<'a> { &self.data } +} + +impl<'a> InAudio<'a> { + #[inline] + pub fn packet(&self) -> &InPacket<'a> { &self.packet } + #[inline] + pub fn data(&self) -> &AudioData<'a> { &self.data } +} + +impl fmt::Debug for InAudio<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match &self.data { + AudioData::C2S { id, codec, data } => { + write!(f, "Audio(id: {}, {:?}, {})", id, codec, HexSlice(data))?; + } + AudioData::C2SWhisper { id, codec, channels, clients, data } => { + write!( + f, + "Whisper(id: {}, {:?}, channels: {:?}, clients: {:?}, {})", + id, + codec, + channels, + clients, + HexSlice(data) + )?; + } + AudioData::C2SWhisperNew { id, codec, whisper_type, target, target_id, data } => { + write!( + f, + "WhisperNew(id: {}, {:?}, type: {}, target: {}, target_id: {}, {})", + id, + codec, + whisper_type, + target, + target_id, + HexSlice(data) + )?; + } + AudioData::S2C { id, from, codec, data } => { + write!(f, "Audio(id: {}, from: {}, {:?}, {})", id, from, codec, HexSlice(data))?; + } + AudioData::S2CWhisper { id, from, codec, data } => { + write!(f, "Whisper(id: {}, from: {}, {:?}, {})", id, from, codec, HexSlice(data))?; + } + } + + Ok(()) + } +} + +impl OutPacket { + #[inline] + pub fn new( + mac: [u8; 8], packet_id: u16, client_id: Option, flags: Flags, packet_type: PacketType, + ) -> Self { + let dir = if client_id.is_some() { Direction::C2S } else { Direction::S2C }; + let mut res = Self::new_with_dir(dir, flags, packet_type); + res.data[..8].copy_from_slice(&mac); + res.packet_id(packet_id); + if let Some(cid) = client_id { + res.client_id(cid); + } + res + } + + /// Fill packet with known data. The rest gets filled by `packet_codec`. + #[inline] + pub fn new_with_dir(dir: Direction, flags: Flags, packet_type: PacketType) -> Self { + let data = + vec![ + 0; + if dir == Direction::S2C { crate::S2C_HEADER_LEN } else { crate::C2S_HEADER_LEN } + ]; + let mut res = Self { dir, data }; + res.flags(flags); + res.packet_type(packet_type); + res + } + + #[inline] + pub fn new_from_data(dir: Direction, data: Vec) -> Self { Self { dir, data } } + + #[inline] + pub fn into_vec(self) -> Vec { self.data } + + #[inline] + fn content_offset(&self) -> usize { + if self.dir == Direction::S2C { crate::S2C_HEADER_LEN } else { crate::C2S_HEADER_LEN } + } + + #[inline] + pub fn data(&self) -> &[u8] { &self.data } + #[inline] + pub fn data_mut(&mut self) -> &mut Vec { &mut self.data } + #[inline] + pub fn content(&self) -> &[u8] { &self.data[self.content_offset()..] } + #[inline] + pub fn content_mut(&mut self) -> &mut [u8] { + let off = self.content_offset(); + &mut self.data[off..] + } + #[inline] + pub fn direction(&self) -> Direction { self.dir } + #[inline] + pub fn header(&self) -> InHeader<'_> { + InHeader { direction: self.dir, data: self.header_bytes() } + } + #[inline] + pub fn header_bytes(&self) -> &[u8] { &self.data[..self.content_offset()] } + #[inline] + pub fn packet(&self) -> InPacket<'_> { InPacket::new(self.dir, &self.data) } + + #[inline] + pub fn mac(&mut self) -> &mut [u8; 8] { (&mut self.data[0..8]).try_into().unwrap() } + #[inline] + pub fn packet_id(&mut self, packet_id: u16) { + (&mut self.data[8..10]).write_be(packet_id).unwrap(); + } + #[inline] + pub fn client_id(&mut self, client_id: u16) { + assert_eq!( + self.dir, + Direction::C2S, + "Client id is only valid for client to server packets" + ); + (&mut self.data[10..12]).write_be(client_id).unwrap(); + } + #[inline] + pub fn flags(&mut self, flags: Flags) { + let off = self.header().get_off(); + self.data[off] = (self.data[off] & 0xf) | flags.bits(); + } + #[inline] + pub fn packet_type(&mut self, packet_type: PacketType) { + let off = self.header().get_off(); + self.data[off] = (self.data[off] & 0xf0) | packet_type.to_u8().unwrap(); + } +} + +impl OutUdpPacket { + #[inline] + pub fn new(generation_id: u32, data: OutPacket) -> Self { Self { generation_id, data } } + + #[inline] + pub fn generation_id(&self) -> u32 { self.generation_id } + #[inline] + pub fn data(&self) -> &OutPacket { &self.data } + + #[inline] + pub fn packet_id(&self) -> u16 { + if self.packet_type() == PacketType::Init { + if self.data.dir == Direction::S2C { + u16::from(self.data.content()[0]) + } else { + u16::from(self.data.content()[4]) + } + } else { + self.data.header().packet_id() + } + } + #[inline] + pub fn packet_type(&self) -> PacketType { self.data.header().packet_type() } +} + +impl io::Write for EscapedWriter<'_> { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.0.reserve(buf.len()); + for c in buf { + match c { + b'\x0b' => self.0.extend_from_slice(b"\\v"), + b'\x0c' => self.0.extend_from_slice(b"\\f"), + b'\\' => self.0.extend_from_slice(b"\\\\"), + b'\t' => self.0.extend_from_slice(b"\\t"), + b'\r' => self.0.extend_from_slice(b"\\r"), + b'\n' => self.0.extend_from_slice(b"\\n"), + b'|' => self.0.extend_from_slice(b"\\p"), + b' ' => self.0.extend_from_slice(b"\\s"), + b'/' => self.0.extend_from_slice(b"\\/"), + c => self.0.push(*c), + } + } + Ok(buf.len()) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { Ok(()) } +} + +impl OutCommand { + #[inline] + pub fn new(dir: Direction, flags: Flags, p_type: PacketType, name: &str) -> Self { + let mut res = Self(OutPacket::new_with_dir(dir, Flags::empty(), p_type)); + res.0.flags(flags); + res.0.data.extend_from_slice(name.as_bytes()); + res + } + + /// For binary arguments. The value will still be escaped. + #[inline] + pub fn write_bin_arg(&mut self, name: &str, value: &[u8]) { + if self.0.content().last() != Some(&b'|') && !self.0.content().is_empty() { + self.0.data.push(b' '); + } + self.0.data.extend_from_slice(name.as_bytes()); + if !value.is_empty() { + self.0.data.push(b'='); + EscapedWriter(&mut self.0.data).write_all(value).unwrap(); + } + } + + /// The value will be formatted and escaped. + #[inline] + pub fn write_arg(&mut self, name: &str, value: &dyn fmt::Display) { + if self.0.content().last() != Some(&b'|') && !self.0.content().is_empty() { + self.0.data.push(b' '); + } + self.0.data.extend_from_slice(name.as_bytes()); + self.0.data.push(b'='); + let len = self.0.data.len(); + write!(EscapedWriter(&mut self.0.data), "{}", value).unwrap(); + if self.0.data.len() == len { + // Nothing was written, remove = + self.0.data.pop(); + } + } + + /// Adds a pipe symbol `|` to the command. + #[inline] + pub fn start_new_part(&mut self) { self.0.data.push(b'|'); } + #[inline] + pub fn into_packet(self) -> OutPacket { self.0 } +} + +impl OutC2SInit0 { + pub fn new(version: u32, timestamp: u32, random0: [u8; 4]) -> OutPacket { + let mut res = OutPacket::new_with_dir(Direction::C2S, Flags::empty(), PacketType::Init); + res.mac().copy_from_slice(b"TS3INIT1"); + res.packet_id(0x65); + let content = res.data_mut(); + content.write_be(version).unwrap(); + content.write_be(0u8).unwrap(); + content.write_be(timestamp).unwrap(); + content.write_all(&random0).unwrap(); + // Reserved + content.write_all(&[0u8; 8]).unwrap(); + res + } +} + +impl OutC2SInit2 { + pub fn new(version: u32, random1: &[u8; 16], random0_r: [u8; 4]) -> OutPacket { + let mut res = OutPacket::new_with_dir(Direction::C2S, Flags::empty(), PacketType::Init); + res.mac().copy_from_slice(b"TS3INIT1"); + res.packet_id(0x65); + let content = res.data_mut(); + content.write_be(version).unwrap(); + content.write_be(2u8).unwrap(); + content.write_all(random1).unwrap(); + content.write_all(&random0_r).unwrap(); + res + } +} + +impl OutC2SInit4 { + pub fn new( + version: u32, x: &[u8; 64], n: &[u8; 64], level: u32, random2: &[u8; 100], y: &[u8; 64], + alpha: &[u8], omega: &[u8], ip: &str, + ) -> OutPacket { + let mut res = OutPacket::new_with_dir(Direction::C2S, Flags::empty(), PacketType::Init); + res.mac().copy_from_slice(b"TS3INIT1"); + res.packet_id(0x65); + let content = res.data_mut(); + content.write_be(version).unwrap(); + content.write_be(4u8).unwrap(); + content.write_all(x).unwrap(); + content.write_all(n).unwrap(); + content.write_be(level).unwrap(); + content.write_all(random2).unwrap(); + content.write_all(y).unwrap(); + let ip = if ip.is_empty() { String::new() } else { format!("={}", ip) }; + content + .write_all( + format!( + "clientinitiv alpha={} omega={} ot=1 ip{}", + BASE64_STANDARD.encode(alpha), + BASE64_STANDARD.encode(omega), + ip + ) + .as_bytes(), + ) + .unwrap(); + res + } +} + +impl OutS2CInit1 { + pub fn new(random1: &[u8; 16], random0_r: [u8; 4]) -> OutPacket { + let mut res = OutPacket::new_with_dir(Direction::S2C, Flags::empty(), PacketType::Init); + res.mac().copy_from_slice(b"TS3INIT1"); + res.packet_id(0x65); + let content = res.data_mut(); + content.write_be(1u8).unwrap(); + content.write_all(random1).unwrap(); + content.write_all(&random0_r).unwrap(); + res + } +} + +impl OutS2CInit3 { + pub fn new(x: &[u8; 64], n: &[u8; 64], level: u32, random2: &[u8; 100]) -> OutPacket { + let mut res = OutPacket::new_with_dir(Direction::S2C, Flags::empty(), PacketType::Init); + res.mac().copy_from_slice(b"TS3INIT1"); + res.packet_id(0x65); + let content = res.data_mut(); + content.write_be(3u8).unwrap(); + content.write_all(x).unwrap(); + content.write_all(n).unwrap(); + content.write_be(level).unwrap(); + content.write_all(random2).unwrap(); + res + } +} + +impl OutAck { + /// `for_type` is the packet type which gets acknowledged, so e.g. `Command`. + pub fn new(dir: Direction, for_type: PacketType, packet_id: u16) -> OutPacket { + let p_type = if for_type == PacketType::Command { + PacketType::Ack + } else if for_type == PacketType::CommandLow { + PacketType::AckLow + } else if for_type == PacketType::Ping { + PacketType::Pong + } else { + panic!("Invalid packet type to create ack {:?}", for_type); + }; + + let mut res = OutPacket::new_with_dir(dir, Flags::empty(), p_type); + let content = res.data_mut(); + content.write_be(packet_id).unwrap(); + res + } +} + +impl OutAudio { + pub fn new(data: &AudioData) -> OutPacket { + let mut res = OutPacket::new_with_dir(data.direction(), data.flags(), data.packet_type()); + let content = res.data_mut(); + + content.write_be(data.id()).unwrap(); + match data { + AudioData::C2S { codec, data, .. } => { + content.write_be(codec.to_u8().unwrap()).unwrap(); + content.extend_from_slice(data); + } + AudioData::C2SWhisper { codec, channels, clients, data, .. } => { + content.write_be(codec.to_u8().unwrap()).unwrap(); + content.write_be(channels.len() as u8).unwrap(); + content.write_be(clients.len() as u8).unwrap(); + + for c in channels { + content.write_be(*c).unwrap(); + } + for c in clients { + content.write_be(*c).unwrap(); + } + content.extend_from_slice(data); + } + AudioData::C2SWhisperNew { codec, whisper_type, target, target_id, data, .. } => { + content.write_be(codec.to_u8().unwrap()).unwrap(); + content.write_be(whisper_type.to_u8().unwrap()).unwrap(); + content.write_be(*target).unwrap(); + content.write_be(*target_id).unwrap(); + content.extend_from_slice(data); + } + AudioData::S2C { from, codec, data, .. } + | AudioData::S2CWhisper { from, codec, data, .. } => { + content.write_be(*from).unwrap(); + content.write_be(codec.to_u8().unwrap()).unwrap(); + content.extend_from_slice(data); + } + } + + res + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn test_audio_roundtrip(dir: Direction, data: &AudioData) { + let out_p = OutAudio::new(data); + let in_p = InPacket::try_new(dir, out_p.data()).unwrap(); + let audio = in_p.into_audio().unwrap(); + assert_eq!(audio.data(), data); + } + + #[test] + fn test_audio_c2s() { + let data = AudioData::C2S { codec: CodecType::OpusVoice, id: 0x1234, data: &[1, 2, 3] }; + test_audio_roundtrip(Direction::C2S, &data); + } + + #[test] + fn test_audio_c2s_whisper() { + let data = AudioData::C2SWhisper { + codec: CodecType::OpusVoice, + channels: vec![4, 5, 6], + clients: vec![7, 8], + id: 0x1234, + data: &[1, 2, 3], + }; + test_audio_roundtrip(Direction::C2S, &data); + } + + #[test] + fn test_audio_c2s_whisper_new() { + let data = AudioData::C2SWhisperNew { + codec: CodecType::OpusVoice, + whisper_type: 3, + target: 4, + target_id: 5, + id: 0x1234, + data: &[1, 2, 3], + }; + test_audio_roundtrip(Direction::C2S, &data); + } + + #[test] + fn test_audio_s2c() { + let data = AudioData::S2C { + codec: CodecType::OpusVoice, + id: 0x1234, + from: 0x5678, + data: &[1, 2, 3], + }; + test_audio_roundtrip(Direction::S2C, &data); + } + + #[test] + fn test_audio_s2c_whisper() { + let data = AudioData::S2CWhisper { + codec: CodecType::OpusVoice, + id: 0x1234, + from: 0x5678, + data: &[1, 2, 3], + }; + test_audio_roundtrip(Direction::S2C, &data); + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/Cargo.toml b/native/vendor/tsclientlib/utils/tsproto-structs/Cargo.toml new file mode 100644 index 0000000..e44dd2e --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "tsproto-structs" +version = "0.2.0" +authors = ["Flakebi ", "Splamy "] +description = "Resource files for several TeamSpeak related data." +repository = "https://github.com/ReSpeak/tsclientlib/tree/master/utils/tsproto-structs" +readme = "README.md" +keywords = ["teamspeak3", "ts3"] +license = "MIT OR Apache-2.0" +edition = "2018" +include = [ + "/Cargo.toml", + "/README.md", + "/src/*.rs", + "/declarations/Book.toml", + "/declarations/BookToMessages.toml", + "/declarations/Enums.toml", + "/declarations/Errors.csv", + "/declarations/Messages.toml", + "/declarations/MessagesToBook.toml", + "/declarations/Permissions.csv", + "/declarations/Versions.csv", +] + +[dependencies] +base64 = "0.22" +csv = "1" +heck = "0.5" +once_cell = "1" +serde = { version = "1", features = ["derive"] } +toml = "1" diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/README.md b/native/vendor/tsclientlib/utils/tsproto-structs/README.md new file mode 100644 index 0000000..7644f96 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/README.md @@ -0,0 +1,13 @@ +# tsproto-structs [![docs.rs](https://docs.rs/tsproto-structs/badge.svg)](https://docs.rs/tsproto-structs) +`tsproto-structs` contains machine readable data for several TeamSpeak related topics. + +The underlying data files can be found in the +[tsdeclarations](https://github.com/ReSpeak/tsdeclarations) repository. + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/README.tpl b/native/vendor/tsclientlib/utils/tsproto-structs/README.tpl new file mode 100644 index 0000000..6268751 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/README.tpl @@ -0,0 +1,10 @@ +# tsproto-structs [![docs.rs](https://docs.rs/tsproto-structs/badge.svg)](https://docs.rs/tsproto-structs) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Badges.csv b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Badges.csv new file mode 100644 index 0000000..43afc83 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Badges.csv @@ -0,0 +1,83 @@ +uid,name,description,filename,codes +4b27be5a-b92a-4b30-8b2d-14b59653f427,20th Anniversary,Celebrating 20 Years of TeamSpeak,20_years, +f81ad44d-e931-47d1-a3ef-5fd160217cf8,4Netplayers,4Netplayers customer,4netplayers, +b78a0f3e-8758-4572-b102-42a79b4a0342,????,Reads between the line,hat, +2bf80270-8efe-46dc-a472-3280a0479145,Alpha Tester,Helped to test our software. THANK YOU!,Alpha, +05114019-6b46-4b13-b5a1-e5179ef69fb5,April Fools!,"Roses are red, gaming is fun, you are carrying too much to be able to run :(",rpg, +1a518885-520c-4f54-9f49-8b1acb674771,Braindance,I’m chippin’ in,Braindance,P4TEKZ80PZ +cbf5aafd-2554-4053-80bb-0cf82ec0a430,Bright Idea,TeamSpeak took my idea on board,FeatureBadge_Lightbulb, +d6062d9c-42a3-49c9-91dd-8c43a5a46805,Bug Catcher,I found a bug!,BugBadge_Splat, +dfc70674-0fd0-431e-b3a1-edc32d7b09b2,Challenge Accepted,"Unlocked at SCILL Play — Challenges, tournaments and more!",scill, +f85f7e21-753a-4566-b26a-4e3e9155d2ef,Cyberpunk,We have a city to burn,Cyberpunk, +c028298c-84ff-4e22-be4e-b8c17552b4bb,Digi,Digi joined your channel #DIGWIN,digi, +56df5ce2-6c5a-4a24-90e2-29e497e26170,Drone Champions League,I follow the Drone Champions League,DCL_Badge,DRONECHAMP +935e5a2a-954a-44ca-aa7a-55c79285b601,E3 2018 - Winner,Discovered at E3 2018,E3-2018, +61723e54-3da2-4f19-a33f-fcdc8ef5eaa0,Father's Day 2022,Not all heroes wear capes,fathersday2022, +b9c7d6ad-5b99-40fb-988c-1d02ab6cc130,Found Tim Speak,Found Tim Speak at Gamescom 2018,met_tim,XJN4WJZEJN +62444179-0d99-42ba-a45c-c6b1557d079a,Gamescom 2014,Registered at Gamescom 2014,gamescom_2014, +50bbdbc8-0f2a-46eb-9808-602225b49627,Gamescom 2016,Registered during Gamescom 2016,gamescom_2016, +534c9582-ab02-4267-aec6-2d94361daa2a,Gamescom 2017,Visited TeamSpeak at Gamescom 2017,gamescom_2017,DK9JGRJH1Q +4eef1ecf-a0ea-423d-bfd0-496543a00305,Gamescom 2018,Visited TeamSpeak at Gamescom 2018,gamescom_2018,8CXB49KPJ4 +b82a45a5-b235-4926-be77-de102222e5eb,Gamescom 2019,Visited TeamSpeak at Gamescom 2019,Gamescom19,PNKCB76VZ8 +34dbfa8f-bd27-494c-aa08-a312fc0bb240,Gamescom Hero 2017,Gaming Hero at Gamescom 2017,hero_2017, +24512806-f886-4440-b579-9e26e4219ef6,Gamescom Hero 2018,Gamescom Exclusive Gaming Hero 2018,gamescom_2018_played,BJCFQBU53C +d49fd07e-99fb-41de-8d7b-c98064713171,GommeHD.net,Your #1 Minecraft Network for over 10 years,GMHD, +c565972a-3912-457b-826f-84820c1ba6ca,Halloween 2021,Happy Halloween 2021,halloween21, +133595e7-950f-4ef2-b113-f91a68b5770d,Halloween 2021 Special,Earned by participating in our Halloween 2021 special stream,halloween21_special, +fb154277-5fe7-428a-85a4-43c0bdcdda3d,Halloween 2022,Spooky_Scary_Skeletons.mp4,halloween22, +e6679ce2-d458-493c-8ffb-5660e47ac99f,Happy Hanami,Enjoy the view,hanami2023, +de7bd960-eb02-47e1-9ce2-a44f6e255d8f,Happy Holidays 2019,Happy holidays from everyone at TeamSpeak!,Happy_Holidays, +d4ea0251-ba46-4c1a-83b7-59db3f89e52c,Happy New Year 2021,Survived the great toilet paper crisis of 2020,firework_2020, +1519e001-06a0-458c-9195-a8a6d0ec87fc,Happy New Year 2023,"Aw man, here we go again",2023_NewYear, +c68bcc52-7aeb-4868-b4d2-e7b20716f9ba,Heatwave 2022,I'm melting... help,summer_icecream, +94242c4e-6742-4540-8b66-ce951ed57159,Helping Hand,\ pushed some buttons *beep* *bop* ~ thanks!,homebase, +288a56c6-4da3-48de-9c9f-bd9eede5d832,Immortal Roleplay,This is your life.,Immortal_Roleplay, +69bfffc8-e9c0-4f70-8a37-47cb8c73fb1d,International Peace Day,"United we stand, divided we fall",peaceday2022, +9ea23c77-8755-4d82-b30c-92f4aac109ef,International Women's Day 2021,"To all the mums, sisters, aunties, nieces and beyond, Happy Women's Day!",wft, +7d9fa2b1-b6fa-47ad-9838-c239a4ddd116,MIFCOM,MIFCOM | Entered Performance,mifcom, +ed85bdff-2a2b-4bea-a1a5-4d06fcc0d776,Merry Christmas 2019,It’s the most wonderful ‘Tim’ of the Year,Christmas, +c6480fe2-ee25-4ee8-9853-243652c8ec54,Merry Christmas 2020,"Let it snow, let it snow, let it snow!",Christmas2020, +0581aa0f-8c2d-4681-bb9f-8492fec49977,Merry Christmas 2021,Look what Santa's left under the server tree!,christmas2021, +d4875b30-9908-43cb-a1eb-1a958e226078,Merry Christmas 2022,There's snow place like home,christmas2022, +87ccf9ea-67c9-45e5-adbc-77e210e6128a,Met Tim,Met Tim Speak IRL,tim_irl, +0d98391c-ecdf-4f26-931a-49bfd669cda7,Mind Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_MindEgg, +2fdda3c6-20e0-48f1-9c12-f39239a2ed02,Mother's Day 2022,Thanks for bearing with us,rose, +c3f823eb-5d5c-40f9-9dbd-3437d59a539d,Official TeamSpeak Gamer,New myTeamSpeak member,TS-2018, +8dfa37ac-b40d-4466-b393-ff2184a9adf3,Overwatch League,I follow the Overwatch League,OWL_Badge, +4ce435d1-6ac5-4530-b81d-6d14ddaaa1ac,PGL Antwerp 2022,Watched the PGL CS:GO Major,PGLant, +fa3ece28-64df-431f-b1b3-90844bfdd2d9,Paris Games Week 2014,Registered at Paris Games Week 2014,paris_gamesweek_2014, +d95f9901-c42d-4bac-8849-7164fd9e2310,Paris Games Week 2016,Registered during Paris Games Week 2016,paris_gamesweek_2016, +0005232e-538e-4cb2-93b6-d7d83e873829,PietSmiet,Werde Snob auf PietSmiet.de ;),PietSmiet, +be932556-dfa9-4dc6-afd0-98de0ab25777,PolTeamgeist,WooOOHoohOOHooo,PolTeamgeist, +5f6d49e4-35c8-4809-8c81-6e71f7f749e9,Power Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_PowerEgg, +ceee2445-4fbf-4f06-9421-286f0f4e875a,Pride,Never be afraid to show your colors.,pride, +1aa375e8-7207-45bf-8b80-556bafafc834,Reality Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_RealityEgg, +f22c22f1-8e2d-4d99-8de9-f352dc26ac5b,Rocket Beans TV,Rocket Beans TV Community,rbtv,RWGE2NURJZ +2c9698c1-1fec-4baa-a28f-4845f045f42f,Soul Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SoulEgg, +641a4d85-2351-482c-97a1-02fc3b6abbb5,Space Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SpaceEgg, +63261116-4359-4842-873e-56820afbe068,SpartaTheOriginal,Olaf Toast @ twitch.tv/SpartaTheOriginal,Toast, +ef567ec5-f46e-4520-be07-6021023cf6bd,Sponsorship License,Sponsored by TeamSpeak,Sponsorship, +7a627d47-5496-4d68-83b5-2c4eafff9b30,"Stay Home, Stay Safe","Playing Apart, Staying Connected",StaySafeStayHome, +7262a528-c7df-4369-bc2c-d34bf5853d7b,TS Chat Alpha Tester,"Helped us test our new mobile app, thanks!",slim_golden, +6eee759e-b1e9-4937-b023-07fc778532a2,TS Gameday Participant,At least i tried...,silvered, +e1447b99-53b0-448a-98b7-ee7bad8bd268,TS Gameday Winner,As shiny as the golden frying pan,goldenjoystick, +1cb07348-34a4-4741-b50f-c41e584370f7,TeamSpeak Addon Author,Creator of TeamSpeak Addons,addon_author, +450f81c1-ab41-4211-a338-222fa94ed157,TeamSpeak Addon Developer (Bronze),Creator of at least 1 TeamSpeak Addon,addon_author_bronze, +94ec66de-5940-4e38-b002-970df0cf6c94,TeamSpeak Addon Developer (Gold),Creator of at least 5 TeamSpeak Addons,addon_author_gold, +c9e97536-5a2d-4c8e-a135-af404587a472,TeamSpeak Addon Developer (Silver),Creator of at least 3 TeamSpeak Addons,addon_author_silver, +9cd152a7-bf65-4ece-aeba-62d27678f79a,TeamSpeak Competition Winner Badge,TeamSpeak Competition Winner,CompWinnerBadge, +64221fd1-706c-4bb2-ba55-996c39effa79,TeamSpeak Jedi,myTeamSpeak early adopter,TS-OG, +6b187e83-873b-46b0-b2c2-a31af15e76a4,TeamSpeak Merch Badge,TeamSpeak Merch Owner - 1st Edition,cap_red, +22b9ec39-7694-453e-864c-dfc7b1b0d7c7,TeamSpeak Merch Badge 2.0,TeamSpeak Merch Owner - 2nd Edition,topper, +205916f3-a953-4754-8905-bc15069b1f91,TeamSpeak Merch Badge 3.0,TeamSpeak Merch Owner — 3rd Edition,Merch3, +c2368518-3728-4260-bcd1-8b85e9f8984c,Test,"Testing, Testing.",Testing, +4086a249-a503-4f31-9e83-8a0a8e3089bd,Tim-o'-Lantern,Mwuhaahaahaahaahaa,Tim-O-Lantern,JQGCTAQWHT +089c7295-3aa2-48b0-b2f1-2dd1bec12caf,Time Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_TimeEgg, +904e232c-f369-44db-87f7-5142e15620cc,Time Machine,Worked like a machine to update addons in super-quick time.,time_machine, +4b0fd4f5-d456-4294-973d-853a1db5c7d8,Valentim's Day 2019,Valentim's Day 2019,Valentines_Badge, +92801833-e721-4b7e-84d4-6c02dbb332b9,Valentim's Day 2020,Valentim's Day 2020,Valentim2020, +958f904b-8260-48a4-a961-f786cbd39411,Valentine's Day 2023,Love you like my Tamagotchi,ValentinesDay23, +a676c708-da67-4784-ba7f-3fb7e8d2e865,Valentines Day 2021,"Roses are red, TS is blue, Servers are Sweet and so are you.",valentine21, +8c22fe26-30ac-4231-8b31-67d8a75c808a,Year of the Ox 2021,Only listen to the fortune cookie; disregard all other fortune telling units.,ox21, +970c70e6-00a1-41c1-ac5c-81c89a06c7a6,Year of the Rabbit 2023,Do a barrel roll!,chineseNY2023, +92356386-0451-4a97-87d9-10ff4f43260c,Year of the Tiger 2022,Rocky sends his regards,tiger, diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Book.toml b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Book.toml new file mode 100644 index 0000000..55ae61a --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Book.toml @@ -0,0 +1,327 @@ +[[struct]] +name = "ServerGroup" +id = [ + { struct="ServerGroup", prop="Id" }, +] +doc = "Get in notifyservergrouplist" +properties = [ + { name="Id", type="ServerGroupId" }, + { name="Name", type="str" }, + { name="GroupType", type="GroupType" }, + { name="Icon", type="IconId" }, + { name="IsPermanent", type="bool", doc="If the group is saved to the server database" }, + { name="SortId", type="i32" }, + { name="NamingMode", type="GroupNamingMode" }, + { name="NeededModifyPower", type="i32" }, + { name="NeededMemberAddPower", type="i32" }, + { name="NeededMemberRemovePower", type="i32", opt=true }, +] + +[[struct]] +name = "ChannelGroup" +id = [ + { struct="ChannelGroup", prop="Id" }, +] +doc = "Get in notifychannelgrouplist" +properties = [ + { name="Id", type="ChannelGroupId" }, + { name="Name", type="str" }, + { name="GroupType", type="GroupType" }, + { name="Icon", type="IconId" }, + { name="IsPermanent", type="bool", doc="If the group is saved to the server database" }, + { name="SortId", type="i32" }, + { name="NamingMode", type="GroupNamingMode" }, + { name="NeededModifyPower", type="i32" }, + { name="NeededMemberAddPower", type="i32" }, + { name="NeededMemberRemovePower", type="i32", opt=true }, +] + +[[struct]] +name = "OptionalChannelData" +opt = true +id = [ + { struct="Channel", prop="Id" }, +] +doc = "Get in notifychanneledited by channelgetdescription" +properties = [ + { name="Description", type="str" }, +] + +[[struct]] +name = "Channel" +id = [ + { struct="Channel", prop="Id" }, +] +doc = "Get in channellist" +properties = [ + { name="Id", type="ChannelId" }, + { name="Guid", type="str", opt=true }, + { name="Parent", type="ChannelId", doc="0 means root channel" }, + { name="Name", type="str" }, + { name="Topic", type="str", opt=true }, + { name="Codec", type="Codec" }, + { name="CodecQuality", type="u8", opt=true }, + { name="MaxClients", type="MaxClients", opt=true, doc="The maximum number of clients in the channel." }, + { name="MaxFamilyClients", type="MaxClients", opt=true, doc="Maximum number of clients in this and all child channels." }, + { name="Order", type="ChannelId", doc="The preceding channel id." }, + { name="ChannelType", type="ChannelType" }, + { name="IsDefault", type="bool", opt=true, doc="Whether it is the default channel" }, + { name="HasPassword", type="bool", opt=true, doc="Whether this channel has a password" }, + { name="CodecLatencyFactor", type="i32", opt=true, doc="TODO Type?" }, + { name="IsUnencrypted", type="bool", opt=true }, + { name="DeleteDelay", type="Duration", opt=true }, + { name="NeededTalkPower", type="i32", opt=true }, + { name="ForcedSilence", type="bool" }, + { name="PhoneticName", type="str", opt=true }, + { name="Icon", type="IconId", opt=true }, + { name="IsPrivate", type="bool", opt=true }, + { name="StorageQuota", type="u32", opt=true }, + { name="Subscribed", type="bool" }, + { name="PermissionHints", type="ChannelPermissionHint", opt=true }, + { name="OptionalData", type="OptionalChannelData", opt=true }, +] + +[[struct]] +name = "OptionalClientData" +opt = true +id = [ + { struct="Client", prop="Id" }, +] +doc = "Get in notifyclientupdated by clientgetvariables" +properties = [ + { name="Version", type="str" }, + { name="VersionSign", type="str", opt=true }, + { name="Platform", type="str" }, + { name="LoginName", type="str", opt=true, doc="Set only for server queries" }, + { name="Created", type="DateTime" }, + { name="LastConnected", type="DateTime" }, + { name="ConnectionsTotal", type="u32" }, + { name="BytesUploadedMonth", type="u64" }, + { name="BytesDownloadedMonth", type="u64" }, + { name="BytesUploadedTotal", type="u64" }, + { name="BytesDownloadedTotal", type="u64" }, +] + +[[struct]] +name = "ConnectionClientData" +opt = true +id = [ + { struct="Client", prop="Id" }, +] +doc = "Get in notifyconnectioninfo by getconnectioninfo" +properties = [ + { name="Ping", type="Duration", opt=true }, + { name="PingDeviation", type="Duration", opt=true }, + { name="ConnectedTime", type="Duration", opt=true }, + { name="ClientAddress", type="SocketAddr", opt=true, doc="Only available if we have the permission to view it" }, + { name="PacketsSentSpeech", type="u64", opt=true }, + { name="PacketsSentKeepalive", type="u64", opt=true }, + { name="PacketsSentControl", type="u64", opt=true }, + { name="BytesSentSpeech", type="u64", opt=true }, + { name="BytesSentKeepalive", type="u64", opt=true }, + { name="BytesSentControl", type="u64", opt=true }, + { name="PacketsReceivedSpeech", type="u64", opt=true }, + { name="PacketsReceivedKeepalive", type="u64", opt=true }, + { name="PacketsReceivedControl", type="u64", opt=true }, + { name="BytesReceivedSpeech", type="u64", opt=true }, + { name="BytesReceivedKeepalive", type="u64", opt=true }, + { name="BytesReceivedControl", type="u64", opt=true }, + { name="ServerToClientPacketlossSpeech", type="f32", opt=true }, + { name="ServerToClientPacketlossKeepalive", type="f32", opt=true }, + { name="ServerToClientPacketlossControl", type="f32", opt=true }, + { name="ServerToClientPacketlossTotal", type="f32", opt=true }, + { name="ClientToServerPacketlossSpeech", type="f32" }, + { name="ClientToServerPacketlossKeepalive", type="f32" }, + { name="ClientToServerPacketlossControl", type="f32" }, + { name="ClientToServerPacketlossTotal", type="f32" }, + { name="BandwidthSentLastSecondSpeech", type="u64", opt=true }, + { name="BandwidthSentLastSecondKeepalive", type="u64", opt=true }, + { name="BandwidthSentLastSecondControl", type="u64", opt=true }, + { name="BandwidthSentLastMinuteSpeech", type="u64", opt=true }, + { name="BandwidthSentLastMinuteKeepalive", type="u64", opt=true }, + { name="BandwidthSentLastMinuteControl", type="u64", opt=true }, + { name="BandwidthReceivedLastSecondSpeech", type="u64", opt=true }, + { name="BandwidthReceivedLastSecondKeepalive", type="u64", opt=true }, + { name="BandwidthReceivedLastSecondControl", type="u64", opt=true }, + { name="BandwidthReceivedLastMinuteSpeech", type="u64", opt=true }, + { name="BandwidthReceivedLastMinuteKeepalive", type="u64", opt=true }, + { name="BandwidthReceivedLastMinuteControl", type="u64", opt=true }, + { name="FiletransferBandwidthSent", type="u64", opt=true }, + { name="FiletransferBandwidthReceived", type="u64", opt=true }, + { name="IdleTime", type="Duration" }, +] + +[[struct]] +name = "Client" +id = [ + { struct="Client", prop="Id" }, +] +doc = "Get in notifycliententerview" +properties = [ + { name="Id", type="ClientId" }, + { name="Channel", type="ChannelId" }, + { name="Uid", type="Uid", opt=true, doc="Unique Identifier" }, + { name="Name", type="str" }, + { name="InputMuted", type="bool", doc="`true` if muted, `false` otherwise" }, + { name="OutputMuted", type="bool", doc="`true` if muted, `false` otherwise" }, + { name="OutputOnlyMuted", type="bool", doc="`true` if muted, `false` otherwise" }, + { name="InputHardwareEnabled", type="bool", doc="`true` if enabled, `false` if disabled" }, + { name="OutputHardwareEnabled", type="bool", doc="`true` if enabled, `false` if disabled" }, + { name="TalkPowerGranted", type="bool", doc="If the client is granted talk power" }, + { name="Metadata", type="str", doc="Set by client" }, + { name="IsRecording", type="bool", doc="Whether the client is recording" }, + { name="DatabaseId", type="ClientDbId" }, + { name="ChannelGroup", type="ChannelGroupId" }, + { name="ServerGroups", type="ServerGroupId", mod="set" }, + { name="AwayMessage", type="str", opt=true, doc="Contains the away message if the client is away" }, + { name="ClientType", type="ClientType", doc="If this client is a server query or not" }, + { name="AvatarHash", type="str", doc="MD5 hash of the avatar, used to retrieve the avatar" }, + { name="TalkPower", type="i32" }, + { name="TalkPowerRequest", type="TalkPowerRequest", opt=true, doc="Contains a message and timestamp from the client if he requests talk power" }, + { name="Description", type="str" }, + { name="IsPrioritySpeaker", type="bool" }, + { name="UnreadMessages", type="u32" }, + { name="PhoneticName", type="str" }, + { name="NeededServerqueryViewPower", type="i32" }, + { name="Icon", type="IconId" }, + { name="IsChannelCommander", type="bool" }, + { name="CountryCode", type="str", doc="Like US, DE" }, + { name="InheritedChannelGroupFromChannel", type="ChannelId" }, + { name="Badges", type="str" }, + { name="UserTag", type="str", opt=true }, + { name="PermissionHints", type="ClientPermissionHint", opt=true }, + { name="OptionalData", type="OptionalClientData", opt=true }, + { name="ConnectionData", type="ConnectionClientData", opt=true }, +] + +[[struct]] +name = "OptionalServerData" +opt = true +id = [ +] +doc = "Get by notifyserverupdated after requested by servergetvariables" +properties = [ + { name="Uptime", type="Duration" }, + { name="HasPassword", type="bool" }, + { name="DefaultChannelAdminGroup", type="ChannelGroupId", doc="The channel group which will be given to channel creators" }, + { name="MaxDownloadBandwidthTotal", type="u64" }, + { name="MaxUploadBandwidthTotal", type="u64" }, + { name="ComplainAutobanCount", type="u32" }, + { name="ComplainAutobanTime", type="Duration" }, + { name="ComplainRemoveTime", type="Duration" }, + { name="MinClientsInChannelBeforeForcedSilence", type="u32", doc="How many clients can be in a server before silence is forced" }, + { name="AntifloodPointsTickReduce", type="u32" }, + { name="AntifloodPointsToCommandBlock", type="u32" }, + { name="AntifloodPointsToIpBlock", type="u32" }, + { name="AntifloodPointsToPluginBlock", type="u32" }, + { name="ConnectionCountTotal", type="u64", doc="The amount of connections on this server.\n\nThis includes normal clients and server queries." }, + { name="ChannelCount", type="u64", doc="The amount of channels on the server" }, + { name="ClientCount", type="u16", doc="The amount of clients which are online on the server" }, + { name="QueryCountTotal", type="u64", doc="Amount of server queries connected to the server" }, + { name="QueryCount", type="u32", doc="Amount of server queries connected and online/visible on the server" }, + { name="DownloadQuota", type="u64" }, + { name="UploadQuota", type="u64" }, + { name="BytesDownloadedMonth", type="u64" }, + { name="BytesUploadedMonth", type="u64" }, + { name="BytesDownloadedTotal", type="u64" }, + { name="BytesUploadedTotal", type="u64" }, + { name="Port", type="u16" }, + { name="Autostart", type="bool" }, + { name="MachineId", type="str" }, + { name="NeededIdentitySecurityLevel", type="u8" }, + { name="LogClient", type="bool" }, + { name="LogQuery", type="bool" }, + { name="LogChannel", type="bool" }, + { name="LogPermissions", type="bool" }, + { name="LogServer", type="bool" }, + { name="LogFiletransfer", type="bool" }, + { name="MinClientVersion", type="DateTime" }, + { name="ReservedSlots", type="u16" }, + { name="TotalPacketlossSpeech", type="f32" }, + { name="TotalPacketlossKeepalive", type="f32" }, + { name="TotalPacketlossControl", type="f32" }, + { name="TotalPacketloss", type="f32" }, + { name="TotalPing", type="Duration" }, + { name="WeblistEnabled", type="bool" }, + { name="MinAndroidVersion", type="DateTime", doc="TODO Maybe str" }, + { name="MinIosVersion", type="DateTime" }, +] + +[[struct]] +name = "ConnectionServerData" +opt = true +id = [ +] +doc = "Get by notifyserverconnectioninfo after serverrequestconnectioninfo" +properties = [ + { name="FiletransferBandwidthSent", type="u64" }, + { name="FiletransferBandwidthReceived", type="u64" }, + { name="FiletransferBytesSentTotal", type="u64" }, + { name="FiletransferBytesReceivedTotal", type="u64" }, + { name="PacketsSentTotal", type="u64" }, + { name="BytesSentTotal", type="u64" }, + { name="PacketsReceivedTotal", type="u64" }, + { name="BytesReceivedTotal", type="u64" }, + { name="BandwidthSentLastSecondTotal", type="u64" }, + { name="BandwidthSentLastMinuteTotal", type="u64" }, + { name="BandwidthReceivedLastSecondTotal", type="u64" }, + { name="BandwidthReceivedLastMinuteTotal", type="u64" }, + { name="ConnectedTimeTotal", type="Duration" }, + { name="PacketlossTotal", type="f32" }, + { name="Ping", type="Duration" }, +] + +[[struct]] +name = "Server" +id = [ +] +doc = "Get in initserver" +properties = [ + { name="PublicKey", type="EccKeyPubP256" }, + { name="Id", type="u64", doc="The virtual server id" }, + # `Uid` is generated from public key + { name="Name", type="str" }, + { name="Nickname", type="str", opt=true }, + { name="WelcomeMessage", type="str", doc="Welcome message when connecting to a server" }, + { name="Platform", type="str" }, + { name="Version", type="str" }, + { name="MaxClients", type="u16", doc="The maximum number of clients on the server" }, + { name="Created", type="DateTime", doc="Seems to be always 0" }, + { name="CodecEncryptionMode", type="CodecEncryptionMode" }, + { name="Hostmessage", type="str" }, + { name="HostmessageMode", type="HostMessageMode" }, + { name="DefaultServerGroup", type="ServerGroupId" }, + { name="DefaultChannelGroup", type="ChannelGroupId" }, + { name="HostbannerUrl", type="str" }, + { name="HostbannerGfxUrl", type="str" }, + { name="HostbannerGfxInterval", type="Duration", doc="How often the hostbanner should be updated" }, + { name="PrioritySpeakerDimmModificator", type="f32" }, + { name="HostbuttonTooltip", type="str" }, + { name="HostbuttonUrl", type="str" }, + { name="HostbuttonGfxUrl", type="str" }, + { name="PhoneticName", type="str" }, + { name="Icon", type="IconId", doc="Should be an u32, sometimes the server sends an u64 or an i32 for reasons which has to be cut to 32 bit" }, + { name="Ips", type="IpAddr", mod="array", doc="A list of listen ips, can be empty" }, + { name="AskForPrivilegekey", type="bool" }, + { name="HostbannerMode", type="HostBannerMode" }, + { name="TempChannelDefaultDeleteDelay", type="Duration" }, + { name="ProtocolVersion", type="u16" }, + { name="License", type="LicenseType" }, + { name="AdministrativeDomain", type="str", opt=true }, + { name="OptionalData", type="OptionalServerData", opt=true }, + { name="ConnectionData", type="ConnectionServerData", opt=true }, +] + +[[struct]] +name = "Connection" +id = [ +] +doc = "A connection from our client to a server" +properties = [ + { name="OwnClient", type="ClientId", doc="The id of our own client on the server" }, + { name="Server", type="Server", doc="The server of this connection" }, + { name="Clients", type="Client", mod="map", key="ClientId", doc="All clients which are visible for us" }, + { name="Channels", type="Channel", mod="map", key="ChannelId", doc="All channels on the server" }, + { name="ServerGroups", type="ServerGroup", mod="map", key="ServerGroupId", doc="All server groups on the server" }, + { name="ChannelGroups", type="ChannelGroup", mod="map", key="ChannelGroupId", doc="All channel groups on the server" }, +] diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/BookToMessages.toml b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/BookToMessages.toml new file mode 100644 index 0000000..21daaff --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/BookToMessages.toml @@ -0,0 +1,393 @@ +# As in M2B from/to properties can be automatically mapped when they have +# the same high-level name. + +[[rule]] +# From the Book +from = "Channel" +# Into message +to = "ChannelEdit" +operation = "update" +# The static message parameters +# Can be often empty +# Can be inferred from required message parameters +ids = [ + { from="Id", to="ChannelId" }, +] +# The dynamic message parameters +# from is the property which gets updated, to is the field in the message +properties = [ + # Function which reads a value form the book and splits it up + # into multiple message parameters + # fn bla(Channel, MaxClientChannelInherited) -> (type of asd) + #{ from="MaxClientChannelInherited", function="Bla", tolist=["asd"] }, + + { from="password", type="str?", function="PasswordFlaggedB2m", tolist=["HasPassword", "Password"] }, # 'password' is a helper + { from="ChannelType", type="ChannelType", function="ChannelTypeFunB2m", tolist=["IsSemiPermanent", "IsPermanent"] }, + { from="MaxClients", type="MaxClients", function="MaxClientsFunB2m", tolist=["MaxClients", "IsMaxClientsUnlimited"] }, + { from="MaxFamilyClients", type="MaxClients", function="MaxFamilyClientsFunB2m", tolist=["MaxFamilyClients", "IsMaxFamilyClientsUnlimited", "InheritsMaxFamilyClients"] }, + { from="Description", to="Description" }, # From optional data +] + +[[rule]] +from = "Channel" +to = "ChannelAddPerm" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Value", to="PermissionValue" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +# Define Client-Channel-Permissions on the channel, because a channel always exists and we need to +# be able to change permissions, even if a client is not online. +[[rule]] +from = "Channel" +to = "ChannelClientAddPerm" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="ClientDbId", to="ClientDbId" }, + { from="Value", to="PermissionValue" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +[[rule]] +from = "Channel" +to = "ChannelClientDelPerm" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="ClientDbId", to="ClientDbId" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +[[rule]] +from = "Channel" +to = "ChannelClientPermListRequest" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="ClientDbId", to="ClientDbId" }, +] + +[[rule]] +from = "Channel" +to = "ChannelDelPerm" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +[[rule]] +from = "Channel" +to = "ChannelDescriptionRequest" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, +] + +[[rule]] +from = "Channel" +to = "ChannelMove" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Parent", type="ChannelId", function="ChannelIdB2m", tolist=["ParentId"] }, + { from="Order", type="ChannelId", function="ChannelIdB2m", tolist=["Order"] }, +] + +[[rule]] +from = "Channel" +to = "ChannelPermListRequest" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, +] + +# Filetransfer stuff for Channel + +[[rule]] +from = "Channel" +to = "CreateDirectory" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Password", type="str", function="PasswordB2m", tolist=["ChannelPassword"] }, + { from="Path", to="DirectoryName" }, +] + +[[rule]] +from = "Channel" +to = "DeleteFile" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Password", type="str", function="PasswordB2m", tolist=["ChannelPassword"] }, + { from="Path", to="Name" }, +] + +[[rule]] +from = "Channel" +to = "FileListRequest" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Password", type="str", function="PasswordB2m", tolist=["ChannelPassword"] }, + { from="Path", to="Path" }, +] + +[[rule]] +from = "Channel" +to = "RenameFile" +operation = "update" +ids = [ + { from="Id", to="ChannelId" }, + { from="Password", type="str", function="PasswordB2m", tolist=["ChannelPassword"] }, + { from="FromPath", to="OldName" }, + { from="ToPath", to="NewName" }, +] +properties = [ + { from="ToChannel", to="TargetChannelId" }, + { from="ToChannelPassword", type="str", function="PasswordB2m2", tolist=["TargetChannelPassword"] }, +] + + +[[rule]] +from = "Client" +to = "ClientAddPerm" +operation = "update" +ids = [ + { from="DatabaseId", to="ClientDbId" }, + { from="Value", to="PermissionValue" }, + { from="Skip", to="PermissionSkip" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +[[rule]] +from = "Client" +to = "ClientConnectionInfoRequest" +operation = "update" +ids = [ + { from="Id", to="ClientId" }, +] + +[[rule]] +from = "Client" +to = "ClientDelPerm" +operation = "update" +ids = [ + { from="DatabaseId", to="ClientDbId" }, +] +properties = [ + { from="PermissionId", to ="PermissionId" }, + { from="PermissionName", to ="PermissionNameId" }, +] + +[[rule]] +from = "Client" +to = "ClientPermListRequest" +operation = "update" +ids = [ + { from="DatabaseId", to="ClientDbId" }, +] + +[[rule]] +from = "Client" +to = "ClientVariablesRequest" +operation = "update" +ids = [ + { from="Id", to="ClientId" }, +] + +[[rule]] +from = "Client" +to = "ClientEdit" +operation = "update" +ids = [ + { from="Id", to="ClientId" }, +] + +[[rule]] +from = "Connection" +to = "ClientUpdate" +operation = "update" +properties = [ + # The original properties are on the client object, but we can only change + # our own properties, so these methods are available on the connection. + { from="Name", to="Name" }, + { from="PhoneticName", to="PhoneticName" }, + { from="InputMuted", to="InputMuted" }, + { from="OutputMuted", to="OutputMuted" }, + { from="InputHardwareEnabled", to="InputHardwareEnabled" }, + { from="OutputHardwareEnabled", to="OutputHardwareEnabled" }, + { from="IsChannelCommander", to="IsChannelCommander" }, + { from="IsRecording", to="IsRecording" }, + { from="AvatarHash", to="AvatarHash" }, + { from="Away", type="str?", function="AwayFunB2m", tolist=["IsAway", "AwayMessage"] }, + { from="TalkPowerRequest", type="str?", function="AwayFunB2m", tolist=["TalkPowerRequest", "TalkPowerRequestMessage"] }, +] + +[[rule]] +from = "Connection" +to = "Disconnect" +operation = "remove" + +[[rule]] +from = "Connection" +to = "PluginCommandRequest" +operation = "update" +ids = [ + { from="Name", to="Name" }, + { from="Data", to="Data" }, + { from="Target", to="Target" }, + # TODO optional + { from="TargetClientId", to="TargetClientId" }, +] + +[[rule]] +from = "Client" +to = "ServerGroupAddClient" +operation = "add" +ids = [ + { from="DatabaseId", to="ClientDbId" }, +] +properties = [ + { from="ServerGroup", to="ServerGroupId" }, +] + +[[rule]] +from = "Client" +to = "ServerGroupDelClient" +operation = "remove" +ids = [ + { from="DatabaseId", to="ClientDbId" }, +] +properties = [ + { from="ServerGroup", to="ServerGroupId" }, +] + +[[rule]] +from = "Client" +to = "ClientMove" +operation = "update" +ids = [ + { from="Id", to="ClientId" }, + { from="Channel", type="ChannelId", function="ChannelIdB2m", tolist=["ChannelId"] }, +] +properties = [ + { from="Password", type="str", function="PasswordB2m", tolist=["ChannelPassword"] }, +] + +[[rule]] +from = "Client" +to = "ClientKick" +operation = "update" +ids = [ + { from="Id", to="ClientId" }, + { from="Reason", to="Reason" }, +] +properties = [ + { from="ReasonMessage", to="ReasonMessage" }, +] + +[[rule]] +from = "Server" +to = "FileListRequest" +operation = "update" +ids = [ + { function="ZeroChannelId", tolist=["ChannelId"] }, + { function="EmptyString", tolist=["ChannelPassword"] }, + { from="Path", to="Path" }, +] + +[[rule]] +from = "Server" +to = "DeleteFile" +operation = "update" +ids = [ + { function="ZeroChannelId", tolist=["ChannelId"] }, + { function="EmptyString", tolist=["ChannelPassword"] }, + { from="Path", to="Name" }, +] + +[[rule]] +from = "Server" +to = "PermListRequest" +operation = "update" +ids = [ +] + +[[rule]] +from = "Server" +to = "ServerVariablesRequest" +operation = "update" +ids = [ +] + +[[rule]] +from = "Server" +to = "ServerConnectionInfoRequest" +operation = "update" +ids = [ +] + +[[rule]] +from = "Server" +to = "LogView" +operation = "update" +ids = [ +] +properties = [ + { from="Lines", to="Lines" }, + { from="Reverse", to="Reverse" }, + { from="InstanceLog", to="InstanceLog" }, + { from="Offset", to="Offset" }, +] + +[[rule]] +from = "Server" +to = "ServerEdit" +operation = "update" +ids = [ +] +properties = [ + { from="Password", type="str?", function="PasswordB2m", tolist=["Password"] }, +] + +[[rule]] +from = "ServerGroup" +to = "ServerGroupAddClient" +operation = "add" +ids = [ + { from="Id", to="ServerGroupId" }, +] +properties = [ + { from="Client", to="ClientDbId" }, +] + +[[rule]] +from = "ServerGroup" +to = "ServerGroupDelClient" +operation = "remove" +ids = [ + { from="Id", to="ServerGroupId" }, + # Not an id attribute of the server group, but we want to have it as an + # argument. + { from="Client", to="ClientDbId" }, +] diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Enums.toml b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Enums.toml new file mode 100644 index 0000000..161dd3f --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Enums.toml @@ -0,0 +1,172 @@ +[[enum]] +name = "PermissionType" +#type = "u32" +#doc = "" +variants = [ + { name="ServerGroup", doc="Server group permission. (id1: ServerGroupId, id2: 0)" }, + { name="GlobalClient", doc="Client specific permission. (id1: ClientDbId, id2: 0)" }, + { name="Channel", doc="Channel specific permission. (id1: ChannelId, id2: 0)" }, + { name="ChannelGroup", doc="Channel group permission. (id1: ChannelId, id2: ChannelGroupId)" }, + { name="ChannelClient", doc="Channel-client specific permission. (id1: ChannelId, id2: ClientDbId)" }, +] + +[[enum]] +name = "TextMessageTargetMode" +variants = [ + { name="Unknown", doc="Maybe to all servers?" }, + { name="Client", doc="Send to specific client" }, + { name="Channel", doc="Send to current channel" }, + { name="Server", doc="Send to server chat" }, +] + +[[enum]] +name = "HostMessageMode" +variants = [ + { name="None", doc="Dont display anything" }, + { name="Log", doc="Display message inside log" }, + { name="Modal", doc="Display message inside a modal dialog" }, + { name="Modalquit", doc="Display message inside a modal dialog and quit/close server/connection" }, +] + +[[enum]] +name = "HostBannerMode" +variants = [ + { name="NoAdjust", doc="Do not adjust" }, + { name="AdjustIgnoreAspect", doc="Adjust and ignore aspect ratio" }, + { name="AdjustKeepAspect", doc="Adjust and keep aspect ratio" }, +] + +[[enum]] +name = "Codec" +variants = [ + { name="SpeexNarrowband", doc="Mono, 16bit, 8kHz, bitrate dependent on the quality setting" }, + { name="SpeexWideband", doc="Mono, 16bit, 16kHz, bitrate dependent on the quality setting" }, + { name="SpeexUltrawideband", doc="Mono, 16bit, 32kHz, bitrate dependent on the quality setting" }, + { name="CeltMono", doc="Mono, 16bit, 48kHz, bitrate dependent on the quality setting" }, + { name="OpusVoice", doc="Mono, 16bit, 48kHz, bitrate dependent on the quality setting, optimized for voice" }, + { name="OpusMusic", doc="Stereo, 16bit, 48kHz, bitrate dependent on the quality setting, optimized for music" }, +] + +[[enum]] +name = "CodecEncryptionMode" +variants = [ + { name="PerChannel", doc="Voice encryption is configured per channel" }, + { name="ForcedOff", doc="Voice encryption is globally off" }, + { name="ForcedOn", doc="Voice encryption is globally on" }, +] + +[[enum]] +name = "Reason" +variants = [ + { name="None", doc="No reason data" }, + { name="Moved", doc="Has invoker" }, + { name="Subscription", doc="No reason data" }, + { name="LostConnection", doc="Timeout" }, + { name="KickChannel", doc="Has invoker" }, + { name="KickServer", doc="Has invoker" }, + { name="KickServerBan", doc="Has invoker, bantime" }, + { name="Serverstop", doc="" }, + { name="Clientdisconnect", doc="" }, + { name="Channelupdate", doc="No reason data" }, + { name="Channeledit", doc="Has invoker" }, + { name="ClientdisconnectServerShutdown", doc="" }, +] + +[[enum]] +name = "GroupNamingMode" +variants = [ + { name="None", doc="No group name is displayed." }, + { name="Before", doc="Group name is displayed before the client name." }, + { name="After", doc="Group name is displayed after the client name." }, +] + +[[enum]] +name = "GroupType" +variants = [ + { name="Template", doc="Template group (used for new virtual servers)." }, + { name="Regular", doc="Regular group (used for regular clients)." }, + { name="Query", doc="Global query group (used for server query clients)." }, +] + +[[enum]] +name = "LicenseType" +variants = [ + { name="NoLicense", doc="No licence" }, + { name="Offline", doc="Offline/LAN license" }, + { name="Sdk", doc="TeamSpeak SDK license" }, + { name="SdkOffline", doc="TeamSpeak SDK offline license" }, + { name="Npl", doc="Non-Profit License (NPL)" }, + { name="Athp", doc="Authorised TeamSpeak Host Provider License (ATHP)" }, + { name="Aal", doc="Annual activation license (AAL)" }, + { name="Default", doc="Default license with 32 slots" }, + { name="Gamer", doc="Gamer license" }, + { name="Sponsorship", doc="Licenses sponsored by TeamSpeak" }, + { name="Commercial", doc="For use inside corporates" }, +] + +[[enum]] +name = "ChannelType" +variants = [ + { name="Permanent", doc="Normal channel" }, + { name="SemiPermanent", doc="Deleted when the server restarts" }, + { name="Temporary", doc="Deleted when empty" }, +] + +[[enum]] +name = "TokenType" +variants = [ + { name="ServerGroup", doc="Server group token (`id1={groupId}, id2=0`)" }, + { name="ChannelGroup", doc="Channel group token (`id1={groupId}, id2={channelId}`)" }, +] + +[[enum]] +name = "PluginTargetMode" +variants = [ + { name="CurrentChannel", doc="Send to all clients in the current channel." }, + { name="Server", doc="Send to all clients on the server." }, + { name="Client", doc="Send to all given clients ids." }, + { name="CurrentChannelSubsribedClients", doc="Send to all given clients which are subscribed to the current channel (i.e. which see the this client)." }, +] + +[[enum]] +name = "LogLevel" +variants = [ + { name="Error", doc="Everything that is really bad.", value=1 }, + { name="Warning", doc="Everything that might be bad." }, + { name="Debug", doc="Output that might help find a problem." }, + { name="Info", doc="Informational output." }, +] + +[[bitflag]] +name = "ChannelPermissionHint" +doc = "Hints if the client has the permission to make specific actions." +variants = [ + { name="Join", doc="b_channel_join_*", value=1 }, + { name="Modify", doc="i_channel_modify_power", value=2 }, + { name="ForceDelete", doc="b_channel_delete_flag_force", value=4 }, + { name="Delete", doc="b_channel_delete_*", value=8 }, + { name="Subscribe", doc="i_channel_subscribe_power", value=16 }, + { name="ViewDescription", doc="i_channel_description_view_power", value=32 }, + { name="FileUpload", doc="i_ft_file_upload_power", value=64 }, + { name="FileDownload", doc="i_ft_needed_file_download_power", value=128 }, + { name="FileDelete", doc="i_ft_file_delete_power", value=256 }, + { name="FileRename", doc="i_ft_file_rename_power", value=512 }, + { name="FileBrowse", doc="i_ft_file_browse_power", value=1024 }, + { name="FileDirectoryCreate", doc="i_ft_directory_create_power", value=2048 }, + { name="ModifyPermissions", doc="i_channel_permission_modify_power", value=4096 }, +] + +[[bitflag]] +name = "ClientPermissionHint" +doc = "Hints if the client has the permission to make specific actions." +variants = [ + { name="KickServer", doc="i_client_kick_from_server_power", value=1 }, + { name="KickChannel", doc="i_client_kick_from_channel_power", value=2 }, + { name="Ban", doc="i_client_ban_power", value=4 }, + { name="MoveClient", doc="i_client_move_power", value=8 }, + { name="PrivateMessage", doc="i_client_private_textmessage_power", value=16 }, + { name="Poke", doc="i_client_poke_power", value=32 }, + { name="Whisper", doc="i_client_whisper_power", value=64 }, + { name="Complain", doc="i_client_complain_power", value=128 }, + { name="ModifyPermissions", doc="i_client_permission_modify_power", value=256 }, +] diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Errors.csv b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Errors.csv new file mode 100644 index 0000000..c974ed2 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Errors.csv @@ -0,0 +1,197 @@ +name,doc,num +ok,unknown error code,0x0000 +undefined,undefined error,0x0001 +not_implemented,not implemented,0x0002 +ok_no_update,,0x0003 +dont_notify,,0x0004 +lib_time_limit_reached,library time limit reached,0x0005 +command_not_found,command not found,0x0100 +unable_to_bind_network_port,unable to bind network port,0x0101 +no_network_port_available,no network port available,0x0102 +client_invalid_id,invalid clientID,0x0200 +client_nickname_inuse,nickname is already in use,0x0201 +client_invalid_error_code,invalid error code,0x0202 +client_protocol_limit_reached,max clients protocol limit reached,0x0203 +client_invalid_type,invalid client type,0x0204 +client_already_subscribed,already subscribed,0x0205 +client_not_logged_in,not logged in,0x0206 +client_could_not_validate_identity,could not validate client identity,0x0207 +client_invalid_password,invalid loginname or password,0x0208 +client_too_many_clones_connected,too many clones already connected,0x0209 +client_version_outdated,"client version outdated, please update",0x020a +client_is_online,client is online,0x020b +client_is_flooding,client is flooding,0x020c +client_hacked,client is modified,0x020d +client_cannot_verify_now,can not verify client at this moment,0x020e +client_login_not_permitted,client is not permitted to log in,0x020f +client_not_subscribed,client is not subscribed to the channel,0x0210 +channel_invalid_id,invalid channelID,0x0300 +channel_protocol_limit_reached,max channels protocol limit reached,0x0301 +channel_already_in,already member of channel,0x0302 +channel_name_inuse,channel name is already in use,0x0303 +channel_not_empty,channel not empty,0x0304 +channel_can_not_delete_default,can not delete default channel,0x0305 +channel_default_require_permanent,default channel requires permanent,0x0306 +channel_invalid_flags,invalid channel flags,0x0307 +channel_parent_not_permanent,permanent channel can not be child of non permanent channel,0x0308 +channel_maxclients_reached,channel maxclient reached,0x0309 +channel_maxfamily_reached,channel maxfamily reached,0x030a +channel_invalid_order,invalid channel order,0x030b +channel_no_filetransfer_supported,channel does not support filetransfers,0x030c +channel_invalid_password,invalid channel password,0x030d +channel_is_private_channel,channel is private channel,0x030e +channel_invalid_security_hash,invalid security hash supplied by client,0x030f +server_invalid_id,invalid serverID,0x0400 +server_running,server is running,0x0401 +server_is_shutting_down,server is shutting down,0x0402 +server_maxclients_reached,server maxclient reached,0x0403 +server_invalid_password,invalid server password,0x0404 +server_deployment_active,deployment active,0x0405 +server_unable_to_stop_own_server,unable to stop own server in your connection class,0x0406 +server_is_virtual,server is virtual,0x0407 +server_wrong_machineid,server wrong machineID,0x0408 +server_is_not_running,server is not running,0x0409 +server_is_booting,server is booting up,0x040a +server_status_invalid,server got an invalid status for this operation,0x040b +server_modal_quit,server modal quit,0x040c +server_version_outdated,server version is too old for command,0x040d +database,database error,0x0500 +database_empty_result,database empty result set,0x0501 +database_duplicate_entry,database duplicate entry,0x0502 +database_no_modifications,database no modifications,0x0503 +database_constraint,database invalid constraint,0x0504 +database_reinvoke,database reinvoke command,0x0505 +parameter_quote,invalid quote,0x0600 +parameter_invalid_count,invalid parameter count,0x0601 +parameter_invalid,invalid parameter,0x0602 +parameter_not_found,parameter not found,0x0603 +parameter_convert,convert error,0x0604 +parameter_invalid_size,invalid parameter size,0x0605 +parameter_missing,missing required parameter,0x0606 +parameter_checksum,invalid checksum,0x0607 +vs_critical,virtual server got a critical error,0x0700 +connection_lost,Connection lost,0x0701 +not_connected,not connected,0x0702 +no_cached_connection_info,no cached connection info,0x0703 +currently_not_possible,currently not possible,0x0704 +failed_connection_initialisation,failed connection initialization,0x0705 +could_not_resolve_hostname,could not resolve hostname,0x0706 +invalid_server_connection_handler_id,invalid server connection handler ID,0x0707 +could_not_initialise_input_manager,could not initialize Input Manager,0x0708 +clientlibrary_not_initialised,client library not initialized,0x0709 +serverlibrary_not_initialised,server library not initialized,0x070a +whisper_too_many_targets,too many whisper targets,0x070b +whisper_no_targets,no whisper targets found,0x070c +file_invalid_name,invalid file name,0x0800 +file_invalid_permissions,invalid file permissions,0x0801 +file_already_exists,file already exists,0x0802 +file_not_found,file not found,0x0803 +file_io_error,file input/output error,0x0804 +file_invalid_transfer_id,invalid file transfer ID,0x0805 +file_invalid_path,invalid file path,0x0806 +file_no_files_available,no files available,0x0807 +file_overwrite_excludes_resume,overwrite excludes resume,0x0808 +file_invalid_size,invalid file size,0x0809 +file_already_in_use,file already in use,0x080a +file_could_not_open_connection,could not open file transfer connection,0x080b +file_no_space_left_on_device,no space left on device (disk full?),0x080c +file_exceeds_file_system_maximum_size,file exceeds file system's maximum file size,0x080d +file_transfer_connection_timeout,file transfer connection timeout,0x080e +file_connection_lost,lost file transfer connection,0x080f +file_exceeds_supplied_size,file exceeds supplied file size,0x0810 +file_transfer_complete,file transfer complete,0x0811 +file_transfer_canceled,file transfer canceled,0x0812 +file_transfer_interrupted,file transfer interrupted,0x0813 +file_transfer_server_quota_exceeded,file transfer server quota exceeded,0x0814 +file_transfer_client_quota_exceeded,file transfer client quota exceeded,0x0815 +file_transfer_reset,file transfer reset,0x0816 +file_transfer_limit_reached,file transfer limit reached,0x0817 +sound_preprocessor_disabled,preprocessor disabled,0x0900 +sound_internal_preprocessor,internal preprocessor,0x0901 +sound_internal_encoder,internal encoder,0x0902 +sound_internal_playback,internal playback,0x0903 +sound_no_capture_device_available,no capture device available,0x0904 +sound_no_playback_device_available,no playback device available,0x0905 +sound_could_not_open_capture_device,could not open capture device,0x0906 +sound_could_not_open_playback_device,could not open playback device,0x0907 +sound_handler_has_device,ServerConnectionHandler has a device registered,0x0908 +sound_invalid_capture_device,invalid capture device,0x0909 +sound_invalid_playback_device,invalid clayback device,0x090a +sound_invalid_wave,invalid wave file,0x090b +sound_unsupported_wave,wave file type not supported,0x090c +sound_open_wave,could not open wave file,0x090d +sound_internal_capture,internal capture,0x090e +sound_device_in_use,device still in use,0x090f +sound_device_already_registerred,device already registerred,0x0910 +sound_unknown_device,device not registered/known,0x0911 +sound_unsupported_frequency,unsupported frequency,0x0912 +sound_invalid_channel_count,invalid channel count,0x0913 +sound_read_wave,read error in wave,0x0914 +sound_need_more_data,sound need more data,0x0915 +sound_device_busy,sound device was busy,0x0916 +sound_no_data,there is no sound data for this period,0x0917 +sound_channel_mask_mismatch,Channelmask set bits count (speakers) is not the same as (count),0x0918 +permission_invalid_group_id,invalid group ID,0x0a00 +permission_duplicate_entry,duplicate entry,0x0a01 +permission_invalid_perm_id,invalid permission ID,0x0a02 +permission_empty_result,empty result set,0x0a03 +permission_default_group_forbidden,access to default group is forbidden,0x0a04 +permission_invalid_size,invalid size,0x0a05 +permission_invalid_value,invalid value,0x0a06 +permissions_group_not_empty,group is not empty,0x0a07 +permissions_client_insufficient,insufficient client permissions,0x0a08 +permissions_insufficient_group_power,insufficient group modify power,0x0a09 +permissions_insufficient_permission_power,insufficient permission modify power,0x0a0a +permission_template_group_is_used,template group is currently used,0x0a0b +permissions,permission error,0x0a0c +accounting_virtualserver_limit_reached,virtualserver limit reached,0x0b00 +accounting_slot_limit_reached,max slot limit reached,0x0b01 +accounting_license_file_not_found,license file not found,0x0b02 +accounting_license_date_not_ok,license date not ok,0x0b03 +accounting_unable_to_connect_to_server,unable to connect to accounting server,0x0b04 +accounting_unknown_error,unknown accounting error,0x0b05 +accounting_server_error,accounting server error,0x0b06 +accounting_instance_limit_reached,instance limit reached,0x0b07 +accounting_instance_check_error,instance check error,0x0b08 +accounting_license_file_invalid,license file invalid,0x0b09 +accounting_running_elsewhere,virtualserver is running elsewhere,0x0b0a +accounting_instance_duplicated,virtualserver running in same instance already,0x0b0b +accounting_already_started,virtualserver already started,0x0b0c +accounting_not_started,virtualserver not started,0x0b0d +accounting_to_many_starts,,0x0b0e +message_invalid_id,invalid message id,0x0c00 +ban_invalid_id,invalid ban id,0x0d00 +connect_failed_banned,"connection failed, you are banned",0x0d01 +rename_failed_banned,"rename failed, new name is banned",0x0d02 +ban_flooding,flood ban,0x0d03 +tts_unable_to_initialize,unable to initialize tts,0x0e00 +privilege_key_invalid,invalid privilege key,0x0f00 +voip_pjsua,,0x1000 +voip_already_initialized,,0x1001 +voip_too_many_accounts,,0x1002 +voip_invalid_account,,0x1003 +voip_internal_error,,0x1004 +voip_invalid_connectionId,,0x1005 +voip_cannot_answer_initiated_call,,0x1006 +voip_not_initialized,,0x1007 +provisioning_invalid_password,invalid password,0x1100 +provisioning_invalid_request,invalid request,0x1101 +provisioning_no_slots_available,no(more) slots available,0x1102 +provisioning_pool_missing,pool missing,0x1103 +provisioning_pool_unknown,pool unknown,0x1104 +provisioning_unknown_ip_location,unknown ip location(perhaps LAN ip?),0x1105 +provisioning_internal_tries_exceeded,internal error(tried exceeded),0x1106 +provisioning_too_many_slots_requested,too many slots requested,0x1107 +provisioning_too_many_reserved,too many reserved,0x1108 +provisioning_could_not_connect,could not connect to provisioning server,0x1109 +provisioning_auth_server_not_connected,authentication server not connected,0x1110 +provisioning_auth_data_too_large,authentication data too large,0x1111 +provisioning_already_initialized,already initialized,0x1112 +provisioning_not_initialized,not initialized,0x1113 +provisioning_connecting,already connecting,0x1114 +provisioning_already_connected,already connected,0x1115 +provisioning_not_connected,,0x1116 +provisioning_io_error,io_error,0x1117 +provisioning_invalid_timeout,,0x1118 +provisioning_ts3server_not_found,,0x1119 +provisioning_no_permission,unknown permissionID,0x111A diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-APACHE b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-MIT b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-MIT new file mode 100644 index 0000000..00a6ce1 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/LICENSE-MIT @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Sebastian Neubauer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Messages.toml b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Messages.toml new file mode 100644 index 0000000..6ac049b --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Messages.toml @@ -0,0 +1,1028 @@ +# The fields array specifies command parameter. +# - "map": is a unique name for a field. This is required since teamspeak +# | sometimes reuses field names with different data or datatypes. +# | We usually use the same as "ts" unless disambiguation is needed. +# - "ts": is then field name in the command as teamspeak uses it. +# - "pretty": is a high-level name for the field which should be better readable +# | and make more sense in the object context it is used. +# - "type": Describes a primitive type or enum which can be used for this field. +# | We use the primitive type namings of the language 'Rust'. +# - "mod": Applies an additional modifier to this field. Current modifiers: +# | "array": The field is a comma-separated list and can be read as an array. + +fields = [ + { map="aclid", ts="aclid", pretty="ClientId", type="ClientId" }, + { map="acn", ts="acn", pretty="AcceptedClientName", type="str" }, + { map="alpha", ts="alpha", pretty="Alpha", type="str" }, + { map="average_speed", ts="average_speed", pretty="AverageSpeed", type="f32" }, + { map="banid", ts="banid", pretty="BanId", type="u32" }, # integer, size guessed + { map="bantime", ts="bantime", pretty="BanTime", type="DurationSeconds" }, + { map="banreason", ts="banreason", pretty="BanReason", type="str" }, + { map="begin_pos", ts="begin_pos", pretty="Offset", type="u64" }, # integer, size guessed + { map="beta", ts="beta", pretty="Beta", type="str" }, + { map="cfid", ts="cfid", pretty="SourceChannelId", type="ChannelId" }, + { map="cgi", ts="cgi", pretty="ChannelGroupIndex", type="ChannelGroupId" }, + { map="cgid", ts="cgid", pretty="ChannelGroup", type="ChannelGroupId" }, # TODO: Consider name 'ChannelGroup' for consistency + { map="channel_banner_gfx_url", ts="channel_banner_gfx_url", pretty="BannerGfxUrl", type="str" }, + { map="channel_banner_mode", ts="channel_banner_mode", pretty="BannerMode", type="str" }, # ?? Same as HostBannerMode maybe? There's no ui for this setting + { map="channel_codec", ts="channel_codec", pretty="Codec", type="Codec" }, + { map="channel_codec_is_unencrypted", ts="channel_codec_is_unencrypted", pretty="IsUnencrypted", type="bool" }, + { map="channel_codec_latency_factor", ts="channel_codec_latency_factor", pretty="CodecLatencyFactor", type="i32" }, + { map="channel_codec_quality", ts="channel_codec_quality", pretty="CodecQuality", type="u8" }, + { map="channel_delete_delay", ts="channel_delete_delay", pretty="DeleteDelay", type="DurationSeconds" }, + { map="channel_description", ts="channel_description", pretty="Description", type="str" }, + { map="channel_filepath", ts="channel_filepath", pretty="FilePath", type="str" }, + { map="channel_flag_default", ts="channel_flag_default", pretty="IsDefault", type="bool" }, + { map="channel_flag_maxclients_unlimited", ts="channel_flag_maxclients_unlimited", pretty="IsMaxClientsUnlimited", type="bool" }, + { map="channel_flag_maxfamilyclients_inherited", ts="channel_flag_maxfamilyclients_inherited", pretty="InheritsMaxFamilyClients", type="bool" }, + { map="channel_flag_maxfamilyclients_unlimited", ts="channel_flag_maxfamilyclients_unlimited", pretty="IsMaxFamilyClientsUnlimited", type="bool" }, + { map="channel_flag_password", ts="channel_flag_password", pretty="HasPassword", type="bool" }, + { map="channel_flag_permanent", ts="channel_flag_permanent", pretty="IsPermanent", type="bool" }, + { map="channel_flag_private", ts="channel_flag_private", pretty="IsPrivate", type="bool" }, + { map="channel_flag_semi_permanent", ts="channel_flag_semi_permanent", pretty="IsSemiPermanent", type="bool" }, + { map="channel_forced_silence", ts="channel_forced_silence", pretty="ForcedSilence", type="bool" }, + { map="channel_icon_id", ts="channel_icon_id", pretty="Icon", type="IconId" }, + { map="channel_maxclients", ts="channel_maxclients", pretty="MaxClients", type="i32" }, # should be u16, but teamspeak sometimes sends '-1' + { map="channel_maxfamilyclients", ts="channel_maxfamilyclients", pretty="MaxFamilyClients", type="i32" }, # should be u16, but teamspeak sometimes sends '-1' + { map="channel_name", ts="channel_name", pretty="Name", type="str" }, + { map="channel_name_phonetic", ts="channel_name_phonetic", pretty="PhoneticName", type="str" }, + { map="channel_needed_subscribe_power", ts="channel_needed_subscribe_power", pretty="NeededSubscribePower", type="i32" }, + { map="channel_needed_talk_power", ts="channel_needed_talk_power", pretty="NeededTalkPower", type="i32" }, + { map="channel_order", ts="channel_order", pretty="Order", type="ChannelId" }, + { map="channel_password", ts="channel_password", pretty="Password", type="str" }, + { map="channel_security_salt", ts="channel_security_salt", pretty="PasswordSalt", type="str" }, + { map="channel_storage_quota", ts="channel_storage_quota", pretty="StorageQuota", type="u32" }, + { map="channel_topic", ts="channel_topic", pretty="Topic", type="str" }, + { map="channel_unique_identifier", ts="channel_unique_identifier", pretty="Guid", type="str" }, + { map="cid", ts="cid", pretty="ChannelId", type="ChannelId" }, + { map="cldbid", ts="cldbid", pretty="ClientDbId", type="ClientDbId" }, + { map="clid", ts="clid", pretty="ClientId", type="ClientId" }, + { map="client_away", ts="client_away", pretty="IsAway", type="bool" }, + { map="client_away_message", ts="client_away_message", pretty="AwayMessage", type="str" }, + { map="client_badges", ts="client_badges", pretty="Badges", type="str" }, + { map="client_signed_badges", ts="client_signed_badges", pretty="SignedBadges", type="str" }, + { map="client_base64HashClientUID", ts="client_base64HashClientUID", pretty="Base64HashClientUid", type="str" }, + { map="client_channel_group_id", ts="client_channel_group_id", pretty="ChannelGroup", type="ChannelGroupId" }, + { map="client_channel_group_inherited_channel_id", ts="client_channel_group_inherited_channel_id", pretty="InheritedChannelGroupFromChannel", type="ChannelId" }, + { map="client_channel_id", ts="client_channel_id", pretty="ChannelId", type="ChannelId" }, + { map="client_country", ts="client_country", pretty="CountryCode", type="str" }, + { map="client_created", ts="client_created", pretty="Created", type="DateTime" }, + { map="client_database_id", ts="client_database_id", pretty="DatabaseId", type="ClientDbId" }, + { map="client_default_channel", ts="client_default_channel", pretty="DefaultChannel", type="str" }, + { map="client_default_channel_password", ts="client_default_channel_password", pretty="DefaultChannelPassword", type="str" }, + { map="client_default_token", ts="client_default_token", pretty="DefaultToken", type="str" }, + { map="client_description", ts="client_description", pretty="Description", type="str" }, + { map="client_estimated_location", ts="client_estimated_location", pretty="EstimatedLocation", type="str" }, + { map="client_flag_avatar", ts="client_flag_avatar", pretty="AvatarHash", type="str" }, + { map="client_flag_talking", ts="client_flag_talking", pretty="IsTalking", type="bool" }, + { map="client_icon_id", ts="client_icon_id", pretty="Icon", type="IconId" }, + { map="client_id", ts="client_id", pretty="ClientId", type="ClientId" }, + { map="client_idle_time", ts="client_idle_time", pretty="ClientIdleTime", type="DurationMilliseconds" }, + { map="client_input_hardware", ts="client_input_hardware", pretty="InputHardwareEnabled", type="bool" }, + { map="client_input_muted", ts="client_input_muted", pretty="InputMuted", type="bool" }, + { map="client_integrations", ts="client_integrations", pretty="Integrations", type="str" }, # type guessed + { map="client_active_integrations_info", ts="client_active_integrations_info", pretty="ActiveIntegrationsInfo", type="str" }, # type guessed + { map="client_is_channel_commander", ts="client_is_channel_commander", pretty="IsChannelCommander", type="bool" }, + { map="client_is_priority_speaker", ts="client_is_priority_speaker", pretty="IsPrioritySpeaker", type="bool" }, + { map="client_is_recording", ts="client_is_recording", pretty="IsRecording", type="bool" }, + { map="client_is_talker", ts="client_is_talker", pretty="TalkPowerGranted", type="bool" }, + { map="client_key_offset", ts="client_key_offset", pretty="ClientKeyOffset", type="u64" }, + { map="client_lastconnected", ts="client_lastconnected", pretty="LastConnected", type="DateTime" }, + { map="client_lastip", ts="client_lastip", pretty="LastIp", type="str" }, + { map="client_login_name", ts="client_login_name", pretty="LoginName", type="str" }, + { map="client_login_password", ts="client_login_password", pretty="LoginPassword", type="str" }, + { map="client_meta_data", ts="client_meta_data", pretty="Metadata", type="str" }, + { map="client_month_bytes_downloaded", ts="client_month_bytes_downloaded", pretty="BytesDownloadedMonth", type="u64" }, + { map="client_month_bytes_uploaded", ts="client_month_bytes_uploaded", pretty="BytesUploadedMonth", type="u64" }, + { map="client_myteamspeak_id", ts="client_myteamspeak_id", pretty="MyTeamSpeakId", type="str" }, # type guessed + { map="client_myteamspeak_avatar", ts="client_myteamspeak_avatar", pretty="MyTeamSpeakAvatar", type="str" }, # type guessed + { map="client_needed_serverquery_view_power", ts="client_needed_serverquery_view_power", pretty="NeededServerqueryViewPower", type="i32" }, + { map="client_nickname", ts="client_nickname", pretty="Name", type="str" }, + { map="client_nickname@initserver", ts="client_nickname", pretty="ClientName", type="str" }, # Mirrored + { map="client_nickname_phonetic", ts="client_nickname_phonetic", pretty="PhoneticName", type="str" }, + { map="client_nickname_phonetic@initserver", ts="client_nickname_phonetic", pretty="ClientPhoneticName", type="str" }, # Mirrored + { map="client_origin_server_id", ts="client_origin_server_id", pretty="OriginServerId", type="u64" }, + { map="client_output_hardware", ts="client_output_hardware", pretty="OutputHardwareEnabled", type="bool" }, + { map="client_output_muted", ts="client_output_muted", pretty="OutputMuted", type="bool" }, + { map="client_outputonly_muted", ts="client_outputonly_muted", pretty="OutputOnlyMuted", type="bool" }, + { map="client_platform", ts="client_platform", pretty="Platform", type="str" }, + { map="client_platform@initserver", ts="client_platform", pretty="ClientPlatform", type="str" }, # Mirrored + { map="client_security_hash", ts="client_security_hash", pretty="SecurityHash", type="str" }, + { map="client_server_password", ts="client_server_password", pretty="Password", type="str" }, + { map="client_servergroups", ts="client_servergroups", pretty="ServerGroups", type="ServerGroupId", mod="array" }, + { map="client_talk_power", ts="client_talk_power", pretty="TalkPower", type="i32" }, + { map="client_talk_request", ts="client_talk_request", pretty="TalkPowerRequestTime", type="DateTime" }, # 0 means no talk request + { map="client_talk_request@clientupdate", ts="client_talk_request", pretty="TalkPowerRequest", type="bool" }, + { map="client_talk_request_msg", ts="client_talk_request_msg", pretty="TalkPowerRequestMessage", type="str" }, + { map="client_total_bytes_downloaded", ts="client_total_bytes_downloaded", pretty="BytesDownloadedTotal", type="u64" }, + { map="client_total_bytes_uploaded", ts="client_total_bytes_uploaded", pretty="BytesUploadedTotal", type="u64" }, + { map="client_totalconnections", ts="client_totalconnections", pretty="ConnectionsTotal", type="u32" }, + { map="client_type", ts="client_type", pretty="ClientType", type="ClientType" }, + { map="client_unique_identifier", ts="client_unique_identifier", pretty="Uid", type="Uid" }, + { map="client_unread_messages", ts="client_unread_messages", pretty="UnreadMessages", type="u32" }, + { map="client_user_tag", ts="client_user_tag", pretty="UserTag", type="str" }, + { map="client_version", ts="client_version", pretty="Version", type="str" }, + { map="client_version@initserver", ts="client_version", pretty="ClientVersion", type="str" }, # Mirrored + { map="client_version_sign", ts="client_version_sign", pretty="VersionSign", type="str" }, + { map="client_version_sign@initserver", ts="client_version_sign", pretty="ClientVersionSign", type="str" }, # Mirrored + { map="clientftfid", ts="clientftfid", pretty="ClientFiletransferId", type="u16" }, + { map="cluid", ts="cluid", pretty="ClientUid", type="Uid" }, + { map="connection_bandwidth_received_last_minute_control", ts="connection_bandwidth_received_last_minute_control", pretty="BandwidthReceivedLastMinuteControl", type="u64" }, + { map="connection_bandwidth_received_last_minute_keepalive", ts="connection_bandwidth_received_last_minute_keepalive", pretty="BandwidthReceivedLastMinuteKeepalive", type="u64" }, + { map="connection_bandwidth_received_last_minute_speech", ts="connection_bandwidth_received_last_minute_speech", pretty="BandwidthReceivedLastMinuteSpeech", type="u64" }, + { map="connection_bandwidth_received_last_minute_total", ts="connection_bandwidth_received_last_minute_total", pretty="BandwidthReceivedLastMinuteTotal", type="u64" }, + { map="connection_bandwidth_received_last_second_control", ts="connection_bandwidth_received_last_second_control", pretty="BandwidthReceivedLastSecondControl", type="u64" }, + { map="connection_bandwidth_received_last_second_keepalive", ts="connection_bandwidth_received_last_second_keepalive", pretty="BandwidthReceivedLastSecondKeepalive", type="u64" }, + { map="connection_bandwidth_received_last_second_speech", ts="connection_bandwidth_received_last_second_speech", pretty="BandwidthReceivedLastSecondSpeech", type="u64" }, + { map="connection_bandwidth_received_last_second_total", ts="connection_bandwidth_received_last_second_total", pretty="BandwidthReceivedLastSecondTotal", type="u64" }, + { map="connection_bandwidth_sent_last_minute_control", ts="connection_bandwidth_sent_last_minute_control", pretty="BandwidthSentLastMinuteControl", type="u64" }, + { map="connection_bandwidth_sent_last_minute_keepalive", ts="connection_bandwidth_sent_last_minute_keepalive", pretty="BandwidthSentLastMinuteKeepalive", type="u64" }, + { map="connection_bandwidth_sent_last_minute_speech", ts="connection_bandwidth_sent_last_minute_speech", pretty="BandwidthSentLastMinuteSpeech", type="u64" }, + { map="connection_bandwidth_sent_last_minute_total", ts="connection_bandwidth_sent_last_minute_total", pretty="BandwidthSentLastMinuteTotal", type="u64" }, + { map="connection_bandwidth_sent_last_second_control", ts="connection_bandwidth_sent_last_second_control", pretty="BandwidthSentLastSecondControl", type="u64" }, + { map="connection_bandwidth_sent_last_second_keepalive", ts="connection_bandwidth_sent_last_second_keepalive", pretty="BandwidthSentLastSecondKeepalive", type="u64" }, + { map="connection_bandwidth_sent_last_second_speech", ts="connection_bandwidth_sent_last_second_speech", pretty="BandwidthSentLastSecondSpeech", type="u64" }, + { map="connection_bandwidth_sent_last_second_total", ts="connection_bandwidth_sent_last_second_total", pretty="BandwidthSentLastSecondTotal", type="u64" }, + { map="connection_bytes_received_control", ts="connection_bytes_received_control", pretty="BytesReceivedControl", type="u64" }, + { map="connection_bytes_received_keepalive", ts="connection_bytes_received_keepalive", pretty="BytesReceivedKeepalive", type="u64" }, + { map="connection_bytes_received_speech", ts="connection_bytes_received_speech", pretty="BytesReceivedSpeech", type="u64" }, + { map="connection_bytes_received_total", ts="connection_bytes_received_total", pretty="BytesReceivedTotal", type="u64" }, + { map="connection_bytes_sent_control", ts="connection_bytes_sent_control", pretty="BytesSentControl", type="u64" }, + { map="connection_bytes_sent_keepalive", ts="connection_bytes_sent_keepalive", pretty="BytesSentKeepalive", type="u64" }, + { map="connection_bytes_sent_speech", ts="connection_bytes_sent_speech", pretty="BytesSentSpeech", type="u64" }, + { map="connection_bytes_sent_total", ts="connection_bytes_sent_total", pretty="BytesSentTotal", type="u64" }, + { map="connection_client_ip", ts="connection_client_ip", pretty="Ip", type="str" }, + { map="connection_client_port", ts="connection_client_port", pretty="Port", type="u16" }, + { map="connection_client2server_packetloss_control", ts="connection_client2server_packetloss_control", pretty="ClientToServerPacketlossControl", type="f32" }, + { map="connection_client2server_packetloss_keepalive", ts="connection_client2server_packetloss_keepalive", pretty="ClientToServerPacketlossKeepalive", type="f32" }, + { map="connection_client2server_packetloss_speech", ts="connection_client2server_packetloss_speech", pretty="ClientToServerPacketlossSpeech", type="f32" }, + { map="connection_client2server_packetloss_total", ts="connection_client2server_packetloss_total", pretty="ClientToServerPacketlossTotal", type="f32" }, + { map="connection_connected_time", ts="connection_connected_time", pretty="ConnectedTime", type="DurationMilliseconds" }, + { map="connection_connected_time@server", ts="connection_connected_time", pretty="ConnectedTimeTotal", type="DurationSeconds" }, + { map="connection_filetransfer_bandwidth_received", ts="connection_filetransfer_bandwidth_received", pretty="FiletransferBandwidthReceived", type="u64" }, + { map="connection_filetransfer_bandwidth_sent", ts="connection_filetransfer_bandwidth_sent", pretty="FiletransferBandwidthSent", type="u64" }, + { map="connection_filetransfer_bytes_received_total", ts="connection_filetransfer_bytes_received_total", pretty="FiletransferBytesReceivedTotal", type="u64" }, + { map="connection_filetransfer_bytes_sent_total", ts="connection_filetransfer_bytes_sent_total", pretty="FiletransferBytesSentTotal", type="u64" }, + { map="connection_idle_time", ts="connection_idle_time", pretty="IdleTime", type="DurationMilliseconds" }, + { map="connection_packetloss_total", ts="connection_packetloss_total", pretty="PacketlossTotal", type="f32" }, + { map="connection_packets_received_control", ts="connection_packets_received_control", pretty="PacketsReceivedControl", type="u64" }, + { map="connection_packets_received_keepalive", ts="connection_packets_received_keepalive", pretty="PacketsReceivedKeepalive", type="u64" }, + { map="connection_packets_received_speech", ts="connection_packets_received_speech", pretty="PacketsReceivedSpeech", type="u64" }, + { map="connection_packets_received_total", ts="connection_packets_received_total", pretty="PacketsReceivedTotal", type="u64" }, + { map="connection_packets_sent_control", ts="connection_packets_sent_control", pretty="PacketsSentControl", type="u64" }, + { map="connection_packets_sent_keepalive", ts="connection_packets_sent_keepalive", pretty="PacketsSentKeepalive", type="u64" }, + { map="connection_packets_sent_speech", ts="connection_packets_sent_speech", pretty="PacketsSentSpeech", type="u64" }, + { map="connection_packets_sent_total", ts="connection_packets_sent_total", pretty="PacketsSentTotal", type="u64" }, + { map="connection_ping", ts="connection_ping", pretty="Ping", type="DurationMillisecondsFloat" }, + { map="connection_ping_deviation", ts="connection_ping_deviation", pretty="PingDeviation", type="DurationMillisecondsFloat" }, + { map="connection_server2client_packetloss_control", ts="connection_server2client_packetloss_control", pretty="ServerToClientPacketlossControl", type="f32" }, + { map="connection_server2client_packetloss_keepalive", ts="connection_server2client_packetloss_keepalive", pretty="ServerToClientPacketlossKeepalive", type="f32" }, + { map="connection_server2client_packetloss_speech", ts="connection_server2client_packetloss_speech", pretty="ServerToClientPacketlossSpeech", type="f32" }, + { map="connection_server2client_packetloss_total", ts="connection_server2client_packetloss_total", pretty="ServerToClientPacketlossTotal", type="f32" }, + { map="cpid", ts="cpid", pretty="ParentId", type="ChannelId" }, + { map="cpw", ts="cpw", pretty="ChannelPassword", type="str" }, + { map="created", ts="created", pretty="Created", type="DateTime" }, + { map="ctid", ts="ctid", pretty="TargetChannelId", type="ChannelId" }, + { map="current_speed", ts="current_speed", pretty="CurrentSpeed", type="f32" }, + { map="data", ts="data", pretty="Data", type="str" }, + { map="datetime", ts="datetime", pretty="DateTime", type="DateTime" }, + { map="delete", ts="delete", pretty="Delete", type="bool" }, + { map="desc", ts="desc", pretty="Description", type="str" }, + { map="dirname", ts="dirname", pretty="DirectoryName", type="str" }, + { map="duration@time", ts="duration", pretty="Duration", type="DurationSeconds" }, + { map="duration@list", ts="duration", pretty="Limit", type="u32" }, # integer, size guessed + # How often a banned client wanted to connect but was denied + { map="enforcements", ts="enforcements", pretty="Enforcements", type="u32" }, + { map="es", ts="es", pretty="EmptySince", type="DurationSeconds" }, + { map="end", ts="end", pretty="End", type="DateTime" }, + { map="event", ts="event", pretty="EventType", type="str" }, # {server|channel|textserver|textchannel|textprivate} + { map="fcldbid", ts="fcldbid", pretty="FromClientDbId", type="ClientDbId" }, + { map="file_size", ts="file_size", pretty="FileSize", type="u64" }, + { map="flag", ts="flag", pretty="IsRead", type="bool" }, + { map="flags@channel_ph", ts="flags", pretty="Flags", type="ChannelPermissionHint" }, + { map="flags@client_ph", ts="flags", pretty="Flags", type="ClientPermissionHint" }, + { map="flag_read", ts="flag_read", pretty="IsRead", type="bool" }, + { map="fname", ts="fname", pretty="FromName", type="str" }, + { map="ftkey", ts="ftkey", pretty="FiletransferKey", type="str" }, + { map="force", ts="force", pretty="Force", type="bool" }, + { map="group_id_end", ts="group_id_end", pretty="GroupIdEnd", type="PermissionId" }, # describes how permissions are grouped in the client ui + { map="hwid", ts="hwid", pretty="HardwareId", type="str" }, + { map="iconid", ts="iconid", pretty="Icon", type="IconId" }, + { map="id", ts="id", pretty="Id", type="ChannelId" }, + { map="id1", ts="id1", pretty="Id1", type="u64" }, # {ServerGroupId|ClientDbId|ChannelId} + { map="id2", ts="id2", pretty="Id2", type="u64" }, # {0|ChannelGroupId|ClientDbId} + { map="ident", ts="ident", pretty="ExternalIdentity", type="str" }, + { map="ip", ts="ip", pretty="Ip", type="IpAddr" }, + { map="instance", ts="instance", pretty="InstanceLog", type="bool" }, + { map="invokerid", ts="invokerid", pretty="InvokerId", type="ClientId" }, + { map="invokercldbid", ts="invokercldbid", pretty="InvokerDatabaseId", type="ClientDbId" }, + { map="invokername", ts="invokername", pretty="InvokerName", type="str" }, + { map="invokeruid", ts="invokeruid", pretty="InvokerUid", type="Uid" }, + { map="lastnickname", ts="lastnickname", pretty="LastNickname", type="str" }, + { map="last_pos", ts="last_pos", pretty="LastOffset", type="u64" }, # integer, size guessed + { map="lines", ts="lines", pretty="Lines", type="u32" }, # integer, size guessed + { map="log", ts="l", pretty="Log", type="str" }, # one argument per line + { map="logmsg", ts="logmsg", pretty="LogMessage", type="str" }, + { map="loglevel", ts="loglevel", pretty="LogLevel", type="LogLevel" }, + { map="lt", ts="lt", pretty="LicenseType", type="LicenseType" }, + { map="msg", ts="msg", pretty="Message", type="str" }, + { map="msgid", ts="msgid", pretty="MessageId", type="u32" }, # integer, size guessed + { map="message", ts="message", pretty="Message", type="str" }, + { map="mytsid", ts="mytsid", pretty="MyTsId", type="str" }, + { map="n", ts="n", pretty="PermissionNegated", type="bool" }, + { map="n_member_addp", ts="n_member_addp", pretty="NeededMemberAddPower", type="i32" }, + { map="n_member_removep", ts="n_member_removep", pretty="NeededMemberRemovePower", type="i32" }, + { map="n_modifyp", ts="n_modifyp", pretty="NeededModifyPower", type="i32" }, + { map="name", ts="name", pretty="Name", type="str" }, + { map="namemode", ts="namemode", pretty="NamingMode", type="GroupNamingMode" }, + { map="newname", ts="newname", pretty="NewName", type="str" }, + { map="nickname", ts="nickname", pretty="Nickname", type="str" }, + { map="oldname", ts="oldname", pretty="OldName", type="str" }, + { map="omega", ts="omega", pretty="Omega", type="str" }, + { map="order", ts="order", pretty="Order", type="ChannelId" }, + { map="overwrite", ts="overwrite", pretty="Overwrite", type="bool" }, + { map="p", ts="p", pretty="PermissionId", type="PermissionId" }, + { map="path", ts="path", pretty="Path", type="str" }, + { map="pattern", ts="pattern", pretty="Pattern", type="str" }, # sometimes Regex/SQL Wildcards + { map="permid", ts="permid", pretty="PermissionId", type="PermissionId" }, + { map="permnegated", ts="permnegated", pretty="PermissionNegated", type="bool" }, + { map="permsid", ts="permsid", pretty="PermissionNameId", type="str" }, + { map="permskip", ts="permskip", pretty="PermissionSkip", type="bool" }, + { map="permvalue", ts="permvalue", pretty="PermissionValue", type="i32" }, + { map="permname", ts="permname", pretty="PermissionName", type="str" }, + { map="permdesc", ts="permdesc", pretty="PermissionDescription", type="str" }, + { map="pid", ts="pid", pretty="ParentChannelId", type="ChannelId" }, + { map="port", ts="port", pretty="Port", type="u16" }, + { map="proto", ts="proto", pretty="Protocol", type="u8" }, + { map="pv", ts="pv", pretty="ProtocolVersion", type="u16" }, + { map="pw", ts="pw", pretty="Password", type="str" }, + # TODO maybe find better name when know what this is + { map="pw_clear", ts="pw_clear", pretty="PasswordClear", type="str" }, + { map="reasonid", ts="reasonid", pretty="Reason", type="Reason" }, + { map="reason", ts="reason", pretty="Reason", type="str" }, + { map="reasonmsg", ts="reasonmsg", pretty="ReasonMessage", type="str" }, + { map="resume", ts="resume", pretty="Resume", type="bool" }, + { map="reverse", ts="reverse", pretty="Reverse", type="bool" }, + { map="runtime", ts="runtime", pretty="Runtime", type="DurationSeconds" }, + { map="s", ts="s", pretty="PermissionSkip", type="bool" }, + { map="savedb", ts="savedb", pretty="IsPermanent", type="bool" }, + { map="scgid", ts="scgid", pretty="SourceChannelGroupId", type="ChannelGroupId" }, + { map="seconds_empty", ts="seconds_empty", pretty="DurationEmpty", type="DurationSeconds" }, + { map="seekpos", ts="seekpos", pretty="SeekPosition", type="u64" }, + # ?? type + { map="sender", ts="sender", pretty="Sender", type="u64" }, + { map="serverftfid", ts="serverftfid", pretty="ServerFiletransferId", type="u16" }, + { map="sgid", ts="sgid", pretty="ServerGroupId", type="ServerGroupId" }, + { map="sgtype", ts="sgtype", pretty="ServerGroupType", type="u32" }, # integer, size guessed + { map="sid", ts="sid", pretty="ServerId", type="u32" }, # integer, size guessed, maybe own type ServerId ? + { map="size", ts="size", pretty="Size", type="u64" }, + { map="sizedone", ts="sizedone", pretty="SizeDone", type="i64" }, + { map="sortid", ts="sortid", pretty="SortId", type="i32" }, + { map="ssgid", ts="ssgid", pretty="SourceServerGroupId", type="ServerGroupId" }, + { map="subject", ts="subject", pretty="Subject", type="str" }, + { map="subsystem", ts="subsystem", pretty="Subsystem", type="str" }, # {'voice'|'query'|'filetransfer'} + { map="status@err", ts="status", pretty="Status", type="Ts3ErrorCode" }, + { map="status@ft", ts="status", pretty="Status", type="i32" }, + { map="start@list", ts="start", pretty="Offset", type="u32" }, # integer, size guessed + { map="start@tmppw", ts="start", pretty="Start", type="DateTime" }, + { map="t", ts="t", pretty="PermissionType", type="PermissionType" }, + { map="target@msg", ts="target", pretty="TargetClientId", type="ClientId" }, + { map="target@plugin", ts="target", pretty="TargetClientId", type="ClientId" }, + { map="targetmode@msg", ts="targetmode", pretty="Target", type="TextMessageTargetMode" }, + { map="targetmode@plugin", ts="targetmode", pretty="Target", type="PluginTargetMode" }, + { map="tcgid", ts="tcgid", pretty="TargetChannelGroupId", type="ChannelGroupId" }, + { map="tcid", ts="tcid", pretty="TargetChannelId", type="ChannelId" }, + { map="tcpw", ts="tcpw", pretty="TargetChannelPassword", type="str" }, + { map="tcldbid", ts="tcldbid", pretty="TargetClientDbId", type="ClientDbId" }, + { map="time", ts="time", pretty="Time", type="DurationSeconds" }, + { map="time@initivexpand2", ts="time", pretty="Time", type="DateTime" }, + { map="timestamp", ts="timestamp", pretty="Timestamp", type="DateTime" }, + { map="tname", ts="tname", pretty="TargetName", type="str" }, + { map="token", ts="token", pretty="Token", type="str" }, + { map="token_created", ts="token_created", pretty="TokenCreateTime", type="DateTime" }, + { map="token_description", ts="token_description", pretty="TokenDescription", type="str" }, + { map="tokendescription", ts="tokendescription", pretty="TokenDescription", type="str" }, + { map="token_id1", ts="token_id1", pretty="TokenId1", type="u64" }, # {ServerGroup|ChannelGroup} + { map="tokenid1", ts="tokenid1", pretty="TokenId1", type="u64" }, # {ServerGroup|ChannelGroup} + { map="token_id2", ts="token_id2", pretty="TokenId2", type="ChannelId" }, # ChannelId + { map="tokenid2", ts="tokenid2", pretty="TokenId2", type="ChannelId" }, # ChannelId + { map="token_type", ts="token_type", pretty="TokenType", type="TokenType" }, + { map="tokentype", ts="tokentype", pretty="TokenType", type="TokenType" }, + { map="token1", ts="token1", pretty="Token1", type="str" }, + { map="token2", ts="token2", pretty="Token2", type="str" }, + { map="tokencustomset", ts="tokencustomset", pretty="TokenCustomSet", type="str" }, + { map="total_clients", ts="total_clients", pretty="ClientsTotal", type="i32" }, + { map="total_clients_family", ts="total_clients_family", pretty="FamilyClientsTotal", type="i32" }, + { map="tsgid", ts="tsgid", pretty="TargetServerGroupId", type="ServerGroupId" }, + { map="type@ft", ts="type", pretty="IsFile", type="bool" }, + { map="type@group", ts="type", pretty="GroupType", type="GroupType" }, + { map="uid", ts="uid", pretty="Uid", type="Uid" }, + { map="v", ts="v", pretty="PermissionValue", type="i32" }, # integer, size guessed + { map="value", ts="value", pretty="Value", type="str" }, + { map="virtualserver_administrative_domain", ts="virtualserver_administrative_domain", pretty="AdministrativeDomain", type="str" }, + { map="virtualserver_antiflood_points_tick_reduce", ts="virtualserver_antiflood_points_tick_reduce", pretty="AntifloodPointsTickReduce", type="u32" }, + { map="virtualserver_antiflood_points_needed_command_block", ts="virtualserver_antiflood_points_needed_command_block", pretty="AntifloodPointsToCommandBlock", type="u32" }, + { map="virtualserver_antiflood_points_needed_ip_block", ts="virtualserver_antiflood_points_needed_ip_block", pretty="AntifloodPointsToIpBlock", type="u32" }, + { map="virtualserver_antiflood_points_needed_plugin_block", ts="virtualserver_antiflood_points_needed_plugin_block", pretty="AntifloodPointsToPluginBlock", type="u32" }, + { map="virtualserver_ask_for_privilegekey", ts="virtualserver_ask_for_privilegekey", pretty="AskForPrivilegekey", type="bool" }, + { map="virtualserver_autostart", ts="virtualserver_autostart", pretty="Autostart", type="bool" }, + { map="virtualserver_capability_extensions", ts="virtualserver_capability_extensions", pretty="CapabilityExtensions", type="str" }, # TODO mod="array"? + { map="virtualserver_channel_temp_delete_delay_default", ts="virtualserver_channel_temp_delete_delay_default", pretty="TempChannelDefaultDeleteDelay", type="DurationSeconds" }, + { map="virtualserver_channelsonline", ts="virtualserver_channelsonline", pretty="ChannelCount", type="u64" }, + { map="virtualserver_client_connections", ts="virtualserver_client_connections", pretty="ConnectionCountTotal", type="u64" }, + { map="virtualserver_clientsonline", ts="virtualserver_clientsonline", pretty="ClientCount", type="u16" }, + { map="virtualserver_codec_encryption_mode", ts="virtualserver_codec_encryption_mode", pretty="CodecEncryptionMode", type="CodecEncryptionMode" }, + { map="virtualserver_complain_autoban_count", ts="virtualserver_complain_autoban_count", pretty="ComplainAutobanCount", type="u32" }, + { map="virtualserver_complain_autoban_time", ts="virtualserver_complain_autoban_time", pretty="ComplainAutobanTime", type="DurationSeconds" }, + { map="virtualserver_complain_remove_time", ts="virtualserver_complain_remove_time", pretty="ComplainRemoveTime", type="DurationSeconds" }, + { map="virtualserver_created", ts="virtualserver_created", pretty="Created", type="DateTime" }, + { map="virtualserver_default_channel_group", ts="virtualserver_default_channel_group", pretty="DefaultChannelGroup", type="ChannelGroupId" }, + { map="virtualserver_default_channel_admin_group", ts="virtualserver_default_channel_admin_group", pretty="DefaultChannelAdminGroup", type="ChannelGroupId" }, + { map="virtualserver_default_server_group", ts="virtualserver_default_server_group", pretty="DefaultServerGroup", type="ServerGroupId" }, + { map="virtualserver_download_quota", ts="virtualserver_download_quota", pretty="DownloadQuota", type="u64" }, + { map="virtualserver_flag_password", ts="virtualserver_flag_password", pretty="HasPassword", type="bool" }, + { map="virtualserver_hostbanner_gfx_interval", ts="virtualserver_hostbanner_gfx_interval", pretty="HostbannerGfxInterval", type="DurationSeconds" }, + { map="virtualserver_hostbanner_gfx_url", ts="virtualserver_hostbanner_gfx_url", pretty="HostbannerGfxUrl", type="str" }, + { map="virtualserver_hostbanner_mode", ts="virtualserver_hostbanner_mode", pretty="HostbannerMode", type="HostBannerMode" }, + { map="virtualserver_hostbanner_url", ts="virtualserver_hostbanner_url", pretty="HostbannerUrl", type="str" }, + { map="virtualserver_hostbutton_gfx_url", ts="virtualserver_hostbutton_gfx_url", pretty="HostbuttonGfxUrl", type="str" }, + { map="virtualserver_hostbutton_tooltip", ts="virtualserver_hostbutton_tooltip", pretty="HostbuttonTooltip", type="str" }, + { map="virtualserver_hostbutton_url", ts="virtualserver_hostbutton_url", pretty="HostbuttonUrl", type="str" }, + { map="virtualserver_hostmessage", ts="virtualserver_hostmessage", pretty="Hostmessage", type="str" }, + { map="virtualserver_hostmessage_mode", ts="virtualserver_hostmessage_mode", pretty="HostmessageMode", type="HostMessageMode" }, + { map="virtualserver_icon_id", ts="virtualserver_icon_id", pretty="Icon", type="IconId" }, + { map="virtualserver_id", ts="virtualserver_id", pretty="VirtualServerId", type="u64" }, + { map="virtualserver_ip", ts="virtualserver_ip", pretty="Ips", type="IpAddr", mod="array" }, + { map="virtualserver_log_client", ts="virtualserver_log_client", pretty="LogClient", type="bool" }, + { map="virtualserver_log_query", ts="virtualserver_log_query", pretty="LogQuery", type="bool" }, + { map="virtualserver_log_channel", ts="virtualserver_log_channel", pretty="LogChannel", type="bool" }, + { map="virtualserver_log_permissions", ts="virtualserver_log_permissions", pretty="LogPermissions", type="bool" }, + { map="virtualserver_log_server", ts="virtualserver_log_server", pretty="LogServer", type="bool" }, + { map="virtualserver_log_filetransfer", ts="virtualserver_log_filetransfer", pretty="LogFiletransfer", type="bool" }, + { map="virtualserver_machine_id", ts="virtualserver_machine_id", pretty="MachineId", type="str" }, + { map="virtualserver_max_download_total_bandwidth", ts="virtualserver_max_download_total_bandwidth", pretty="MaxDownloadBandwidthTotal", type="u64" }, + { map="virtualserver_max_upload_total_bandwidth", ts="virtualserver_max_upload_total_bandwidth", pretty="MaxUploadBandwidthTotal", type="u64" }, + { map="virtualserver_maxclients", ts="virtualserver_maxclients", pretty="MaxClients", type="u16" }, + { map="virtualserver_min_android_version", ts="virtualserver_min_android_version", pretty="MinAndroidVersion", type="DateTime" }, + { map="virtualserver_min_client_version", ts="virtualserver_min_client_version", pretty="MinClientVersion", type="DateTime" }, + { map="virtualserver_min_clients_in_channel_before_forced_silence", ts="virtualserver_min_clients_in_channel_before_forced_silence", pretty="MinClientsInChannelBeforeForcedSilence", type="u32" }, + { map="virtualserver_min_ios_version", ts="virtualserver_min_ios_version", pretty="MinIosVersion", type="DateTime" }, + { map="virtualserver_month_bytes_downloaded", ts="virtualserver_month_bytes_downloaded", pretty="BytesDownloadedMonth", type="u64" }, + { map="virtualserver_month_bytes_uploaded", ts="virtualserver_month_bytes_uploaded", pretty="BytesUploadedMonth", type="u64" }, + { map="virtualserver_name", ts="virtualserver_name", pretty="Name", type="str" }, + { map="virtualserver_name_phonetic", ts="virtualserver_name_phonetic", pretty="PhoneticName", type="str" }, + { map="virtualserver_needed_identity_security_level", ts="virtualserver_needed_identity_security_level", pretty="NeededIdentitySecurityLevel", type="u8" }, + { map="virtualserver_nickname", ts="virtualserver_nickname", pretty="Nickname", type="str" }, # `:`-separated array + { map="virtualserver_password", ts="virtualserver_password", pretty="Password", type="str" }, + { map="virtualserver_platform", ts="virtualserver_platform", pretty="Platform", type="str" }, + { map="virtualserver_port", ts="virtualserver_port", pretty="Port", type="u16" }, + { map="virtualserver_priority_speaker_dimm_modificator", ts="virtualserver_priority_speaker_dimm_modificator", pretty="PrioritySpeakerDimmModificator", type="f32" }, + { map="virtualserver_query_client_connections", ts="virtualserver_query_client_connections", pretty="QueryCountTotal", type="u64" }, + { map="virtualserver_queryclientsonline", ts="virtualserver_queryclientsonline", pretty="QueryCount", type="u32" }, + { map="virtualserver_reserved_slots", ts="virtualserver_reserved_slots", pretty="ReservedSlots", type="u16" }, + { map="virtualserver_status", ts="virtualserver_status", pretty="VirtualServerStatus", type="str" }, + { map="virtualserver_total_bytes_downloaded", ts="virtualserver_total_bytes_downloaded", pretty="BytesDownloadedTotal", type="u64" }, + { map="virtualserver_total_bytes_uploaded", ts="virtualserver_total_bytes_uploaded", pretty="BytesUploadedTotal", type="u64" }, + { map="virtualserver_total_packetloss_speech", ts="virtualserver_total_packetloss_speech", pretty="TotalPacketlossSpeech", type="f32" }, + { map="virtualserver_total_packetloss_keepalive", ts="virtualserver_total_packetloss_keepalive", pretty="TotalPacketlossKeepalive", type="f32" }, + { map="virtualserver_total_packetloss_control", ts="virtualserver_total_packetloss_control", pretty="TotalPacketlossControl", type="f32" }, + { map="virtualserver_total_packetloss_total", ts="virtualserver_total_packetloss_total", pretty="TotalPacketloss", type="f32" }, + { map="virtualserver_total_ping", ts="virtualserver_total_ping", pretty="TotalPing", type="DurationMillisecondsFloat" }, + { map="virtualserver_unique_identifier", ts="virtualserver_unique_identifier", pretty="VirtualServerUid", type="Uid" }, + { map="virtualserver_upload_quota", ts="virtualserver_upload_quota", pretty="UploadQuota", type="u64" }, + { map="virtualserver_uptime", ts="virtualserver_uptime", pretty="Uptime", type="DurationSeconds" }, + { map="virtualserver_version", ts="virtualserver_version", pretty="Version", type="str" }, + { map="virtualserver_weblist_enabled", ts="virtualserver_weblist_enabled", pretty="WeblistEnabled", type="bool" }, + { map="virtualserver_welcomemessage", ts="virtualserver_welcomemessage", pretty="WelcomeMessage", type="str" }, + + # Error stuff + { map="error_id", ts="id", pretty="Id", type="Ts3ErrorCode" }, + { map="failed_permid", ts="failed_permid", pretty="MissingPermissionId", type="PermissionId" }, + { map="return_code", ts="return_code", pretty="ReturnCode", type="str" }, + { map="extra_msg", ts="extra_msg", pretty="ExtraMessage", type="str" }, + + # 3.1 + { map="l", ts="l", pretty="License", type="str" }, + { map="tvd", ts="tvd", pretty="Tvd", type="str" }, + { map="proof", ts="proof", pretty="Proof", type="str" }, + { map="ot", ts="ot", pretty="Ot", type="bool" }, + + # TeaSpeak + { map="virtualserver_country", ts="virtualserver_country_code", pretty="CountryCode", type="str" }, + { map="virtualserver_default_music_group", ts="virtualserver_default_music_group", pretty="DefaultMusicGroup", type="ServerGroupId" }, + { map="root", ts="root", pretty="RootKey", type="str" }, +] + +# The "msg_group: array specifies all messages which can be sent between client +# and server. +# They are categorized into message groups whereby each group has a list of +# default modifiers which are applied on each message in the group. +# [Message structure]: +# - "name": The high-level name of the message. +# - "notify": The event name as teamspeak uses it (can be omitted when +# | response=true; this means that it can't be received without request). +# - "attributes": The "map"-name from all fields which are a parameter of this +# | command. The map name can be suffixed with a '?' to make it optional. +# | All non-optional fields must be set when receiving this message, +# | otherwise the message can/should be considered as invalid. +# [Message modifiers]: +# - "s2c": This message can be received as client (read: "server to client") +# - "c2s": This message can be received as server (read: "client to server") +# - "response": +# | - true: This message can appear without the event name as an answer to +# | | a request command (see "notify" before). +# | - false: This message will always be sent with the notify event name. +# - "low": The "lowcommand" packet must be used for this command. (Ignore for +# | query). +# - "np": The "newprotocol" flag must be set for this command. (Ignore for +# | query). + +# Client: "cid", "client_idle_time", "client_unique_identifier", "client_nickname", "client_version", "client_platform", "client_input_muted", "client_output_muted", "client_outputonly_muted", "client_input_hardware", "client_output_hardware", "client_default_channel", "client_meta_data", "client_is_recording", "client_version_sign", "client_security_hash", "client_login_name", "client_database_id", "client_channel_group_id", "client_servergroups", "client_created", "client_lastconnected", "client_totalconnections", "client_away", "client_away_message", "client_type", "client_flag_avatar", "client_talk_power", "client_talk_request", "client_talk_request_msg", "client_description", "client_is_talker", "client_month_bytes_uploaded", "client_month_bytes_downloaded", "client_total_bytes_uploaded", "client_total_bytes_downloaded", "client_is_priority_speaker", "client_unread_messages", "client_nickname_phonetic", "client_needed_serverquery_view_power", "client_default_token", "client_icon_id", "client_is_channel_commander", "client_country", "client_channel_group_inherited_channel_id", "client_badges", "client_myteamspeak_id", "client_integrations", "client_base64HashClientUID", "connection_filetransfer_bandwidth_sent", "connection_filetransfer_bandwidth_received", "connection_packets_sent_total", "connection_bytes_sent_total", "connection_packets_received_total", "connection_bytes_received_total", "connection_bandwidth_sent_last_second_total", "connection_bandwidth_sent_last_minute_total", "connection_bandwidth_received_last_second_total", "connection_bandwidth_received_last_minute_total", "connection_connected_time", "connection_client_ip" +# Channel: "channel_order?", "channel_name?", "channel_topic?", "channel_flag_default?", "channel_flag_password?", "channel_flag_permanent?", "channel_flag_semi_permanent?", "channel_codec?", "channel_codec_quality?", "channel_needed_talk_power?", "channel_icon_id?", "channel_maxclients?", "channel_maxfamilyclients?", "channel_codec_latency_factor?", "channel_codec_is_unencrypted?", "channel_delete_delay?", "channel_flag_maxclients_unlimited?", "channel_flag_maxfamilyclients_unlimited?", "channel_flag_maxfamilyclients_inherited?", "channel_name_phonetic?", "cpid?" + +# Server to Client Notifications +[[msg_group]] +default = { s2c=true, c2s=false, response=false, low=false, np=false } +msg = [ + { name="ChannelChanged", notify="notifychannelchanged", attributes=["cid"] }, + { name="ChannelDescriptionChanged", notify="notifychanneldescriptionchanged", attributes=["cid"] }, + # TODO check with ChannelData + { name="ChannelList", notify="channellist", attributes=["cid", "cpid", "channel_name", "channel_topic", "channel_codec", "channel_codec_quality", "channel_maxclients", "channel_maxfamilyclients", "channel_order", "channel_flag_permanent", "channel_flag_semi_permanent", "channel_flag_default", "channel_flag_password", "channel_codec_latency_factor", "channel_codec_is_unencrypted", "channel_delete_delay", "channel_flag_maxclients_unlimited", "channel_flag_maxfamilyclients_unlimited", "channel_flag_maxfamilyclients_inherited", "channel_needed_talk_power", "channel_forced_silence", "channel_name_phonetic", "channel_icon_id", "channel_flag_private?", "channel_unique_identifier?", "channel_banner_gfx_url?", "channel_banner_mode?", "channel_storage_quota?"] }, + { name="ChannelListFinished", notify="channellistfinished", attributes=[] }, + { name="ChannelMoved", notify="notifychannelmoved", attributes=["order", "cid", "invokerid", "invokername", "invokeruid?", "reasonid", "cpid"] }, + { name="ChannelPasswordChanged", notify="notifychannelpasswordchanged", attributes=["cid"] }, + { name="ChannelPermissionHints", notify="notifychannelpermhints", attributes=["cid", "flags@channel_ph"] }, + { name="ChannelSubscribed", notify="notifychannelsubscribed", attributes=["cid", "es?"] }, + { name="ChannelUnsubscribed", notify="notifychannelunsubscribed", attributes=["cid"] }, + { name="ClientChannelGroupChanged", notify="notifyclientchannelgroupchanged", attributes=["invokerid", "invokername", "invokeruid?", "cgid", "cgi", "cid", "clid"] }, + { name="ClientChatClosed", notify="notifyclientchatclosed", attributes=["clid", "cluid"] }, + { name="ClientChatComposing", notify="notifyclientchatcomposing", attributes=["clid", "cluid"] }, + { name="ClientConnectionInfo", notify="notifyconnectioninfo", attributes=["clid", "connection_ping?", "connection_ping_deviation?", "connection_connected_time?", "connection_client_ip?", "connection_client_port?", "connection_packets_sent_speech?", "connection_packets_sent_keepalive?", "connection_packets_sent_control?", "connection_bytes_sent_speech?", "connection_bytes_sent_keepalive?", "connection_bytes_sent_control?", "connection_packets_received_speech?", "connection_packets_received_keepalive?", "connection_packets_received_control?", "connection_bytes_received_speech?", "connection_bytes_received_keepalive?", "connection_bytes_received_control?", "connection_server2client_packetloss_speech?", "connection_server2client_packetloss_keepalive?", "connection_server2client_packetloss_control?", "connection_server2client_packetloss_total?", "connection_client2server_packetloss_speech", "connection_client2server_packetloss_keepalive", "connection_client2server_packetloss_control", "connection_client2server_packetloss_total", "connection_bandwidth_sent_last_second_speech?", "connection_bandwidth_sent_last_second_keepalive?", "connection_bandwidth_sent_last_second_control?", "connection_bandwidth_sent_last_minute_speech?", "connection_bandwidth_sent_last_minute_keepalive?", "connection_bandwidth_sent_last_minute_control?", "connection_bandwidth_received_last_second_speech?", "connection_bandwidth_received_last_second_keepalive?", "connection_bandwidth_received_last_second_control?", "connection_bandwidth_received_last_minute_speech?", "connection_bandwidth_received_last_minute_keepalive?", "connection_bandwidth_received_last_minute_control?", "connection_filetransfer_bandwidth_sent?", "connection_filetransfer_bandwidth_received?", "connection_idle_time"] }, + { name="ClientConnectionInfoUpdateRequest", notify="notifyconnectioninforequest", attributes=[] }, + { name="ClientEnterView", notify="notifycliententerview", attributes=["reasonid", "ctid", "invokerid?", "invokername?", "invokeruid?", "clid", "client_database_id", "client_nickname", "client_type", "cfid", "client_unique_identifier", "client_flag_avatar", "client_description", "client_icon_id", "client_input_muted", "client_output_muted", "client_outputonly_muted", "client_input_hardware", "client_output_hardware", "client_meta_data", "client_is_recording", "client_channel_group_id", "client_channel_group_inherited_channel_id", "client_servergroups", "client_away", "client_away_message", "client_talk_power", "client_talk_request", "client_talk_request_msg", "client_is_talker", "client_is_priority_speaker", "client_unread_messages", "client_nickname_phonetic", "client_needed_serverquery_view_power", "client_is_channel_commander", "client_country", "client_badges", "client_myteamspeak_id", "client_integrations", "client_myteamspeak_avatar?", "client_signed_badges?", "client_estimated_location?", "client_totalconnections?", "client_user_tag?"] }, + { name="ClientLeftView", notify="notifyclientleftview", attributes=["reasonmsg?", "bantime?", "reasonid?", "ctid", "invokerid?", "invokername?", "invokeruid?", "clid", "cfid"] }, + { name="ClientMoved", notify="notifyclientmoved", attributes=["clid", "reasonid", "cfid?", "ctid", "invokerid?", "invokername?", "invokeruid?", "reasonmsg?"] }, + { name="ClientNeededPermissions", notify="notifyclientneededpermissions", attributes=["permid", "permvalue?"] }, + { name="ClientPermissionHints", notify="notifyclientpermhints", attributes=["clid", "flags@client_ph"] }, + { name="ClientServerGroupAdded", notify="notifyservergroupclientadded", attributes=["name", "sgid", "invokerid", "invokername", "invokeruid?", "clid", "cluid"] }, + { name="ClientServerGroupRemoved", notify="notifyservergroupclientdeleted", attributes=["name", "sgid", "invokerid", "invokername", "invokeruid?", "clid", "cluid"] }, + { name="ClientUpdated", notify="notifyclientupdated", attributes=["clid", "invokerid?", "invokername?", "invokeruid?", "client_nickname?", "client_unread_messages?", "client_version?", "client_platform?", "client_login_name?", "client_created?", "client_lastconnected?", "client_totalconnections?", "client_month_bytes_uploaded?", "client_month_bytes_downloaded?", "client_total_bytes_uploaded?", "client_total_bytes_downloaded?", "client_input_muted?", "client_input_hardware?", "client_output_muted?", "client_meta_data?", "client_output_hardware?", "client_description?", "client_is_priority_speaker?", "client_is_channel_commander?", "client_flag_avatar?", "client_signed_badges?", "client_talk_request?", "client_talk_request_msg?", "client_is_talker?", "client_nickname_phonetic?", "client_is_recording?", "client_servergroups?", "client_myteamspeak_id?", "client_badges?", "client_myteamspeak_avatar?", "client_talk_power?", "client_icon_id?", "client_away?", "client_away_message?", "client_channel_group_inherited_channel_id?", "client_channel_group_id?", "client_needed_serverquery_view_power?", "client_user_tag?"] }, + { name="CommandError", notify="error", attributes=["error_id", "msg", "failed_permid?", "return_code?", "extra_msg?"] }, + { name="FileListFinished", notify="notifyfilelistfinished", attributes=["cid", "path"] }, + { name="FiletransferStatus", notify="notifystatusfiletransfer", attributes=["clientftfid", "status@err", "msg", "size"] }, + { name="InitIvExpand", notify="initivexpand", attributes=["alpha", "beta", "omega"] }, + { name="InitIvExpand2", notify="initivexpand2", attributes=["l", "beta", "omega", "ot?", "proof", "tvd", "time@initivexpand2?", "root?"] }, + { name="InitServer", notify="initserver", attributes=["virtualserver_name", "virtualserver_welcomemessage", "virtualserver_platform", "virtualserver_version", "virtualserver_maxclients", "virtualserver_created", "virtualserver_codec_encryption_mode", "virtualserver_hostmessage", "virtualserver_hostmessage_mode", "virtualserver_default_server_group", "virtualserver_default_channel_group", "virtualserver_id", "virtualserver_ip?", "virtualserver_ask_for_privilegekey", "lt?", "virtualserver_hostbanner_url", "virtualserver_hostbanner_gfx_url", "virtualserver_hostbanner_gfx_interval", "virtualserver_priority_speaker_dimm_modificator", "virtualserver_hostbutton_tooltip", "virtualserver_hostbutton_url", "virtualserver_hostbutton_gfx_url", "virtualserver_name_phonetic", "virtualserver_icon_id", "virtualserver_hostbanner_mode", "virtualserver_channel_temp_delete_delay_default", "virtualserver_nickname?", "virtualserver_unique_identifier?", "virtualserver_default_music_group?", "virtualserver_default_channel_admin_group?", "virtualserver_weblist_enabled?", "virtualserver_country?", "virtualserver_capability_extensions?", "virtualserver_administrative_domain?", "client_nickname@initserver?", "client_version@initserver?", "client_platform@initserver?", "client_input_muted?", "client_output_muted?", "client_outputonly_muted?", "client_input_hardware?", "client_output_hardware?", "client_default_channel?", "client_default_channel_password?", "client_server_password?", "client_meta_data?", "client_version_sign@initserver?", "client_security_hash?", "client_key_offset?", "client_away?", "client_away_message?", "client_nickname_phonetic@initserver?", "client_default_token?", "client_badges?", "client_myteamspeak_id?", "client_integrations?", "client_active_integrations_info?", "client_myteamspeak_avatar?", "client_signed_badges?", "acn", "aclid", "pv", "client_talk_power", "client_needed_serverquery_view_power", "client_user_tag?"] }, + { name="PluginCommand", notify="notifyplugincmd", attributes=["name", "data", "invokerid?", "invokername?", "invokeruid?"] }, + { name="ServerEdited", notify="notifyserveredited", attributes=["invokerid", "invokername", "invokeruid?", "reasonid", "virtualserver_name?", "virtualserver_nickname?", "virtualserver_codec_encryption_mode?", "virtualserver_default_server_group?", "virtualserver_default_channel_group?", "virtualserver_hostbanner_url?", "virtualserver_hostbanner_gfx_url?", "virtualserver_hostbanner_gfx_interval?", "virtualserver_priority_speaker_dimm_modificator?", "virtualserver_hostbutton_tooltip?", "virtualserver_hostbutton_url?", "virtualserver_hostbutton_gfx_url?", "virtualserver_name_phonetic?", "virtualserver_icon_id?", "virtualserver_hostbanner_mode?", "virtualserver_channel_temp_delete_delay_default?" ] }, + { name="ServerTempPasswordList", notify="notifyservertemppasswordlist", attributes=["nickname", "uid", "desc", "pw_clear", "start@tmppw", "end", "tcid", "tcpw"] }, + { name="ServerUpdated", notify="notifyserverupdated", attributes=["virtualserver_welcomemessage", "virtualserver_maxclients", "virtualserver_clientsonline", "virtualserver_channelsonline", "virtualserver_uptime", "virtualserver_hostmessage", "virtualserver_hostmessage_mode", "virtualserver_flag_password", "virtualserver_default_channel_admin_group", "virtualserver_max_download_total_bandwidth", "virtualserver_max_upload_total_bandwidth", "virtualserver_complain_autoban_count", "virtualserver_complain_autoban_time", "virtualserver_complain_remove_time", "virtualserver_min_clients_in_channel_before_forced_silence", "virtualserver_antiflood_points_tick_reduce", "virtualserver_antiflood_points_needed_command_block", "virtualserver_antiflood_points_needed_ip_block", "virtualserver_client_connections", "virtualserver_query_client_connections", "virtualserver_queryclientsonline", "virtualserver_download_quota", "virtualserver_upload_quota", "virtualserver_month_bytes_downloaded", "virtualserver_month_bytes_uploaded", "virtualserver_total_bytes_downloaded", "virtualserver_total_bytes_uploaded", "virtualserver_port", "virtualserver_autostart", "virtualserver_machine_id", "virtualserver_needed_identity_security_level", "virtualserver_log_client", "virtualserver_log_query", "virtualserver_log_channel", "virtualserver_log_permissions", "virtualserver_log_server", "virtualserver_log_filetransfer", "virtualserver_min_client_version", "virtualserver_reserved_slots", "virtualserver_total_packetloss_speech", "virtualserver_total_packetloss_keepalive", "virtualserver_total_packetloss_control", "virtualserver_total_packetloss_total", "virtualserver_total_ping", "virtualserver_weblist_enabled", "virtualserver_min_android_version", "virtualserver_min_ios_version", "virtualserver_antiflood_points_needed_plugin_block"] }, + { name="TokenUsed", notify="notifytokenused", attributes=["token", "tokencustomset", "token1", "token2", "clid", "cldbid", "cluid"] }, +] + +# Server to Client Notifications (Low) +[[msg_group]] +default = { s2c=true, c2s=false, response=false, low=true, np=false } +msg = [ + # Response to channelgetdescription + { name="ChannelEditedLow", notify="notifychanneledited", attributes=["cid", "reasonid", "channel_description?"] }, + { name="ClientPoke", notify="notifyclientpoke", attributes=["invokerid", "invokername", "invokeruid?", "msg"] }, +] + +# Server to Client Responses +[[msg_group]] +default = { s2c=true, c2s=false, response=true, low=false, np=false } +msg = [ + # ChannelCreate + { name="ChannelCreateResponse", attributes=["cid"] }, + # channelinfo + { name="ChannelInfoResponse", attributes=["pid", "channel_name", "channel_topic", "channel_description", "channel_password?", "channel_codec", "channel_codec_quality", "channel_maxclients", "channel_maxfamilyclients", "channel_order", "channel_flag_permanent", "channel_flag_semi_permanent", "channel_flag_default", "channel_flag_password", "channel_codec_latency_factor", "channel_codec_is_unencrypted", "channel_security_salt?", "channel_delete_delay", "channel_unique_identifier?", "channel_flag_maxclients_unlimited", "channel_flag_maxfamilyclients_unlimited", "channel_flag_maxfamilyclients_inherited", "channel_filepath", "channel_needed_talk_power", "channel_forced_silence", "channel_name_phonetic?", "channel_icon_id", "channel_banner_gfx_url?", "channel_banner_mode", "seconds_empty"] }, + # channellist + { name="ChannelListResponse", attributes=["cid", "pid", "channel_order", "channel_name", "total_clients", "channel_needed_subscribe_power", + "channel_topic?", # -topic + "channel_flag_default?", # -flags + "channel_flag_password?", # -flags + "channel_flag_permanent?", # -flags + "channel_flag_semi_permanent?", # -flags + "channel_codec?", # -voice + "channel_codec_quality?", # -voice + "channel_needed_talk_power?", # -voice + "total_clients_family?", # -limits + "channel_maxclients?", # -limits + "channel_maxfamilyclients?", # -limits + "channel_icon_id?", # -icon + "seconds_empty?", # -secondsempty + ] }, + # channelfind + { name="ChannelFind", attributes=["cid", "channel_name"] }, + # clientlist + { name="ClientList", attributes=["clid", "cid", "client_database_id", "client_nickname", "client_type", + "client_unique_identifier?", # -uid + "client_away?", # -away + "client_away_message?", # -away + "client_flag_talking?", # -voice + "client_input_muted?", # -voice + "client_output_muted?", # -voice + "client_input_hardware?", # -voice + "client_output_hardware?", # -voice + "client_talk_power?", # -voice + "client_is_talker?", # -voice + "client_is_priority_speaker?", # -voice + "client_is_recording?", # -voice + "client_is_channel_commander?", # -voice + "client_idle_time?", # -times + "client_created?", # -times + "client_lastconnected?", # -times + "client_servergroups?", # -groups + "client_channel_group_id?", # -groups + "client_channel_group_inherited_channel_id?", # -groups + "client_version?", # -info + "client_platform?", # -info + "client_country?", # -country + "connection_client_ip?", # -ip + "client_badges?", # - badges + ] }, + # clientdbinfo + { name="ClientDbInfo", attributes=["client_lastip", "clid", "client_unique_identifier", "cid", "client_database_id", "client_nickname", "client_type", "client_flag_avatar", "client_description", "client_icon_id", "client_created", "client_lastconnected", "client_totalconnections", "client_month_bytes_uploaded", "client_month_bytes_downloaded", "client_total_bytes_uploaded", "client_total_bytes_downloaded", "client_base64HashClientUID"] }, + # clientinfo + { name="ClientInfo", attributes=["client_idle_time", "client_version", "client_version_sign", "client_platform", "client_default_channel", "client_security_hash", "client_login_name", "client_default_token", "connection_filetransfer_bandwidth_sent", "connection_filetransfer_bandwidth_received", "connection_packets_sent_total", "connection_packets_received_total", "connection_bytes_sent_total", "connection_bytes_received_total", "connection_bandwidth_sent_last_second_total", "connection_bandwidth_received_last_second_total", "connection_bandwidth_sent_last_minute_total", "connection_bandwidth_received_last_minute_total", "connection_connected_time", "connection_client_ip", "cid", "client_unique_identifier", "client_database_id", "client_nickname", "client_type", "client_input_muted", "client_output_muted", "client_outputonly_muted", "client_input_hardware", "client_output_hardware", "client_meta_data", "client_is_recording", "client_channel_group_id", "client_channel_group_inherited_channel_id", "client_servergroups", "client_away", "client_away_message", "client_talk_power", "client_talk_request", "client_talk_request_msg", "client_is_talker", "client_is_priority_speaker", "client_unread_messages", "client_nickname_phonetic", "client_needed_serverquery_view_power", "client_is_channel_commander", "client_country", "client_badges", "client_created", "client_lastconnected", "client_totalconnections", "client_month_bytes_uploaded", "client_month_bytes_downloaded", "client_total_bytes_uploaded", "client_total_bytes_downloaded", "client_base64HashClientUID", "client_flag_avatar", "client_description", "client_icon_id", "client_myteamspeak_id?", "client_integrations?"] }, + # serverlist + { name="ServerListResponse", attributes=["virtualserver_id", "virtualserver_port", "virtualserver_status", + "virtualserver_clientsonline?", # not -short + "virtualserver_queryclientsonline?", # not -short + "virtualserver_maxclients?", # not -short + "virtualserver_uptime?", # not -short + "virtualserver_autostart?", # not -short + "virtualserver_machine_id?", # not -short + "virtualserver_name?", # not -short + "virtualserver_unique_identifier?", # -uid + ] }, + # servergroupadd + { name="ServerGroupAddResponse", attributes=["sgid"] }, + # whoami + { name="WhoAmI", attributes=["client_id", "client_channel_id", "client_nickname", "client_database_id", "client_login_name", "client_origin_server_id", "virtualserver_id", "virtualserver_unique_identifier", "virtualserver_port", "virtualserver_status", "client_unique_identifier"] }, +] + +# Server to Client Hybrid +[[msg_group]] +default = { s2c=true, c2s=false, response=true, low=false, np=false } +msg = [ + { name="BanList", notify="notifybanlist", attributes=["banid", "ip", "name", "uid", "mytsid?", "lastnickname", "created", "duration@time", "invokercldbid", "invokername", "invokeruid?", "reason", "enforcements"] }, + { name="ChannelClientPermList", notify="notifychannelclientpermlist", attributes=["cid", "cldbid", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + { name="ChannelCreated", notify="notifychannelcreated", attributes=["cid", "invokerid", "invokername", "invokeruid?", "channel_order", "channel_name", "channel_topic?", "channel_flag_default?", "channel_flag_password?", "channel_flag_permanent?", "channel_flag_semi_permanent?", "channel_codec?", "channel_codec_quality?", "channel_needed_talk_power?", "channel_icon_id?", "channel_maxclients?", "channel_maxfamilyclients?", "channel_codec_latency_factor?", "channel_codec_is_unencrypted?", "channel_delete_delay?", "channel_unique_identifier?", "channel_flag_maxclients_unlimited?", "channel_flag_maxfamilyclients_unlimited?", "channel_flag_maxfamilyclients_inherited?", "channel_name_phonetic?", "channel_storage_quota?", "cpid"] }, + { name="ChannelDeleted", notify="notifychanneldeleted", attributes=["cid", "invokerid", "invokername", "invokeruid?"] }, + # Has no invoker when we requested the description with: channelgetdescription cid=1 + { name="ChannelEdited", notify="notifychanneledited", attributes=["cid", "invokerid?", "invokername?", "invokeruid?", "reasonid", "channel_order?", "channel_name?", "channel_topic?", "channel_flag_default?", "channel_flag_password?", "channel_flag_permanent?", "channel_flag_semi_permanent?", "channel_codec?", "channel_codec_quality?", "channel_needed_talk_power?", "channel_icon_id?", "channel_maxclients?", "channel_maxfamilyclients?", "channel_codec_latency_factor?", "channel_codec_is_unencrypted?", "channel_delete_delay?", "channel_flag_maxclients_unlimited?", "channel_flag_maxfamilyclients_unlimited?", "channel_flag_maxfamilyclients_inherited?", "channel_name_phonetic?", "cpid?", "channel_description?"] }, + { name="ChannelGroupClientList", notify="notifychannelgroupclientlist", attributes=["cid", "cldbid", "cgid"] }, + { name="ChannelGroupList", notify="notifychannelgrouplist", attributes=["cgid", "name", "type@group", "iconid", "savedb", "sortid", "namemode", "n_modifyp", "n_member_addp", "n_member_removep?"] }, + { name="ChannelGroupPermList", notify="notifychannelgrouppermlist", attributes=["cgid", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + { name="ChannelPermList", notify="notifychannelpermlist", attributes=["cid", "permid", "permvalue", "permnegated", "permskip"] }, + { name="ClientDbFind", notify="notifyclientdbfind", attributes=["cldbid", "client_unique_identifier", "client_nickname", "client_lastconnected", "client_totalconnections"] }, + { name="ClientDbIdFromUid", notify="notifyclientdbidfromuid", attributes=["cluid", "cldbid"] }, + { name="ClientDbList", notify="notifyclientdblist", attributes=["cldbid", "client_unique_identifier", "client_nickname", "client_created", "client_lastconnected", "client_totalconnections", "client_description", "client_lastip"] }, + { name="ClientIds", notify="notifyclientids", attributes=["cluid", "clid", "name"] }, + { name="ClientNameFromDbId", notify="notifyclientnamefromdbid", attributes=["cluid", "cldbid", "name"] }, + { name="ClientNameFromUid", notify="notifyclientnamefromuid", attributes=["cluid", "cldbid", "name"] }, + { name="ClientUidFromClid", notify="notifyclientuidfromclid", attributes=["cluid", "clid", "nickname"] }, + { name="ClientPermList", notify="notifyclientpermlist", attributes=["cldbid", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + { name="ClientSetServerQueryLogin", notify="notifyclientserverqueryloginpassword", attributes=["client_login_password"] }, + { name="ComplainList", notify="notifycomplainlist", attributes=["tcldbid", "tname", "fcldbid", "fname", "message", "timestamp"] }, + { name="FileDownload", notify="notifystartdownload", attributes=["clientftfid", "serverftfid", "ftkey", "port", "size", "proto", "ip?"] }, + { name="FileInfo", notify="notifyfileinfo", attributes=["cid", "path", "name", "size", "datetime"] }, + { name="FileList", notify="notifyfilelist", attributes=["cid", "path", "name", "size", "datetime", "type@ft"] }, + { name="Filetransfer", notify="notifyfiletransferlist", attributes=["clid", "path", "name", "size", "sizedone", "clientftfid", "serverftfid", "sender", "status@ft", "current_speed", "average_speed", "runtime"] }, + { name="FileUpload", notify="notifystartupload", attributes=["clientftfid", "serverftfid", "ftkey", "port", "seekpos", "proto", "ip?"] }, + { name="OfflineMessage", notify="notifymessage", attributes=["msgid", "cluid", "subject", "message", "timestamp"] }, + { name="OfflineMessageList", notify="notifymessagelist", attributes=["msgid", "cluid", "subject", "timestamp", "flag_read"] }, + { name="PermFind", notify="notifypermfind", attributes=["t", "id1", "id2", "p"] }, + { name="PermList", notify="notifypermissionlist", attributes=["group_id_end", "permid?", "permname?", "permdesc?"] }, # Note: very weird ordering + { name="PermOverview", notify="notifypermoverview", attributes=["cldbid", "cid", "t", "id1", "id2", "p", "v", "n", "s"] }, + { name="ServerConnectionInfo", notify="notifyserverconnectioninfo", attributes=["connection_filetransfer_bandwidth_sent", "connection_filetransfer_bandwidth_received", "connection_filetransfer_bytes_sent_total", "connection_filetransfer_bytes_received_total", "connection_packets_sent_total", "connection_bytes_sent_total", "connection_packets_received_total", "connection_bytes_received_total", "connection_bandwidth_sent_last_second_total", "connection_bandwidth_sent_last_minute_total", "connection_bandwidth_received_last_second_total", "connection_bandwidth_received_last_minute_total", "connection_connected_time@server", "connection_packetloss_total", "connection_ping"] }, + { name="ServerGroupClientList", notify="notifyservergroupclientlist", attributes=["sgid", "cldbid", "client_nickname?", "client_unique_identifier?"] }, + { name="ServerGroupList", notify="notifyservergrouplist", attributes=["sgid", "name", "type@group", "iconid", "savedb", "sortid", "namemode", "n_modifyp", "n_member_addp", "n_member_removep?"] }, + { name="ServerGroupPermList", notify="notifyservergrouppermlist", attributes=["sgid", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + { name="ServerGroupsByClientId", notify="notifyservergroupsbyclientid", attributes=["name", "sgid", "cldbid"] }, + { name="ServerLog", notify="notifyserverlog", attributes=["last_pos", "file_size", "log"] }, + { name="TextMessage", notify="notifytextmessage", attributes=["targetmode@msg", "msg", "target@msg?", "invokerid", "invokername", "invokeruid?", "timestamp?"] }, + { name="TokenAdd", notify="notifytokenadd", attributes=["token"] }, + { name="TokenList", notify="notifytokenlist", attributes=["token", "token_type", "token_id1", "token_id2", "token_created", "token_description"] }, +] + +# Client to Server Notifications +[[msg_group]] +default = { s2c=false, c2s=true, response=false, low=false, np=false } +msg = [ + { name="ClientInit", notify="clientinit", attributes=["client_nickname", "client_version", "client_platform", "client_input_hardware", "client_output_hardware", "client_input_muted?", "client_output_muted?", "client_away?", "client_away_message?", "client_default_channel", "client_default_channel_password", "client_server_password", "client_meta_data", "client_version_sign", "client_key_offset", "client_nickname_phonetic", "client_default_token", "hwid", "client_badges?", "client_security_hash?", "client_myteamspeak_id?", "client_integrations?", "client_active_integrations_info?", "client_myteamspeak_avatar?", "client_signed_badges?" ] }, + { name="ClientInitIv", notify="clientinitiv", attributes=["alpha", "omega", "ot?", "ip"] }, + { name="PluginCommandRequest", notify="plugincmd", attributes=["name", "data", "targetmode@plugin", "target@plugin?"] }, + # banadd ip=42\\.42\\.42\\.42 name=test uid=b+P0CqXms5I0C+A66HZ4Sbu\/PNw= time=5 banreason=test + # -> void + { name="BanAdd", notify="banadd", attributes=["ip?", "name?", "uid?", "time?", "banreason?"] }, + # banclient uid=Np\/KHoMinRjzz54VORp6Ks\/3b3c= time=1 banreason=this\sperson + # -> void + { name="BanClient", notify="banclient", attributes=["clid", "time?", "banreason?"] }, + # bandel banid=4 + # bandel banid=1 return_code=1:21 return_code=__1:21_1:21 + # error id=0 msg=ok return_code=1:21 + # -> void + { name="BanDel", notify="bandel", attributes=["banid"] }, + # bandelall + # -> void + { name="BanDelAll", notify="bandelall", attributes=[] }, + # banlist return_code=1:5 + # -> {BanList} notifybanlist banid=3 ip=42\\.42\\.42\\.42 name=test uid=b+P0CqXms5I0C+A66HZ4Sbu\/PNw= lastnickname=AudioBud created=1538835372 duration=5 invokername=Splamy invokercldbid=2 invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= reason=test enforcements=0 + { name="BanListRequest", notify="banlist", attributes=[] }, + # [NOT FULL] + { name="BindingList", notify="bindinglist", attributes=["subsystem?"] }, + # channeladdperm cid=1 permid=78 permvalue=75 + # -> void + { name="ChannelAddPerm", notify="channeladdperm", attributes=["cid", "permid?", "permsid?", "permvalue"] }, + # channelclientaddperm cid=1 cldbid=2 permid=183 permvalue=1 + # -> void + { name="ChannelClientAddPerm", notify="channelclientaddperm", attributes=["cid", "cldbid", "permid?", "permsid?", "permvalue"] }, + # channelclientdelperm cid=1 cldbid=2 permid=185 + # -> void + { name="ChannelClientDelPerm", notify="channelclientdelperm", attributes=["cid", "cldbid", "permid?", "permsid?"] }, + # channelclientpermlist cid=1 cldbid=2 + # -> {ChannelClientPermList} notifychannelclientpermlist cid=1 cldbid=2 permid=183 permvalue=1 permnegated=0 permskip=0 + { name="ChannelClientPermListRequest", notify="channelclientpermlist", attributes=["cid", "cldbid"] }, # -permsid + # channelcreate cpid=0 channel_name=testcreate channel_codec_quality=6 channel_flag_permanent=1 channel_codec_is_unencrypted=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 + # -> {ChannelCreated} notifychannelcreated cid=2 cpid=0 channel_name=testcreate channel_codec_quality=6 channel_order=1 channel_flag_permanent=1 channel_codec_is_unencrypted=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 invokerid=3 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + { name="ChannelCreate", notify="channelcreate", attributes=["cpid?", "channel_name", "channel_topic?", "channel_description?", "channel_password?", "channel_codec?", "channel_codec_quality?", "channel_maxclients?", "channel_maxfamilyclients?", "channel_order?", "channel_flag_password?", "channel_codec_is_unencrypted?", "channel_delete_delay?", "channel_flag_maxclients_unlimited?", "channel_flag_maxfamilyclients_unlimited?", "channel_flag_maxfamilyclients_inherited?", "channel_name_phonetic?", "channel_flag_permanent?", "channel_flag_semi_permanent?", "channel_flag_default?"] }, + # channeldelete cid=2 + # -> {ChannelDeleted} notifychanneldeleted invokerid=3 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + { name="ChannelDelete", notify="channeldelete", attributes=["cid", "force"] }, + # channeldelperm cid=1 permid=78 + # -> void + { name="ChannelDelPerm", notify="channeldelperm", attributes=["cid", "permid?", "permsid?"] }, + # channelgetdescription cid=1 + # -> {ChannelEditedLow} notifychanneledited cid=1 channel_description=blub + { name="ChannelDescriptionRequest", notify="channelgetdescription", attributes=["cid"] }, + # channeledit cid=2 channel_codec=5 + # -> void + { name="ChannelEdit", notify="channeledit", attributes=["cid", "channel_order?", "channel_name?", "channel_topic?", "channel_flag_default?", "channel_flag_password?", "channel_password?", "channel_flag_permanent?", "channel_flag_semi_permanent?", "channel_codec?", "channel_codec_quality?", "channel_needed_talk_power?", "channel_maxclients?", "channel_maxfamilyclients?", "channel_codec_latency_factor?", "channel_codec_is_unencrypted?", "channel_delete_delay?", "channel_flag_maxclients_unlimited?", "channel_flag_maxfamilyclients_unlimited?", "channel_flag_maxfamilyclients_inherited?", "channel_name_phonetic?", "channel_description?"] }, + # channelfind pattern=Def + # -> {ChannelFind} cid=1 channel_name=Default\sChannel|cid=3 channel_name=Default + { name="ChannelFindRequest", notify="channelfind", attributes=["pattern"] }, + # channelgroupadd name=TestGroup type=1 + # -> {ChannelGroupList} notifychannelgrouplist cgid=1 name=Channel\sAdmin type=0 iconid=100 savedb=1 sortid=0 namemode=0 n_modifyp=75 n_member_addp=50 n_member_removep=50|cgid=2 name=Operator type=0 iconid=200 savedb=1 sortid=0 namemode=0 n_modifyp=75 n_member_addp=30 n_member_removep=30|... + { name="ChannelGroupAdd", notify="channelgroupadd", attributes=["name", "type@group?"] }, + # channelgroupaddperm cgid=9 permid=146 permvalue=1 + # -> void + { name="ChannelGroupAddPerm", notify="channelgroupaddperm", attributes=["cgid", "permid?", "permsid?", "permvalue"] }, + # channelgroupclientlist cid=1 cgid=9 cldbid=0 + # -> {ChannelGroupClientList} notifychannelgroupclientlist cid=1 cldbid=2 cgid=9 + { name="ChannelGroupClientListRequest", notify="channelgroupclientlist", attributes=["cid?", "cldbid?", "cgid?"] }, + # channelgroupcopy name=TestGroup2\s(Copy) scgid=9 tcgid=0 + # -> {ChannelGroupList} notifychannelgrouplist ... + { name="ChannelGroupCopy", notify="channelgroupcopy", attributes=["scgid", "tcgid", "name", "type@group"] }, + # channelgroupdel cgid=10 force=0 + # -> {ChannelGroupList} notifychannelgrouplist ... + { name="ChannelGroupDel", notify="channelgroupdel", attributes=["cgid", "force"] }, + # channelgroupdelperm cgid=10 permid=146 + # -> void + { name="ChannelGroupDelPerm", notify="channelgroupdelperm", attributes=["cgid", "permid?", "permsid?"] }, + # channelgrouplist + # -> {ChannelGroupList} notifychannelgrouplist ... + { name="ChannelGroupListRequest", notify="channelgrouplist", attributes=[] }, + # channelgrouppermlist cgid=9 + # -> {ChannelGroupPermList} notifychannelgrouppermlist cgid=9 permid=164 permvalue=75 permnegated=0 permskip=0|permid=166 permvalue=75 permnegated=0 permskip=0|permid=168 permvalue=75 permnegated=0 permskip=0 + { name="ChannelGroupPermListRequest", notify="channelgrouppermlist", attributes=["cgid"] }, # -permsid + # channelgrouprename cgid=9 name=TestGroup2 + # -> {ChannelGroupList} notifychannelgrouplist ... + { name="ChannelGroupRename", notify="channelgrouprename", attributes=["cgid", "name"] }, + # channelinfo cid=3 + # -> {ChannelInfoResponse} pid=0 channel_name=Default channel_topic channel_description channel_password channel_codec=4 channel_codec_quality=6 channel_maxclients=-1 channel_maxfamilyclients=-1 channel_order=1 channel_flag_permanent=0 channel_flag_semi_permanent=0 channel_flag_default=0 channel_flag_password=0 channel_codec_latency_factor=1 channel_codec_is_unencrypted=1 channel_security_salt channel_delete_delay=0 channel_flag_maxclients_unlimited=1 channel_flag_maxfamilyclients_unlimited=0 channel_flag_maxfamilyclients_inherited=1 channel_filepath=files\\virtualserver_1\\channel_3 channel_needed_talk_power=0 channel_forced_silence=0 channel_name_phonetic channel_icon_id=0 channel_flag_private=0 seconds_empty=-1 + { name="ChannelInfoRequest", notify="channelinfo", attributes=["cid"] }, + # channellist + # -> cid=1 pid=0 channel_order=0 channel_name=Default\sChannel total_clients=0 channel_needed_subscribe_power=0|cid=3 pid=0 channel_order=1 channel_name=Default total_clients=1 channel_needed_subscribe_power=0 + { name="ChannelListRequest", notify="channellist", attributes=[] }, # [-topic] [-flags] [-voice] [-limits] [-icon] [-secondsempty] + # channelmove cid=3 cpid=1 + # -> {ChannelMoved} notifychannelmoved cid=3 cpid=1 order=0 reasonid=1 invokerid=3 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + { name="ChannelMove", notify="channelmove", attributes=["cid", "cpid", "order?"] }, + # channelpermlist cid=3 + # -> {ChannelPermList} notifychannelpermlist cid=3 permid=82 permvalue=75 permnegated=0 permskip=0|permid=132 permvalue=75 permnegated=0 permskip=0 + { name="ChannelPermListRequest", notify="channelpermlist", attributes=["cid"] }, # -permsid + # channelsubscribe cid=8 + # -> {ChannelSubscribed} notifychannelsubscribed cid=8 es=31020 + { name="ChannelSubscribe", notify="channelsubscribe", attributes=["cid"] }, + # channelsubscribeall + # -> {ChannelSubscribed} notifychannelsubscribed cid=5 es=30852|cid=6 es=30852|cid=8 es=30852 + { name="ChannelSubscribeAll", notify="channelsubscribeall", attributes=[] }, + # channelunsubscribe cid=8 + # -> {ChannelUnsubscribed} notifychannelunsubscribed cid=8 + { name="ChannelUnsubscribe", notify="channelunsubscribe", attributes=["cid"] }, + # channelunsubscribeall + # -> {ChannelUnsubscribed} notifychannelunsubscribed cid=5|cid=6|cid=8 + { name="ChannelUnsubscribeAll", notify="channelunsubscribeall", attributes=[] }, + # clientaddperm cldbid=2 permid=177 permvalue=75 permskip=0 + # -> {ClientNeededPermissions} notifyclientneededpermissions permid=177 permvalue=75 + { name="ClientAddPerm", notify="clientaddperm", attributes=["cldbid", "permid?", "permsid?", "permvalue", "permskip"] }, + # clientchatclosed clid=3 cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + # -> void + { name="ClientChatClose", notify="clientchatclosed", attributes=["clid", "cluid"] }, + # getconnectioninfo clid=1 + # -> notifyconnectioninfo clid=1 connection_client_ip=[::1] connection_client_port=58283 connection_client2server_packetloss_speech=0.0000 connection_client2server_packetloss_keepalive=0.0000 connection_client2server_packetloss_control=0.0000 connection_client2server_packetloss_total=0.0000 connection_idle_time=195951 + { name="ClientConnectionInfoRequest", notify="getconnectioninfo", attributes=["clid"] }, + # clientdbdelete cldbid=10 + # -> void + { name="ClientDbDelete", notify="clientdbdelete", attributes=["cldbid"] }, + # TODO !!! + { name="ClientDbEdit", notify="clientdbedit", attributes=["cldbid"] }, # TODO PROPERTIES ! + # clientdbfind pattern=%spl% -details + # clientdbfind pattern=%myuid% -uid -details return_code=1:z + # -> {ClientDbFind} notifyclientdbfind cldbid=2 client_unique_identifier=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= client_nickname=Splamy client_lastconnected=1539260951 client_totalconnections=20 + { name="ClientDbFindRequest", notify="clientdbfind", attributes=["pattern"] }, # -uid, -details || the -details is undocumentd but works in both query/full + # clientdbinfo cldbid=2 + # -> client_unique_identifier=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= client_nickname=Splamy client_database_id=2 client_created=1537603744 client_lastconnected=1539260951 client_totalconnections=20 client_flag_avatar client_description client_month_bytes_uploaded=0 client_month_bytes_downloaded=131916 client_total_bytes_uploaded=0 client_total_bytes_downloaded=144480 client_base64HashClientUID=lianbeoonoapahbhejofdcohgkllaobnaihipong client_lastip=::1 + { name="ClientDbInfoRequest", notify="clientdbinfo", attributes=["cldbid"] }, + # clientdblist start=0 duration=10 + # -> {ClientDbList} notifyclientdblist cldbid=2 client_unique_identifier=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= client_nickname=Splamy client_created=1537603744 client_lastconnected=1539260951 client_totalconnections=20 client_description client_lastip=::1 | ... + { name="ClientDbListRequest", notify="clientdblist", attributes=["start@list?", "duration@list?"] }, # -count + # clientdelperm cldbid=2 permid=177 + # -> {ClientNeededPermissions} notifyclientneededpermissions permid=177 + { name="ClientDelPerm", notify="clientdelperm", attributes=["cldbid", "permid?", "permsid?"] }, + # clientedit clid=2 client_description=desc client_is_talker=1 + { name="ClientEdit", notify="clientedit", attributes=["clid", "client_description?", "client_is_talker?"] }, + # clientfind pattern=Spla + # -> clid=1 client_nickname=Splamy + { name="ClientFindRequest", notify="clientfind", attributes=["pattern"] }, + # clientgetdbidfromuid cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + # -> {ClientDbIdFromUid} notifyclientdbidfromuid cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= cldbid=2 + { name="ClientDbIdFromUidRequest", notify="clientgetdbidfromuid", attributes=["cluid"] }, + # clientgetids cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + # -> {ClientIds} notifyclientids cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= clid=1 + { name="ClientIdsRequest", notify="clientgetids", attributes=["cluid"] }, + # clientgetnamefromdbid cldbid=2 + # -> {ClientNameFromDbId} notifyclientnamefromdbid cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= cldbid=2 name=Splamy + { name="ClientNameFromDbIdRequest", notify="clientgetnamefromdbid", attributes=["cldbid"] }, + # clientgetnamefromuid cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + # -> {ClientNameFromUid} notifyclientnamefromuid cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= cldbid=2 name=Splamy + { name="ClientNameFromUidRequest", notify="clientgetnamefromuid", attributes=["cluid"] }, + # clientgetuidfromclid clid=1 + # -> {ClientUidFromClid} notifyclientuidfromclid clid=1 cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= nickname=Splamy + { name="ClientUidFromClidRequest", notify="clientgetuidfromclid", attributes=["clid"] }, + # clientgetvariables clid=2 + # -> {ClientUpdated} notifyclientupdated clid=2 client_version=3.2.3\s[Build:\s1538467030] client_platform=Windows client_login_name client_created=1538835269 client_lastconnected=1539267929 client_totalconnections=3 client_month_bytes_uploaded=0 client_month_bytes_downloaded=0 client_total_bytes_uploaded=0 client_total_bytes_downloaded=0 + { name="ClientVariablesRequest", notify="clientgetvariables", attributes=["clid"] }, + # clientinfo clid=1 + # -> {ClientInfo?} cid=4 client_idle_time=432921 client_unique_identifier=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= client_nickname=Splamy client_version=3.2.3\s[Build:\s1538467030] client_platform=Windows client_input_muted=0 client_output_muted=0 client_outputonly_muted=0 client_input_hardware=0 client_output_hardware=1 client_default_channel=\/3 client_meta_data client_is_recording=0 client_version_sign=dZ1i\/CsCaAh4F7Pi2F\/FfaBpdTmUuNVsAIRnqm86FUR3HhwBRn+xlmbwRF8gObgFMuwFMCLmawncFWplSILKAQ== client_security_hash client_login_name client_database_id=2 client_channel_group_id=5 client_servergroups=6 client_created=1537603744 client_lastconnected=1539260951 client_totalconnections=20 client_away=0 client_away_message client_type=0 client_flag_avatar client_talk_power=75 client_talk_request=0 client_talk_request_msg client_description client_is_talker=0 client_month_bytes_uploaded=0 client_month_bytes_downloaded=131916 client_total_bytes_uploaded=0 client_total_bytes_downloaded=144480 client_is_priority_speaker=0 client_unread_messages=0 client_nickname_phonetic client_needed_serverquery_view_power=75 client_default_token client_icon_id=0 client_is_channel_commander=0 client_country client_channel_group_inherited_channel_id=4 client_badges=overwolf=0 client_myteamspeak_id client_integrations client_base64HashClientUID=lianbeoonoapahbhejofdcohgkllaobnaihipong connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_packets_sent_total=14972 connection_bytes_sent_total=634932 connection_packets_received_total=19657 connection_bytes_received_total=1176471 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=81 connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=87 connection_connected_time=7411717 connection_client_ip=[::1] + { name="ClientInfoRequest", notify="clientinfo", attributes=["clid"] }, + # clientkick reasonid=4 reasonmsg=yo clid=3 + # -> {ClientMoved} notifyclientmoved ctid=1 reasonid=4 invokerid=1 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= reasonmsg=yo clid=3 + { name="ClientKick", notify="clientkick", attributes=["clid", "reasonid", "reasonmsg?"] }, + # clientlist + # clid=1 cid=4 client_database_id=2 client_nickname=Splamy client_type=0 | ... + { name="ClientListRequest", notify="clientlist", attributes=[] }, # [-uid] [-away] [-voice] [-times] [-groups] [-info] [-country] [-ip] [-badges] + # clientmove cid=4 cpw clid=2 + # -> {ClientMoved} notifyclientmoved ctid=4 reasonid=1 invokerid=1 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= clid=3 + { name="ClientMove", notify="clientmove", attributes=["clid", "cid", "cpw?"] }, + # clientpermlist cldbid=2 + # -> {ClientPermList} notifyclientpermlist cldbid=2 permid=177 permvalue=75 permnegated=0 permskip=0 + { name="ClientPermListRequest", notify="clientpermlist", attributes=["cldbid"] }, # -permsid + # clientpoke clid=3 msg=hi + # -> void + { name="ClientPokeRequest", notify="clientpoke", attributes=["clid", "msg"] }, + # clientsetserverquerylogin cldbid=2 client_login_name=hax client_login_password + # -> {ClientSetServerQueryLogin} notifyclientserverqueryloginpassword client_login_password=qm2niw4m + { name="ClientSetServerQueryLoginRequest", notify="clientsetserverquerylogin", attributes=["client_login_name", "client_login_password?", "cldbid?"] }, # 'client_login_password' is always ignored, 'cldbid' only exists for full client(?) + # clientupdate client_nickname=Seebi1 client_input_muted=1 client_away=1 client_away_message=AFK return_code=__1_ + { name="ClientUpdate", notify="clientupdate", attributes=["client_nickname?", "client_input_muted?", "client_output_muted?", "client_away?", "client_away_message?", "client_input_hardware?", "client_output_hardware?", "client_is_channel_commander?", "client_flag_avatar?", "client_nickname_phonetic?", "client_talk_request@clientupdate?", "client_talk_request_msg?", "client_is_recording?", "client_badges?"] }, + # complainadd tcldbid=7 message=annoying + # -> void + { name="ComplainAdd", notify="complainadd", attributes=["tcldbid", "message"] }, + # complaindel tcldbid=7 fcldbid=2 + # -> void + { name="ComplainDel", notify="complaindel", attributes=["tcldbid", "fcldbid"] }, + # complaindelall tcldbid=7 + # -> void + { name="ComplainDelAll", notify="complaindelall", attributes=["tcldbid"] }, + # complainlist tcldbid=0 + # -> {ComplainList} notifycomplainlist tcldbid=7 tname=Test01 fcldbid=2 fname=Splamy message=annoying timestamp=1539269750 + { name="ComplainListRequest", notify="complainlist", attributes=["tcldbid?"] }, + # customdelete ident=s cldbid=2 + # -> void + { name="CustomDelete", notify="customdelete", attributes=["cldbid", "ident"] }, + # custominfo cldbid=2 + # cldbid=2 ident=s value=1234 + { name="CustomInfoRequest", notify="custominfo", attributes=["cldbid"] }, + # customsearch ident=s pattern=%1% + # -> cldbid=2 ident=s value=1234 + { name="CustomSearch", notify="customsearch", attributes=["ident", "pattern"] }, + # customset cldbid=2 ident=s value=1234 + # -> void + { name="CustomSet", notify="customset", attributes=["cldbid", "ident", "value"] }, + # ftcreatedir cid=4 cpw dirname=\/test + # -> void + { name="CreateDirectory", notify="ftcreatedir", attributes=["cid", "cpw", "dirname"] }, + # ftdeletefile cid=4 cpw name=\/Doxyfile2 + # -> void + { name="DeleteFile", notify="ftdeletefile", attributes=["cid", "cpw", "name"] }, + # ftgetfileinfo cid=7 name=\/Egg.ogg cpw + # -> {FileInfo} notifyfileinfo cid=7 name=\/Egg.ogg size=6009201 datetime=1523479202 + { name="FileInfoRequest", notify="ftgetfileinfo", attributes=["cid", "cpw", "name"] }, + # ftgetfilelist cid=4 cpw path=\/ + # -> {FileList} notifyfilelist cid=4 path=\/ return_code=1:15 name=Doxyfile size=11984 datetime=1539276009 type=1 + # -> {FileListFinished} notifyfilelistfinished cid=4 path=\/ + { name="FileListRequest", notify="ftgetfilelist", attributes=["cid", "cpw", "path"] }, + # ftinitdownload clientftfid=4096 name=\/Doxyfile2 cid=4 cpw seekpos=0 proto=1 + # -> {FileDownload} notifystartdownload clientftfid=4096 serverftfid=1 ftkey=YkmvbK7ibKPJPTRONaY68j3S\/fjx7dkO port=30033 size=11984 proto=1 + { name="InitDownload", notify="ftinitdownload", attributes=["clientftfid", "name", "cid", "cpw", "seekpos", "proto"] }, + # ftinitupload clientftfid=4096 name=\/Doxyfile size=11984 cid=4 cpw overwrite=0 resume=0 proto=1 + # -> {FileUpload} notifystartupload clientftfid=4096 serverftfid=1 ftkey=U2VNc4+cRZdCKMdR6JECqfz8Ix1L40SM port=30033 seekpos=0 proto=1 + { name="InitUpload", notify="ftinitupload", attributes=["clientftfid", "name", "cid", "cpw", "size", "overwrite", "resume", "proto"] }, + # ftlist + # -> {Filetransfer} notifyfiletransferlist clid=1 path=files\\virtualserver_1\\channel_4 name=Win10_1709_German_x64_Pro.iso size=3825467392 sizedone=1324744704 clientftfid=4096 serverftfid=1 sender=0 status=1 current_speed=101380912.0000 average_speed=98684800.0000 runtime=13 + { name="ListFiletransfers", notify="ftlist", attributes=[] }, + # ftrenamefile cid=4 cpw tcid=4 tcpw oldname=\/Doxyfile newname=\/Doxyfile2 + # -> void + { name="RenameFile", notify="ftrenamefile", attributes=["cid", "cpw", "tcid?", "tcpw?", "oldname", "newname"] }, + # ftstop serverftfid=1 clientftfid=4096 delete=1 + # -> {FiletransferStatus} notifystatusfiletransfer clientftfid=4096 status=2066 msg=file\stransfer\scanceled size=1736753152 + { name="StopFiletransfer", notify="ftstop", attributes=["serverftfid", "delete"] }, + # gm msg=test + # -> {TextMessage} notifytextmessage targetmode=3 msg=test invokerid=0 invokername=Server + { name="GlobalMessage", notify="gm", attributes=["msg"] }, + # hostinfo + # -> instance_uptime=2654 host_timestamp_utc=1539341335 virtualservers_running_total=1 virtualservers_total_maxclients=32 virtualservers_total_clients_online=1 virtualservers_total_channels_online=1 connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_total=3753 connection_bytes_sent_total=188803 connection_packets_received_total=3755 connection_bytes_received_total=167844 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=81 connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=87 + { name="HostInfoRequest", notify="hostinfo", attributes=[] }, + # TODO !!! + { name="InstanceEdit", notify="instanceedit", attributes=[] }, # TODO PROPERTIES ! + # instanceinfo + # -> serverinstance_database_version=29 serverinstance_filetransfer_port=30033 serverinstance_max_download_total_bandwidth=18446744073709551615 serverinstance_max_upload_total_bandwidth=18446744073709551615 serverinstance_guest_serverquery_group=1 serverinstance_serverquery_flood_commands=10 serverinstance_serverquery_flood_time=3 serverinstance_serverquery_ban_time=600 serverinstance_template_serveradmin_group=3 serverinstance_template_serverdefault_group=5 serverinstance_template_channeladmin_group=1 serverinstance_template_channeldefault_group=4 serverinstance_permissions_version=21 serverinstance_pending_connections_per_ip=0 + { name="InstanceInfo", notify="instanceinfo", attributes=[] }, + # logadd loglevel=1 logmsg=test + # -> void + { name="LogAdd", notify="logadd", attributes=["loglevel", "logmsg"] }, + # login $ + # -> void + { name="Login", notify="login", attributes=["client_login_name", "client_login_password"] }, + # logout + # -> void + { name="Logout", notify="logout", attributes=[] }, + # logview lines=100 begin_pos=0 reverse=1 instance=0 + # -> {ServerLog} notifyserverlog last_pos=0 file_size=9148 l=2018-10-12\s10:52:30.795253\pERROR\s\s\s\pCustom\s\s\s\s\s\s\s\s\p1\s\s\ptest|l=2018-10-12\s10:48:55.130491\pINFO\s\s\s\s\pVirtualServerBase\p1\s\s\pquery\sclient\sdisconnected\s'serveradmin\sfrom\s127.0.0.1:51093'(id:1)\sreason\s'reasonmsg=connection\slost'| ... + { name="LogView", notify="logview", attributes=["lines?", "reverse?", "instance?", "begin_pos?"] }, + # messageadd cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= subject=hrad message=ms + # -> void + { name="OfflineMessageAdd", notify="messageadd", attributes=["cluid", "subject", "message"] }, + # messagedel msgid=1 + # -> {ClientUpdated} notifyclientupdated clid=4 client_unread_messages=0 + { name="OfflineMessageDel", notify="messagedel", attributes=["msgid"] }, + # messageget msgid=1 + # -> {OfflineMessage} notifymessage msgid=1 cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= subject=hrad message=ms timestamp=1539341886 + { name="OfflineMessageGet", notify="messageget", attributes=["msgid"] }, + # messagelist + # -> {OfflineMessageList} notifymessagelist msgid=1 cluid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= subject=hrad timestamp=1539341886 flag_read=0 + { name="OfflineMessageListRequest", notify="messagelist", attributes=[] }, + # messageupdateflag msgid=1 flag=1 + # -> {ClientUpdated} notifyclientupdated clid=4 client_unread_messages=0 + { name="OfflineMessageUpdateFlag", notify="messageupdateflag", attributes=["msgid", "flag"] }, + # permfind permid=1 + # -> {PermFind} notifypermfind t=0 id1=6 id2=0 p=1 + { name="PermFindRequest", notify="permfind", attributes=["permid?", "permsid?"] }, + # permget permid=1 + # -> permsid=b_serverinstance_help_view permid=1 permvalue=1 + { name="PermRequest", notify="permget", attributes=["permid"] }, + # permidgetbyname permsid=b_serverinstance_permission_list + # -> permsid=b_serverinstance_permission_list permid=6 + { name="PermIdByNameRequest", notify="permidgetbyname", attributes=["permsid"] }, + # permissionlist + # -> {PermList} notifypermissionlist group_id_end=0|group_id_end=7|group_id_end=13|group_id_end=18|group_id_end=21|group_id_end=21|group_id_end=33|group_id_end=47|group_id_end=77|group_id_end=82|group_id_end=83|group_id_end=106|group_id_end=126|group_id_end=132|group_id_end=143|group_id_end=151|group_id_end=160|group_id_end=162|group_id_end=170|group_id_end=172|group_id_end=190|group_id_end=197|group_id_end=215|group_id_end=227|group_id_end=232|group_id_end=248|permname=b_serverinstance_help_view permdesc=Retrieve\sinformation\sabout\sServerQuery\scommands|permname=b_serverinstance_version_view permdesc=Retrieve\sglobal\sserver\sversion\s(including\splatform\sand\sbuild\snumber)|permname=b_serverinstance_info_view permdesc=Retrieve\sglobal\sserver\sinformation|permname=b_serverinstance_virtualserver_list permdesc=List\svirtual\sservers\sstored\sin\sthe\sdatabase|... + { name="PermListRequest", notify="permissionlist", attributes=[] }, + # permoverview cid=1 cldbid=2 permid=1 + # -> {PermOverview} notifypermoverview cldbid=2 cid=1 t=0 id1=6 id2=0 p=1 v=1 n=0 s=0 + { name="PermOverviewRequest", notify="permoverview", attributes=["cid", "cldbid", "permid?", "permsid?"] }, + # TODO + { name="PermReset", notify="permreset", attributes=[] }, + # {TokenAddRequest} + # -> (same) + { name="PrivilegeKeyAddRequest", notify="privilegekeyadd", attributes=["tokentype", "tokenid1", "tokenid2", "tokendescription?", "tokencustomset?"] }, + # {TokenDelete} + # -> (same) + { name="PrivilegeKeyDelete", notify="privilegekeydelete", attributes=["token"] }, + # {TokenListRequest} + # -> (same) + { name="PrivilegeKeyListRequest", notify="privilegekeylist", attributes=[] }, + # {TokenUse} + # -> (same) + { name="PrivilegeKeyUse", notify="privilegekeyuse", attributes=["token"] }, + # quit $ + # -> void + { name="Quit", notify="quit", attributes=[] }, + # sendtextmessage targetmode=2 msg=hi + # -> {TextMessage} notifytextmessage targetmode=2 msg=hi invokerid=4 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= + { name="SendTextMessage", notify="sendtextmessage", attributes=["targetmode@msg", "target@msg?", "msg"] }, + # TODO + { name="ServerCreate", notify="servercreate", attributes=["virtualserver_name"] }, # TODO PROPERTIES ! + # TODO + { name="ServerDelete", notify="serverdelete", attributes=["sid"] }, + # virtualserver_password is sent two times in this message by the official client + { name="ServerEdit", notify="serveredit", attributes=["sid?", "virtualserver_name?", "virtualserver_welcomemessage?", "virtualserver_maxclients?", "virtualserver_password?", "virtualserver_hostmessage?", "virtualserver_hostmessage_mode?", "virtualserver_hostbanner_url?", "virtualserver_hostbanner_gfx_url?", "virtualserver_hostbanner_gfx_interval?", "virtualserver_hostbutton_tooltip?", "virtualserver_hostbutton_url?", "virtualserver_hostbutton_gfx_url?", "virtualserver_icon_id?", "virtualserver_reserved_slots?", "virtualserver_hostbanner_mode?", "virtualserver_nickname?", "virtualserver_max_download_total_bandwidth?", "virtualserver_max_upload_total_bandwidth?", "virtualserver_download_quota?", "virtualserver_upload_quota?", "virtualserver_antiflood_points_tick_reduce?", "virtualserver_antiflood_points_needed_command_block?", "virtualserver_antiflood_points_needed_ip_block?", "virtualserver_codec_encryption_mode?", "virtualserver_needed_identity_security_level?", "virtualserver_default_server_group?", "virtualserver_default_channel_group?", "virtualserver_default_channel_admin_group?", "virtualserver_complain_autoban_count?", "virtualserver_complain_autoban_time?", "virtualserver_complain_remove_time?", "virtualserver_min_clients_in_channel_before_forced_silence?", "virtualserver_priority_speaker_dimm_modificator?", "virtualserver_name_phonetic?", "virtualserver_channel_temp_delete_delay_default?", "virtualserver_weblist_enabled?", "virtualserver_log_client?", "virtualserver_log_query?", "virtualserver_log_channel?", "virtualserver_log_permissions?", "virtualserver_log_server?", "virtualserver_log_filetransfer?"] }, + # servergetvariables + # -> {ServerUpdated} notifyserverupdated virtualserver_welcomemessage=Welcome\sto\sTeamSpeak,\scheck\s[URL]www.teamspeak.com[\/URL]\sfor\slatest\sinformation virtualserver_maxclients=32 virtualserver_clientsonline=2 virtualserver_channelsonline=1 virtualserver_uptime=1523 virtualserver_hostmessage virtualserver_hostmessage_mode=0 virtualserver_flag_password=0 virtualserver_default_channel_admin_group=5 virtualserver_max_download_total_bandwidth=18446744073709551615 virtualserver_max_upload_total_bandwidth=18446744073709551615 virtualserver_complain_autoban_count=5 virtualserver_complain_autoban_time=1200 virtualserver_complain_remove_time=3600 virtualserver_min_clients_in_channel_before_forced_silence=100 virtualserver_antiflood_points_tick_reduce=5 virtualserver_antiflood_points_needed_command_block=150 virtualserver_antiflood_points_needed_ip_block=250 virtualserver_client_connections=1 virtualserver_query_client_connections=1 virtualserver_queryclientsonline=1 virtualserver_download_quota=18446744073709551615 virtualserver_upload_quota=18446744073709551615 virtualserver_month_bytes_downloaded=143900 virtualserver_month_bytes_uploaded=1737584828 virtualserver_total_bytes_downloaded=156464 virtualserver_total_bytes_uploaded=1737647648 virtualserver_port=9987 virtualserver_autostart=1 virtualserver_machine_id virtualserver_needed_identity_security_level=8 virtualserver_log_client=1 virtualserver_log_query=1 virtualserver_log_channel=1 virtualserver_log_permissions=1 virtualserver_log_server=1 virtualserver_log_filetransfer=1 virtualserver_min_client_version=1513163251 virtualserver_reserved_slots=0 virtualserver_total_packetloss_speech=0.0000 virtualserver_total_packetloss_keepalive=0.0000 virtualserver_total_packetloss_control=0.0000 virtualserver_total_packetloss_total=0.0000 virtualserver_total_ping=0.0000 virtualserver_weblist_enabled=1 virtualserver_min_android_version=1502275280 virtualserver_min_ios_version=1502275280 virtualserver_antiflood_points_needed_plugin_block=0 + { name="ServerVariablesRequest", notify="servergetvariables", attributes=[] }, + # servergroupadd name=test type=1 + # -> {ServerGroupList} notifyservergrouplist sgid=1 name=Guest\sServer\sQuery type=2 iconid=0 savedb=0 sortid=0 namemode=0 n_modifyp=100 n_member_addp=0 n_member_removep=0|... + { name="ServerGroupAdd", notify="servergroupadd", attributes=["name", "type@group?"] }, + # servergroupaddclient sgid=9 cldbid=2 + # -> void + { name="ServerGroupAddClient", notify="servergroupaddclient", attributes=["sgid", "cldbid"] }, + # servergroupaddperm sgid=9 permid=179 permvalue=1 permnegated=0 permskip=0 + # -> void + { name="ServerGroupAddPerm", notify="servergroupaddperm", attributes=["sgid", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + # TODO + { name="ServerGroupAutoAddPerm", notify="servergroupautoaddperm", attributes=["sgtype", "permid?", "permsid?", "permvalue", "permnegated", "permskip"] }, + # TODO + { name="ServerGroupAutoDelPerm", notify="servergroupautodelperm", attributes=["sgtype", "permid?", "permsid?"] }, + # servergroupclientlist sgid=6 -names + # -> {ServerGroupClientList} notifyservergroupclientlist sgid=6 cldbid=2 client_nickname=Splamy client_unique_identifier=uA0U7t4PBxdJ5TLnarsOHQh4\/tY=|cldbid=4 client_nickname=AudioBud client_unique_identifier=b+P0CqXms5I0C+A66HZ4Sbu\/PNw=|cldbid=8 client_nickname=Bot client_unique_identifier=lks7QL5OVMKo4pZ79cEOI5r5oEA=|cldbid=48 client_nickname=TestClient1 client_unique_identifier=r6YwpyjxGM7nJp21NlgCoaLRg9I= + { name="ServerGroupClientListRequest", notify="servergroupclientlist", attributes=["sgid"] }, # -names + # servergroupcopy name=test\s(Copy) ssgid=9 tsgid=0 type=1 + # -> {ServerGroupList} notifyservergrouplist ... + { name="ServerGroupCopy", notify="servergroupcopy", attributes=["ssgid", "tsgid", "name", "type@group"] }, + # servergroupdel sgid=10 force=0 + # -> void + { name="ServerGroupDel", notify="servergroupdel", attributes=["sgid", "force"] }, + # servergroupdelclient sgid=9 cldbid=2 + # -> void + { name="ServerGroupDelClient", notify="servergroupdelclient", attributes=["sgid", "cldbid"] }, + # servergroupdelperm sgid=9 permid=179 + # -> void + { name="ServerGroupDelPerm", notify="servergroupdelperm", attributes=["sgid", "permid?", "permsid?"] }, + # servergrouplist + # -> {ServerGroupList} notifyservergrouplist ... + { name="ServerGroupListRequest", notify="servergrouplist", attributes=[] }, + # servergrouppermlist sgid=7 + # -> {ServerGroupPermList} notifyservergrouppermlist sgid=7 permid=23 permvalue=1 permnegated=0 permskip=0|permid=24 permvalue=1 permnegated=0 permskip=0|... + { name="ServerGroupPermListRequest", notify="servergrouppermlist", attributes=["sgid"] }, # -permsid + # servergrouprename sgid=9 name=testYY + # -> {ServerGroupList} notifyservergrouplist ... + { name="ServerGroupRename", notify="servergrouprename", attributes=["sgid", "name"] }, + # servergroupsbyclientid cldbid=2 + # -> {ServerGroupsByClientId} notifyservergroupsbyclientid name=Server\sAdmin sgid=6 cldbid=2|name=Normal sgid=7 cldbid=2|name=testYY sgid=9 cldbid=2 + { name="ServerGroupsByClientIdRequest", notify="servergroupsbyclientid", attributes=["cldbid"] }, + # serveridgetbyport virtualserver_port=9987 + # -> server_id=1 + { name="ServerIdGetByPort", notify="serveridgetbyport", attributes=["virtualserver_port"] }, + # serverinfo + # -> virtualserver_unique_identifier=SwHpaSmzsKpQ4ksmdkMFOMpBhqA= virtualserver_name=TeamSpeak\s]I[\sServer virtualserver_welcomemessage=Welcome\sto\sTeamSpeak,\scheck\s[URL]www.teamspeak.com[\/URL]\sfor\slatest\sinformation virtualserver_platform=Windows virtualserver_version=3.4.0\s[Build:\s1536564584] virtualserver_maxclients=32 virtualserver_password virtualserver_clientsonline=1 virtualserver_channelsonline=1 virtualserver_created=1537603734 virtualserver_uptime=7590 virtualserver_codec_encryption_mode=0 virtualserver_hostmessage virtualserver_hostmessage_mode=0 virtualserver_filebase=files\\virtualserver_1 virtualserver_default_server_group=8 virtualserver_default_channel_group=8 virtualserver_flag_password=0 virtualserver_default_channel_admin_group=5 virtualserver_max_download_total_bandwidth=18446744073709551615 virtualserver_max_upload_total_bandwidth=18446744073709551615 virtualserver_hostbanner_url virtualserver_hostbanner_gfx_url virtualserver_hostbanner_gfx_interval=0 virtualserver_complain_autoban_count=5 virtualserver_complain_autoban_time=1200 virtualserver_complain_remove_time=3600 virtualserver_min_clients_in_channel_before_forced_silence=100 virtualserver_priority_speaker_dimm_modificator=-18.0000 virtualserver_id=1 virtualserver_antiflood_points_tick_reduce=5 virtualserver_antiflood_points_needed_command_block=150 virtualserver_antiflood_points_needed_ip_block=250 virtualserver_client_connections=5 virtualserver_query_client_connections=4 virtualserver_hostbutton_tooltip virtualserver_hostbutton_url virtualserver_hostbutton_gfx_url virtualserver_queryclientsonline=0 virtualserver_download_quota=18446744073709551615 virtualserver_upload_quota=18446744073709551615 virtualserver_month_bytes_downloaded=143900 virtualserver_month_bytes_uploaded=1737584828 virtualserver_total_bytes_downloaded=156464 virtualserver_total_bytes_uploaded=1737647648 virtualserver_port=9987 virtualserver_autostart=1 virtualserver_machine_id virtualserver_needed_identity_security_level=8 virtualserver_log_client=1 virtualserver_log_query=1 virtualserver_log_channel=1 virtualserver_log_permissions=1 virtualserver_log_server=1 virtualserver_log_filetransfer=1 virtualserver_min_client_version=1513163251 virtualserver_name_phonetic virtualserver_icon_id=0 virtualserver_reserved_slots=0 virtualserver_total_packetloss_speech=0.0000 virtualserver_total_packetloss_keepalive=0.0000 virtualserver_total_packetloss_control=0.0000 virtualserver_total_packetloss_total=0.0000 virtualserver_total_ping=0.0000 virtualserver_ip=0.0.0.0,\s:: virtualserver_weblist_enabled=1 virtualserver_ask_for_privilegekey=0 virtualserver_hostbanner_mode=0 virtualserver_channel_temp_delete_delay_default=0 virtualserver_min_android_version=1502275280 virtualserver_min_ios_version=1502275280 virtualserver_nickname virtualserver_antiflood_points_needed_plugin_block=0 virtualserver_status=online connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_speech=0 connection_bytes_sent_speech=0 connection_packets_received_speech=0 connection_bytes_received_speech=0 connection_packets_sent_keepalive=17990 connection_bytes_sent_keepalive=737590 connection_packets_received_keepalive=17990 connection_bytes_received_keepalive=755578 connection_packets_sent_control=620 connection_bytes_sent_control=121323 connection_packets_received_control=636 connection_bytes_received_control=78134 connection_packets_sent_total=18610 connection_bytes_sent_total=858913 connection_packets_received_total=18626 connection_bytes_received_total=833712 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=83 connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=90 + { name="ServerInfo", notify="serverinfo", attributes=[] }, + # serverlist + # -> {ServerListResponse} virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online virtualserver_clientsonline=1 virtualserver_queryclientsonline=0 virtualserver_maxclients=32 virtualserver_uptime=7629 virtualserver_name=TeamSpeak\s]I[\sServer virtualserver_autostart=1 virtualserver_machine_id + { name="ServerListRequest", notify="serverlist", attributes=[] }, # -uid -short -all -onlyoffline + # [NOT FULL] + { name="ServerNotifyRegister", notify="servernotifyregister", attributes=["event", "id?"] }, + # [NOT FULL] + { name="ServerNotifyUnregister", notify="servernotifyunregister", attributes=[] }, + # TODO + { name="ServerProcessStop", notify="serverprocessstop", attributes=["reasonmsg?"] }, + # serverrequestconnectioninfo + # -> {ServerConnectionInfo} notifyserverconnectioninfo connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_total=1789 connection_bytes_sent_total=94989 connection_packets_received_total=1791 connection_bytes_received_total=81239 connection_bandwidth_sent_last_second_total=863 connection_bandwidth_sent_last_minute_total=107 connection_bandwidth_received_last_second_total=251 connection_bandwidth_received_last_minute_total=93 connection_connected_time=1703 connection_packetloss_total=0.0000 connection_ping=0.0000 + { name="ServerConnectionInfoRequest", notify="serverrequestconnectioninfo", attributes=[] }, + # TODO + { name="ServerSnapshotCreate", notify="serversnapshotcreate", attributes=[] }, + # TODO + { name="ServerSnapshotDeploy", notify="serversnapshotdeploy", attributes=[] }, # -mapping + # TODO + { name="ServerStart", notify="serverstart", attributes=["sid"] }, + # TODO + { name="ServerStop", notify="serverstop", attributes=["sid", "reasonmsg?"] }, + # servertemppasswordadd pw=1234 desc=asdf duration=42 tcid=1 tcpw=4321 + # -> void + { name="ServerTempPasswordAdd", notify="servertemppasswordadd", attributes=["pw", "desc", "duration@time", "tcid", "tcpw"] }, + # servertemppassworddel pw=1234 + # -> void + { name="ServerTempPasswordDel", notify="servertemppassworddel", attributes=["pw"] }, + # servertemppasswordlist + # -> {ServerTempPasswordList} notifyservertemppasswordlist nickname=Splamy uid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= desc=asdf pw_clear=1234 start=1539346669 end=1539346711 tcid=1 tcpw=4321 + { name="ServerTempPasswordListRequest", notify="servertemppasswordlist", attributes=[] }, + # setclientchannelgroup cgid=9 cid=1 cldbid=2 + # -> {ClientChannelGroupChanged} notifyclientchannelgroupchanged invokerid=3 invokername=Splamy invokeruid=uA0U7t4PBxdJ5TLnarsOHQh4\/tY= cgid=9 cid=3 clid=3 cgi=3 + { name="SetClientChannelGroup", notify="setclientchannelgroup", attributes=["cgid", "cid", "cldbid"] }, + # setconnectioninfo connection_ping=0.0000 connection_ping_deviation=0.3143 connection_packets_sent_speech=1 connection_packets_sent_keepalive=10 connection_packets_sent_control=44 connection_bytes_sent_speech=44 connection_bytes_sent_keepalive=412 connection_bytes_sent_control=5830 connection_packets_received_speech=0 connection_packets_received_keepalive=10 connection_packets_received_control=40 connection_bytes_received_speech=0 connection_bytes_received_keepalive=408 connection_bytes_received_control=5421 connection_server2client_packetloss_speech=0.0000 connection_server2client_packetloss_keepalive=0.0000 connection_server2client_packetloss_control=0.0000 connection_server2client_packetloss_total=0.0000 connection_bandwidth_sent_last_second_speech=0 connection_bandwidth_sent_last_second_keepalive=40 connection_bandwidth_sent_last_second_control=552 connection_bandwidth_sent_last_minute_speech=4 connection_bandwidth_sent_last_minute_keepalive=41 connection_bandwidth_sent_last_minute_control=639 connection_bandwidth_received_last_second_speech=0 connection_bandwidth_received_last_second_keepalive=40 connection_bandwidth_received_last_second_control=147 connection_bandwidth_received_last_minute_speech=0 connection_bandwidth_received_last_minute_keepalive=41 connection_bandwidth_received_last_minute_control=595 + { name="SetConnectionInfo", notify="setconnectioninfo", attributes=["connection_ping", "connection_ping_deviation", "connection_packets_sent_speech", "connection_packets_sent_keepalive", "connection_packets_sent_control", "connection_bytes_sent_speech", "connection_bytes_sent_keepalive", "connection_bytes_sent_control", "connection_packets_received_speech", "connection_packets_received_keepalive", "connection_packets_received_control", "connection_bytes_received_speech", "connection_bytes_received_keepalive", "connection_bytes_received_control", "connection_server2client_packetloss_speech", "connection_server2client_packetloss_keepalive", "connection_server2client_packetloss_control", "connection_server2client_packetloss_total", "connection_bandwidth_sent_last_second_speech", "connection_bandwidth_sent_last_second_keepalive", "connection_bandwidth_sent_last_second_control", "connection_bandwidth_sent_last_minute_speech", "connection_bandwidth_sent_last_minute_keepalive", "connection_bandwidth_sent_last_minute_control", "connection_bandwidth_received_last_second_speech", "connection_bandwidth_received_last_second_keepalive", "connection_bandwidth_received_last_second_control", "connection_bandwidth_received_last_minute_speech", "connection_bandwidth_received_last_minute_keepalive", "connection_bandwidth_received_last_minute_control"] }, + # tokenadd tokentype=0 tokenid1=7 tokenid2=0 tokendescription=test + # -> {TokenAdd} notifytokenadd token=jnKIAfA2aiDW9ZMPj5CPmuXLIOR3tdYwDn70B9Hw + { name="TokenAddRequest", notify="tokenadd", attributes=["tokentype", "tokenid1", "tokenid2", "tokendescription?", "tokencustomset?"] }, + # tokendelete token=ECsX5mdv9YlHRMB90mkfd4SIIJh2W62TRqn8p+RS + # -> void + { name="TokenDelete", notify="tokendelete", attributes=["token"] }, + # tokenlist + # -> {TokenList} notifytokenlist token=jnKIAfA2aiDW9ZMPj5CPmuXLIOR3tdYwDn70B9Hw token_type=0 token_id1=7 token_id2=0 token_created=1539343950 token_description=test|... + { name="TokenListRequest", notify="tokenlist", attributes=[] }, + # tokenuse token=CHu62WH7P5vVhNP3NnLS4hxoVgWdKeAwdU8q7Iaf + # -> (vary) + { name="TokenUse", notify="tokenuse", attributes=["token"] }, + # use $ + # -> void + { name="Use", notify="use", attributes=["sid?", "port?"] }, # -virtual + # version + # -> version=3.4.0 build=1536564584 platform=Windows + { name="VersionRequest", notify="version", attributes=[] }, + # whoami + # -> {WhoAmI} virtualserver_status=online virtualserver_id=1 virtualserver_unique_identifier=SwHpaSmzsKpQ4ksmdkMFOMpBhqA= virtualserver_port=9987 client_id=4 client_channel_id=1 client_nickname=Splamy client_database_id=0 client_login_name client_unique_identifier client_origin_server_id=0 + { name="WhoAmIRequest", notify="whoami", attributes=[] }, + # clientdisconnect reasonid=7 reasonmsg=Client\sdisconnected + { name="Disconnect", notify="clientdisconnect", attributes=["reasonid?", "reasonmsg?"] }, +] diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/MessagesToBook.toml b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/MessagesToBook.toml new file mode 100644 index 0000000..c3e61e2 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/MessagesToBook.toml @@ -0,0 +1,268 @@ +# All properties which have an identical 'High-Level' name are copied implicitly + +[[rule]] +from = "ChannelCreated" +id = ["ChannelId"] +to = "Channel" +# add/update/remove +operation = "add" +properties = [ + { from="ParentId", to="Parent" }, + { function="ChannelTypeCcFun", tolist=["ChannelType"] }, + { function="ChannelOrderCcFun", tolist=["Order"] }, + { function="MaxClientsCcFun", tolist=["MaxClients", "MaxFamilyClients"] }, + # Default codec is opus voice + { function="ChannelCodecCcFun", tolist=["Codec"] }, + { function="ReturnFalse", tolist=["ForcedSilence"] }, + { function="ReturnFalse", tolist=["Subscribed"] }, + { function="ReturnNone", tolist=["IsPrivate"] }, + { function="ReturnNone", tolist=["Guid"] }, + { function="ReturnNone", tolist=["OptionalData"] }, + { function="ReturnNone", tolist=["PermissionHints"] }, +] + +[[rule]] +from = "ChannelDeleted" +id = ["ChannelId"] +to = "Channel" +operation = "remove" + +[[rule]] +from = "ChannelEdited" +id = ["ChannelId"] +to = "Channel" +operation = "update" +properties = [ + { function="MaxClientsCeFun", tolist=["MaxClients", "MaxFamilyClients"] }, + { function="ChannelTypeCeFun", tolist=["ChannelType"] }, + { function="ChannelOrderCeFun", tolist=["Order"] }, +] + +[[rule]] +from = "ChannelEdited" +id = ["ChannelId"] +to = "OptionalChannelData" +operation = "update" +properties = [ +] + +[[rule]] +from = "ChannelEditedLow" +id = ["ChannelId"] +to = "OptionalChannelData" +operation = "update" +properties = [ +] + +[[rule]] +from = "ChannelDescriptionChanged" +id = ["ChannelId"] +to = "OptionalChannelData" +operation = "remove" + +[[rule]] +from = "ChannelGroupList" +id = ["ChannelGroup"] +to = "ChannelGroup" +operation = "add" + +[[rule]] +from = "ChannelList" +id = ["ChannelId"] +to = "Channel" +operation = "add" +properties = [ + { from="ParentId", to="Parent" }, + { function="MaxClientsClFun", tolist=["MaxClients", "MaxFamilyClients"] }, + { function="ChannelTypeClFun", tolist=["ChannelType"] }, + { function="ReturnFalse", tolist=["Subscribed"] }, + { function="ReturnNone", tolist=["PermissionHints"] }, + { function="ReturnNone", tolist=["OptionalData"] }, +] + +[[rule]] +from = "ChannelMoved" +id = ["ChannelId"] +to = "Channel" +operation = "update" +properties = [ + { from="ParentId", to="Parent" }, + { function="ChannelOrderCmFun", tolist=["Order"] }, +] + +[[rule]] +from = "ChannelPermissionHints" +id = ["ChannelId"] +to = "Channel" +operation = "update" +properties = [ + { from="Flags", to="PermissionHints" }, +] + +[[rule]] +from = "ChannelSubscribed" +id = ["ChannelId"] +to = "Channel" +operation = "update" +properties = [ + { function="ChannelSubscribeFun", tolist=["Subscribed"] }, +] + +[[rule]] +from = "ChannelUnsubscribed" +id = ["ChannelId"] +to = "Channel" +operation = "update" +properties = [ + { function="ChannelUnsubscribeFun", tolist=["Subscribed"] }, +] + +[[rule]] +from = "ClientChannelGroupChanged" +id = ["ClientId"] +to = "Client" +operation = "update" + +[[rule]] +from = "ClientEnterView" +id = ["ClientId"] +to = "Client" +operation = "add" +properties = [ + { from="TargetChannelId", to="Channel" }, + { function="AwayCevFun", tolist=["AwayMessage"] }, + { function="ClientTypeCevFun", tolist=["ClientType"] }, + { function="TalkPowerCevFun", tolist=["TalkPowerRequest"] }, + { function="ReturnNone", tolist=["PermissionHints"] }, + { function="ReturnNone", tolist=["OptionalData"] }, + { function="ReturnNone", tolist=["ConnectionData"] }, +] + +[[rule]] +from = "ClientLeftView" +id = ["ClientId"] +to = "Client" +operation = "remove" + +[[rule]] +from = "ClientMoved" +id = ["ClientId"] +to = "Client" +operation = "update" +properties = [ + { from="TargetChannelId", to="Channel" }, + # Set channel subscribed when the current client is moved + { function="SubscribeChannelFun", tolist=[] }, +] + +[[rule]] +from = "ClientConnectionInfo" +id = ["ClientId"] +to = "ConnectionClientData" +operation = "update" +properties = [ + { function="AddressFun", tolist=["ClientAddress"] }, +] + +[[rule]] +from = "ClientServerGroupAdded" +id = ["ClientId"] +to = "Client" +operation = "update" +properties = [ + { from="ServerGroupId", to="ServerGroups", operation="add" }, + # We explicitly throw away the server group name. + # Otherwise it would overwrite our client name because of automated + # matching. + { function="VoidFun", tolist=["Name"] }, +] + +[[rule]] +from = "ClientServerGroupRemoved" +id = ["ClientId"] +to = "Client" +operation = "update" +properties = [ + { from="ServerGroupId", to="ServerGroups", operation="remove" }, + { function="VoidFun", tolist=["Name"] }, +] + +[[rule]] +from = "ClientUpdated" +id = ["ClientId"] +to = "Client" +operation = "update" +properties = [ + { function="AwayCuFun", tolist=["AwayMessage"] }, + { function="TalkPowerCuFun", tolist=["TalkPowerRequest"] }, +] + +[[rule]] +from = "ClientUpdated" +id = ["ClientId"] +to = "OptionalClientData" +operation = "update" +properties = [ + { function="ReturnSomeNone", tolist=["VersionSign"] }, +] + +[[rule]] +from = "ClientPermissionHints" +id = ["ClientId"] +to = "Client" +operation = "update" +properties = [ + { from="Flags", to="PermissionHints" }, +] + +[[rule]] +from = "InitServer" +id = [] +to = "Server" +operation = "add" +properties = [ + { from="VirtualServerId", to="Id" }, + # `Uid` is generated from public key + # ClientName, ClientId, TalkPower, NeededServerqueryViewPower + { function="SetClientDataFun", tolist=[] }, +] + +[[rule]] +from = "ServerEdited" +id = [] +to = "Server" +operation = "update" + +[[rule]] +from = "ServerEdited" +id = [] +to = "OptionalServerData" +operation = "remove" + +[[rule]] +from = "ServerUpdated" +id = [] +to = "Server" +operation = "update" + +[[rule]] +from = "ServerGroupList" +id = ["ServerGroupId"] +to = "ServerGroup" +operation = "add" + +[[rule]] +from = "ServerConnectionInfo" +id = [] +to = "ConnectionServerData" +operation = "update" +properties = [ +] + +[[rule]] +from = "ServerUpdated" +id = [] +to = "OptionalServerData" +operation = "update" +properties = [ +] diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Packets.txt b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Packets.txt new file mode 100644 index 0000000..63bd490 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Packets.txt @@ -0,0 +1,151 @@ +Packet + // Content + Header + // name type ?value + /// EAX Message Authentication Code + mac [u8; 8] + /// Packet id + p_id u16 + /// Client id + ?c_id u16 + // Pre condition + ++ *from_client + /// Flags: + /// + /// - 0x80 Unencrypted + /// - 0x40 Compressed + /// - 0x20 Newprotocol + /// - 0x10 Fragmented + flags - + /// Packet type: Higher nibble: Flags; Lower nibble: Packet type + /// + /// Packet types: + /// + /// - 0x0 Voice + /// - 0x1 Voice whisper + /// - 0x2 Command + /// - 0x3 Command low + /// - 0x4 Ping + /// - 0x5 Pong + /// - 0x6 Ack + /// - 0x7 Ack low + /// - 0x8 Init + p_type u8 + // Post conditions + ++ (res.p_type & 0xf) <= 8 + // Enum + #Data + #C2SInit + ++ header.mac.iter().eq(b"TS3INIT1") + ++ header.c_id.is_some() + ++ header.get_type() == PacketType::Init + Init0 + /// Teamspeak version as timestamp + version u32 + /// Init packet step number + - u8 0 + /// Current timestamp + timestamp u32 + random0 [u8; 4] + /// Reserved + - [u8; 8] [0; 8] + Init2 + /// Teamspeak version as timestamp + version u32 + /// Init packet step number + - u8 2 + random1 [u8; 16] + random0_r [u8; 4] + Init4 + /// Teamspeak version as timestamp + version u32 + /// Init packet step number + - u8 4 + x [u8; 64] + n [u8; 64] + level u32 + random2 [u8; 100] + /// y = x ^ (2 ^ level) % n + y [u8; 64] + command Command + ++ if let C2SInit::Init4 { ref command, .. } = res { command.command == "clientinitiv" && command.has_arg("alpha") && command.has_arg("omega") } else { true } + #S2CInit + ++ header.mac.iter().eq(b"TS3INIT1") + ++ header.c_id.is_none() + ++ header.get_type() == PacketType::Init + Init1 + /// Init packet step number + - u8 1 + random1 [u8; 16] + /// Reversed `random0` + random0_r [u8; 4] + Init3 + /// Init packet step number + - u8 3 + x [u8; 64] + n [u8; 64] + level u32 + random2 [u8; 100] + Init127 + /// Init packet step number + - u8 127 + - u8 0 + VoiceC2S + ++ header.get_type() == PacketType::Voice + ++ header.c_id.is_some() + id u16 + codec_type u8 + voice_data Vec + VoiceS2C + ++ header.get_type() == PacketType::Voice + ++ header.c_id.is_none() + id u16 + /// The id of the talking client + from_id u16 + codec_type u8 + voice_data Vec + VoiceWhisperC2S + ++ header.get_type() == PacketType::VoiceWhisper + ++ header.c_id.is_some() + ++ !header.get_newprotocol() + id u16 + codec_type u8 + channel_count u8 + client_count u8 + /// [u64; channel_count], [u16; client_count], voice_data + data Vec + VoiceWhisperNewC2S + ++ header.get_type() == PacketType::VoiceWhisper + ++ header.c_id.is_some() + ++ header.get_newprotocol() + id u16 + codec_type u8 + whisper_type u8 + whisper_target u8 + /// The targeted channel or group id (or 0 if not applicable) + target_id u64 + voice_data Vec + VoiceWhisperS2C + ++ header.get_type() == PacketType::VoiceWhisper + ++ header.c_id.is_none() + id u16 + /// The id of the talking client + from_id u16 + codec_type u8 + voice_data Vec + Command Command + ++ header.get_type() == PacketType::Command + CommandLow Command + ++ header.get_type() == PacketType::CommandLow + Ping + ++ header.get_type() == PacketType::Ping + //- u16 0xeee9 + /// Pong with packet id + Pong u16 + ++ header.get_type() == PacketType::Pong + /// Pong with packet id + Ack u16 + ++ header.get_type() == PacketType::Ack + /// Pong with packet id + AckLow u16 + ++ header.get_type() == PacketType::AckLow diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Permissions.csv b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Permissions.csv new file mode 100644 index 0000000..7832387 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Permissions.csv @@ -0,0 +1,250 @@ +name,doc +unknown,May occur on error returns with no associated permission +b_serverinstance_help_view,Retrieve information about ServerQuery commands +b_serverinstance_version_view,Retrieve global server version (including platform and build number) +b_serverinstance_info_view,Retrieve global server information +b_serverinstance_virtualserver_list,List virtual servers stored in the database +b_serverinstance_binding_list,List active IP bindings on multi-homed machines +b_serverinstance_permission_list,List permissions available available on the server instance +b_serverinstance_permission_find,Search permission assignments by name or ID +b_virtualserver_create,Create virtual servers +b_virtualserver_delete,Delete virtual servers +b_virtualserver_start_any,Start any virtual server in the server instance +b_virtualserver_stop_any,Stop any virtual server in the server instance +b_virtualserver_change_machine_id,Change a virtual servers machine ID +b_virtualserver_change_template,Edit virtual server default template values +b_serverquery_login,Login to ServerQuery +b_serverinstance_textmessage_send,Send text messages to all virtual servers at once +b_serverinstance_log_view,Retrieve global server log +b_serverinstance_log_add,Write to global server log +b_serverinstance_stop,Shutdown the server process +b_serverinstance_modify_settings,Edit global settings +b_serverinstance_modify_querygroup,Edit global ServerQuery groups +b_serverinstance_modify_templates,Edit global template groups +b_virtualserver_select,Select a virtual server +b_virtualserver_info_view,Retrieve virtual server information +b_virtualserver_connectioninfo_view,Retrieve virtual server connection information +b_virtualserver_channel_list,List channels on a virtual server +b_virtualserver_channel_search,Search for channels on a virtual server +b_virtualserver_client_list,List clients online on a virtual server +b_virtualserver_client_search,Search for clients online on a virtual server +b_virtualserver_client_dblist,List client identities known by the virtual server +b_virtualserver_client_dbsearch,Search for client identities known by the virtual server +b_virtualserver_client_dbinfo,Retrieve client information +b_virtualserver_permission_find,Find permissions +b_virtualserver_custom_search,Find custom fields +b_virtualserver_start,Start own virtual server +b_virtualserver_stop,Stop own virtual server +b_virtualserver_token_list,List privilege keys available +b_virtualserver_token_add,Create new privilege keys +b_virtualserver_token_use,Use a privilege keys to gain access to groups +b_virtualserver_token_delete,Delete a privilege key +b_virtualserver_log_view,Retrieve virtual server log +b_virtualserver_log_add,Write to virtual server log +b_virtualserver_join_ignore_password,Join virtual server ignoring its password +b_virtualserver_notify_register,Register for server notifications +b_virtualserver_notify_unregister,Unregister from server notifications +b_virtualserver_snapshot_create,Create server snapshots +b_virtualserver_snapshot_deploy,Deploy server snapshots +b_virtualserver_permission_reset,Reset the server permission settings to default values +b_virtualserver_modify_name,Modify server name +b_virtualserver_modify_welcomemessage,Modify welcome message +b_virtualserver_modify_maxclients,Modify servers max clients +b_virtualserver_modify_reserved_slots,Modify reserved slots +b_virtualserver_modify_password,Modify server password +b_virtualserver_modify_default_servergroup,Modify default Server Group +b_virtualserver_modify_default_channelgroup,Modify default Channel Group +b_virtualserver_modify_default_channeladmingroup,Modify default Channel Admin Group +b_virtualserver_modify_channel_forced_silence,Modify channel force silence value +b_virtualserver_modify_complain,Modify individual complain settings +b_virtualserver_modify_antiflood,Modify individual antiflood settings +b_virtualserver_modify_ft_settings,Modify file transfer settings +b_virtualserver_modify_ft_quotas,Modify file transfer quotas +b_virtualserver_modify_hostmessage,Modify individual hostmessage settings +b_virtualserver_modify_hostbanner,Modify individual hostbanner settings +b_virtualserver_modify_hostbutton,Modify individual hostbutton settings +b_virtualserver_modify_port,Modify server port +b_virtualserver_modify_autostart,Modify server autostart +b_virtualserver_modify_needed_identity_security_level,Modify required identity security level +b_virtualserver_modify_priority_speaker_dimm_modificator,Modify priority speaker dimm modificator +b_virtualserver_modify_log_settings,Modify log settings +b_virtualserver_modify_min_client_version,Modify min client version +b_virtualserver_modify_icon_id,Modify server icon +b_virtualserver_modify_weblist,Modify web server list reporting settings +b_virtualserver_modify_codec_encryption_mode,Modify codec encryption mode +b_virtualserver_modify_temporary_passwords,Modify temporary serverpasswords +b_virtualserver_modify_temporary_passwords_own,Modify own temporary serverpasswords +b_virtualserver_modify_channel_temp_delete_delay_default,Modify default temporary channel delete delay +b_virtualserver_modify_nickname,Modify server nicknames +b_virtualserver_modify_integrations,Modify integrations +i_channel_min_depth,Min channel creation depth in hierarchy +i_channel_max_depth,Max channel creation depth in hierarchy +b_channel_group_inheritance_end,Stop inheritance of channel group permissions +i_channel_permission_modify_power,Modify channel permission power +i_channel_needed_permission_modify_power,Needed modify channel permission power +b_channel_info_view,Retrieve channel information +b_channel_create_child,Create sub-channels +b_channel_create_permanent,Create permanent channels +b_channel_create_semi_permanent,Create semi-permanent channels +b_channel_create_temporary,Create temporary channels +b_channel_create_private,Create private channel +b_channel_create_with_topic,Create channels with a topic +b_channel_create_with_description,Create channels with a description +b_channel_create_with_password,Create password protected channels +b_channel_create_modify_with_codec_speex8,Create channels using Speex Narrowband (8 kHz) codecs +b_channel_create_modify_with_codec_speex16,Create channels using Speex Wideband (16 kHz) codecs +b_channel_create_modify_with_codec_speex32,Create channels using Speex Ultra-Wideband (32 kHz) codecs +b_channel_create_modify_with_codec_celtmono48,Create channels using the CELT Mono (48 kHz) codec +b_channel_create_modify_with_codec_opusvoice,Create channels using OPUS (voice) codec +b_channel_create_modify_with_codec_opusmusic,Create channels using OPUS (music) codec +i_channel_create_modify_with_codec_maxquality,Create channels with custom codec quality +i_channel_create_modify_with_codec_latency_factor_min,Create channels with minimal custom codec latency factor +b_channel_create_with_maxclients,Create channels with custom max clients +b_channel_create_with_maxfamilyclients,Create channels with custom max family clients +b_channel_create_with_sortorder,Create channels with custom sort order +b_channel_create_with_default,Create default channels +b_channel_create_with_needed_talk_power,Create channels with needed talk power +b_channel_create_modify_with_force_password,Create new channels only with password +i_channel_create_modify_with_temp_delete_delay,Max delete delay for temporary channels +b_channel_modify_parent,Move channels +b_channel_modify_make_default,Make channel default +b_channel_modify_make_permanent,Make channel permanent +b_channel_modify_make_semi_permanent,Make channel semi-permanent +b_channel_modify_make_temporary,Make channel temporary +b_channel_modify_name,Modify channel name +b_channel_modify_topic,Modify channel topic +b_channel_modify_description,Modify channel description +b_channel_modify_password,Modify channel password +b_channel_modify_codec,Modify channel codec +b_channel_modify_codec_quality,Modify channel codec quality +b_channel_modify_codec_latency_factor,Modify channel codec latency factor +b_channel_modify_maxclients,Modify channels max clients +b_channel_modify_maxfamilyclients,Modify channels max family clients +b_channel_modify_sortorder,Modify channel sort order +b_channel_modify_needed_talk_power,Change needed channel talk power +i_channel_modify_power,Channel modify power +i_channel_needed_modify_power,Needed channel modify power +b_channel_modify_make_codec_encrypted,Make channel codec encrypted +b_channel_modify_temp_delete_delay,Modify temporary channel delete delay +b_channel_delete_permanent,Delete permanent channels +b_channel_delete_semi_permanent,Delete semi-permanent channels +b_channel_delete_temporary,Delete temporary channels +b_channel_delete_flag_force,Force channel delete +i_channel_delete_power,Delete channel power +i_channel_needed_delete_power,Needed delete channel power +b_channel_join_permanent,Join permanent channels +b_channel_join_semi_permanent,Join semi-permanent channels +b_channel_join_temporary,Join temporary channels +b_channel_join_ignore_password,Join channel ignoring its password +b_channel_join_ignore_maxclients,Ignore channels max clients limit +i_channel_join_power,Channel join power +i_channel_needed_join_power,Needed channel join power +i_channel_subscribe_power,Channel subscribe power +i_channel_needed_subscribe_power,Needed channel subscribe power +i_channel_description_view_power,Channel description view power +i_channel_needed_description_view_power,Needed channel needed description view power +i_icon_id,Group icon identifier +i_max_icon_filesize,Max icon filesize in bytes +b_icon_manage,Enables icon management +b_group_is_permanent,Group is permanent +i_group_auto_update_type,Group auto-update type +i_group_auto_update_max_value,Group auto-update max value +i_group_sort_id,Group sort id +i_group_show_name_in_tree,Show group name in tree depending on selected mode +b_virtualserver_servergroup_list,List server groups +b_virtualserver_servergroup_permission_list,List server group permissions +b_virtualserver_servergroup_client_list,List clients from a server group +b_virtualserver_channelgroup_list,List channel groups +b_virtualserver_channelgroup_permission_list,List channel group permissions +b_virtualserver_channelgroup_client_list,List clients from a channel group +b_virtualserver_client_permission_list,List client permissions +b_virtualserver_channel_permission_list,List channel permissions +b_virtualserver_channelclient_permission_list,List channel client permissions +b_virtualserver_servergroup_create,Create server groups +b_virtualserver_channelgroup_create,Create channel groups +i_group_modify_power,Group modify power +i_group_needed_modify_power,Needed group modify power +i_group_member_add_power,Group member add power +i_group_needed_member_add_power,Needed group member add power +i_group_member_remove_power,Group member delete power +i_group_needed_member_remove_power,Needed group member delete power +i_permission_modify_power,Permission modify power +b_permission_modify_power_ignore,Ignore needed permission modify power +b_virtualserver_servergroup_delete,Delete server groups +b_virtualserver_channelgroup_delete,Delete channel groups +i_client_permission_modify_power,Client permission modify power +i_client_needed_permission_modify_power,Needed client permission modify power +i_client_max_clones_uid,Max additional connections per client identity +i_client_max_idletime,Max idle time in seconds +i_client_max_avatar_filesize,Max avatar filesize in bytes +i_client_max_channel_subscriptions,Max channel subscriptions +b_client_is_priority_speaker,Client is priority speaker +b_client_skip_channelgroup_permissions,Ignore channel group permissions +b_client_force_push_to_talk,Force Push-To-Talk capture mode +b_client_ignore_bans,Ignore bans +b_client_ignore_antiflood,Ignore antiflood measurements +b_client_issue_client_query_command,Issue query commands from client +b_client_use_reserved_slot,Use an reserved slot +b_client_use_channel_commander,Use channel commander +b_client_request_talker,Allow to request talk power +b_client_avatar_delete_other,Allow deletion of avatars from other clients +b_client_is_sticky,Client will be sticked to current channel +b_client_ignore_sticky,Client ignores sticky flag +b_client_info_view,Retrieve client information +b_client_permissionoverview_view,Retrieve client permissions overview +b_client_permissionoverview_own,Retrieve clients own permissions overview +b_client_remoteaddress_view,View client IP address and port +i_client_serverquery_view_power,ServerQuery view power +i_client_needed_serverquery_view_power,Needed ServerQuery view power +b_client_custom_info_view,View custom fields +i_client_kick_from_server_power,Client kick power from server +i_client_needed_kick_from_server_power,Needed client kick power from server +i_client_kick_from_channel_power,Client kick power from channel +i_client_needed_kick_from_channel_power,Needed client kick power from channel +i_client_ban_power,Client ban power +i_client_needed_ban_power,Needed client ban power +i_client_move_power,Client move power +i_client_needed_move_power,Needed client move power +i_client_complain_power,Complain power +i_client_needed_complain_power,Needed complain power +b_client_complain_list,Show complain list +b_client_complain_delete_own,Delete own complains +b_client_complain_delete,Delete complains +b_client_ban_list,Show banlist +b_client_ban_create,Add a ban +b_client_ban_delete_own,Delete own bans +b_client_ban_delete,Delete bans +i_client_ban_max_bantime,Max bantime +i_client_private_textmessage_power,Client private message power +i_client_needed_private_textmessage_power,Needed client private message power +b_client_server_textmessage_send,Send text messages to virtual server +b_client_channel_textmessage_send,Send text messages to channel +b_client_offline_textmessage_send,Send offline messages to clients +i_client_talk_power,Client talk power +i_client_needed_talk_power,Needed client talk power +i_client_poke_power,Client poke power +i_client_needed_poke_power,Needed client poke power +b_client_set_flag_talker,Set the talker flag for clients and allow them to speak +i_client_whisper_power,Client whisper power +i_client_needed_whisper_power,Client needed whisper power +b_client_modify_description,Edit a clients description +b_client_modify_own_description,Allow client to edit own description +b_client_modify_dbproperties,Edit a clients properties in the database +b_client_delete_dbproperties,Delete a clients properties in the database +b_client_create_modify_serverquery_login,Create or modify own ServerQuery account +b_ft_ignore_password,Browse files without channel password +b_ft_transfer_list,Retrieve list of running filetransfers +i_ft_file_upload_power,File upload power +i_ft_needed_file_upload_power,Needed file upload power +i_ft_file_download_power,File download power +i_ft_needed_file_download_power,Needed file download power +i_ft_file_delete_power,File delete power +i_ft_needed_file_delete_power,Needed file delete power +i_ft_file_rename_power,File rename power +i_ft_needed_file_rename_power,Needed file rename power +i_ft_file_browse_power,File browse power +i_ft_needed_file_browse_power,Needed file browse power +i_ft_directory_create_power,Create directory power +i_ft_needed_directory_create_power,Needed create directory power +i_ft_quota_mb_download_per_client,Download quota per client in MByte +i_ft_quota_mb_upload_per_client,Upload quota per client in MByte diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/README.md b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/README.md new file mode 100644 index 0000000..91b39b5 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/README.md @@ -0,0 +1,26 @@ +# TeamSpeak Declarations + +This repository contains all kind of data which is related to TeamSpeak. + +This data is used for code generation in various projects, therefore all the data is machine readable. + +- [Errors.csv](Errors.csv): The error codes of TeamSpeak +- [Permissions.csv](Permissions.csv): The permissions in TeamSpeak +- [Messages.toml](Messages.toml): Commands, sent over TeamSpeak connections +- [Book.toml](Book.toml): Declarations for keeping track of all things which happen on a server +- [Enums.toml](Enums.toml): Various enums used in commands +- [MessagesToBook.toml](MessagesToBook.toml): Mappings from commands to book structs that allow to automatically update the tracked state +- [BookToMessages.toml](BookToMessages.toml): Functions that can be called on book structs and generate commands +- [Versions.csv](Versions.csv): A bunch of client versions where the versionHash is known +- [Badges.csv](Badges.csv): List of known badges + +The low level TeamSpeak protocol is described in [ts3protocol.md](ts3protocol.md). + +## License + +Licensed under either of + + * [Apache License, Version 2.0](LICENSE-APACHE) + * [MIT license](LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Versions.csv b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Versions.csv new file mode 100644 index 0000000..224e056 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/Versions.csv @@ -0,0 +1,1417 @@ +version,platform,hash +3.0.11 [Build: 1374563791],Windows,hQCwiLP5f4GIcDG5KQ1T+CNFGqRxyw5MXCHE8KjWRIgkjCuGSryK4vpPy70EURH3blQ8TKrax8BEorHlpnpdAQ== +3.0.11 [Build: 1374830986],Windows,PJvjEuApy2McckLGGnAgw8kB2FE+yb4J/TuUdaLj+x5JVghSBR5tKJDQklLurJrshKynWzYYtokrtgBxTAz5CA== +3.0.11 [Build: 1375083581],Windows,54wPDkfv0kT56UE0lv/LFkFJObH+Q4Irmo4Brfz1EcvjVhj8hJ+RCHcVTZsdKU2XvVvh+VLJpURulEHsAOsyBw== +3.0.11.1 [Build: 1375367141],Windows,2xNEoMd2TBeOj6PRSEftjE0fTSjq9dnqt8ttFVYdS3Kp9NHX/jBNycD3XCnNtsmHtHgQkczq1x2qQb1KFfg5Cw== +3.0.11.1 [Build: 1375773286],Linux,JMTTCSHw+ibyhqCDCWRgby/oJ5uAYHk0/QOwqqI5rNHCKTkb+ce6N+4J38WXAnRmtcEaMb0s30s3ipQBokrqDw== +3.0.11.1 [Build: 1375773286],OS X,BngQ1112epNzhND5v7uDdbClbP9dSWczXKxvi1iRQo+xWt7WLYKJu/05MrW/CtPVtKwlT4PnbfI0Trvw+HvUCA== +3.0.11.1 [Build: 1375773286],Windows,Qfvcn4uQmKETDsD4LbtdbZR8rDetJ26Z/bVbu5SZJjMjGlYEMSbJnR4PtOBshdMSEwEsAJf1G+5tjx+onm2fDA== +3.0.12 [Build: 1378199876],Windows,1uVn+Px0c733pYcYmid+3MwrJaq2KMIzvqIktMkICNhOYPViYfwUqTbFHMMx/CzLNKEevP57HyQ1TFdGdPU7BQ== +3.0.12 [Build: 1378301061],Windows,bbShDADD1HUCnPI7F4EG92k0L5qU3M+vsMOZu94xdMfw6Ru1mo6UZ/ctNnrDPHsFZjcSUPOV2myjurknhaUUCg== +3.0.12 [Build: 1378461722],Windows,3z7xnPRdMYJ3S+w6Jx7XyzpiXI2Cu+zSMG4Gr+F9cgKAWvdFp6dPvysT9bBtrkDWWL+hnZluCx/+1fmEcjXrAg== +3.0.12 [Build: 1378715177],Windows,x6wFA5xqjenf6kbAh36IC4CkrbT8/uSBpgjM9juSt9oxGCXLqHOC2oaYlB1zZSJZjT4sOrnp0M+uOdVjYCzLCg== +3.0.13 [Build: 1380008864],Windows,E/MlNft7LXOD5AdgVE8ekxWyrBXDXmfM+I2GDhUiOxlyIzXf0LLq7xtiq79yNqp1CLT3SYKFtIZhaT+YWUqKCw== +3.0.13 [Build: 1380283653],Windows,7dA+6EbVyMevol4gE3/Cu1WonRjqu1C6pTWF+txApbaiTgKtZ/ky+NVxluPkSDnCxXN1pOR4uGdF6B7LUqQgDQ== +3.0.13 [Build: 1380616389],Android,04JRo/B0zh54n18a61qWr3qFUrEVQeEiy7dyIEVhCLMwY8QJwk7kwG7GQKSxnr0rmRfTzD7iDXMUWlcwgkc/Cg== +3.0.13.1 [Build: 1382530211],OS X,0KNdNcf2zmYUV7JzfKlXdM0Y6/dv9LOlETE8h2mTxq0YitdbZSObUdAJvrdiKX0LH2QP4h3QF2JeXyzjRSQTCw== +3.0.13.1 [Build: 1382530211],Windows,bCIfLPUgTM6C0kNkesvhcxaDPvV9h6qLbYVy9cQVSP5lzaYebZaeDzAOOHsdjKcRTa6LU1oHEdz9D/d+2gxJCw== +3.0.14 [Build: 1387444094],Windows,3BFPkbf8KQ3udBXLoMpm41txWJ2M+vsKzXYVaBMCr4xSiPBcdnol8lUgrBLV3dNIHjGZlZXqmqtz+/qmsnu0Bw== +3.0.14 [Build: 1392643117],Windows,/k5bfFDSb0KBHNO5BBloS2vvVXu2S9iuxRa8L9prP+zbfR/EoGuzz1Vlpm/pxxeDQpcJ7oLog9wsdgBAF0nVAg== +3.0.14 [Build: 1393597517],Windows,vKRbu9Nf8d54bAEJAywHU9qIhpR89dvcmq0ff+Ak+umKqLKzMl02YwP9qx+oSgj5UQOpt9nMST/8puhHmD9QBQ== +3.0.14 [Build: 1394114560],Windows,mxBQYmj5bfirNWiVvbsFT8ybN2oov3CQ0fQmBpHWgBBJk9EM8NKmqMCpfpqVLFcubkCK7gs1hbYRXQ5DhuixBQ== +3.0.14 [Build: 1394624943],Windows,F0WIO9sBVzG893AtX2Jfd98cH6yZPAnfMBNvBlQbAIfvfyiq+cbjZ31AUngEjq7UPIYdnYSsdRX9hczwdBrKAQ== +3.0.15 [Build: 1401808190],Windows,Bo28W8+xHTRqVAiayKwRSmp1iojqY8NhhuhjSbvbovx9Mby8YNTWdY7/HHCfOt+nEYLhcGnxcssR0aJhShItAw== +3.0.15 [Build: 1402646489],Windows,Jv5wg8X7HZv2NwbAX8b9L5gyDFN3mPI1veCRV/IbxwvRVzS0PL1vvHqDJYfyjIsrtM0VPLBhnuF4PswmEdueBA== +3.0.15 [Build: 1403250090],Windows,FKKAHPwV1swKwH6mqHqdcGuYm8o5mZw4WreBxJrQjOprC3NXXcJviPe0p7EZPI810HOWMfmQRUgFpggoRL8kAQ== +3.0.15.1 [Build: 1405341092],Windows,b+hr0KQWOVW2WEn49BmNb08R9zimsJcThm2gEeF7EAgRUeUDYzeplh5HrHmda0ftbbnrzWV33U/GOo2LAs/rAg== +3.0.16 [Build: 1406898538],Windows,UoK5KLpRJfF9KnF9EURK8CbdI4WgjigfvVVgSUc9lokIvCpFTYwGuKfgL4oW8I1ldnzHTbs1Q0gtGcrzI0KwBQ== +3.0.16 [Build: 1407159763],Linux,8776GitHAgkFPfOLxEh5x+Luuh4NrYPEJUdsUzNKndcAuWMYjwQTZkmeZOeG/swdn/p2Cg2pRfZfsIFSOAUWCQ== +3.0.16 [Build: 1407159763],OS X,vLAH2cYjkF/3sQCgr/zSmtffXcH2flI2vOnUP3uNIDSm8gKO61Q2hOdQaUzXE1yekLSMx2E9RYz+OQjQ868KAw== +3.0.16 [Build: 1407159763],Windows,Y1DuQGXo/8/rYznEGyeQHgpvZMuiCH4FYm4QVyAgLYyMpNpc/LM7XetVWhDQxGsNejkN/2olI7GVJkt4X+ooDg== +3.0.19 [Build: 1435141265],Android,9lfj+Rx9nTpxIkhnLLubSMZQA7NcTGVxrOtz+ID4frN+1u2NVTChx9lht4RDSg58b8N6+LKIZIl8b8mIcNP6Dg== +3.0.17 [Build: 1437491062],Windows,zlKTIfyJfjeXw9tL9MJsu5RLqKf1RrcNC+c2MQyoVwYBiSMpGJJ8KAyKtyDdK6WiKM0iIF5vjCnYBXAun9dqCw== +3.0.17 [Build: 1437730067],Windows,JDOrqErAA93ukBMRfhI3pDqHbvIQcF9uHAJjZAlR9X1/1aESp9TDwatFAXqXF78OJA9EI+E5XTheL+BjXTwHCA== +3.0.17 [Build: 1438160323],Windows,TtQjq217fCW3emP2G6VECMsXRWsMyt8RDs1u7iPUlRUJvGN86REPvCRBnnF3T0nwfVsqqct40qxtLzhkkYwLCg== +3.0.17 [Build: 1438246387],Windows,K+aWgISXjmTdJYXD/lW9du+RAz3ss/3nMQeUhHK1mHEKKiPe9pI+uizi+yXSj3B4bKFOzTpmrUayHVO3aSL9Dg== +3.0.17 [Build: 1438673913],Windows,znDjHvCgmQF/jQKTK49X8tnXqF7AGXfS2XYcogww4XxNTBxp2tf1aFc/jgboKco9EuVa0ku2cf/xg9wW3Cm7AQ== +3.0.18 [Build: 1441371697],Windows,7uMCLHsNLl9pqL8m7foMBh4qsQZQ84eumhqWW7+A75WbQWFfN9XQ0f2UUEMzDQxbbLwWFuIO8XkzI90LbLG+Aw== +3.0.18 [Build: 1442498553],Windows,NTcB2oaqPYbZRFSIccNpPHr39SysqffsBRS+AmYicYxUhSj9lO1NWsRTLF9fQOyaCP3m+DAfUZfRgSG3Atv/Dw== +3.0.18 [Build: 1442913547],Windows,qBdVDaq6KdRBago4oxqd2E2vnepEu+/i1s6nSPfQm+3Wyd6gwmOomFrU7vNR0cmqu4fPvyWb9CnfYJmqPheHAQ== +3.0.18 [Build: 1442998335],Windows,vUgm8mJoeVLBG6qB2HcYF7YNG4D+H/4edILaZbHze2Unua6mrBvNmbtRkRtmRyDZSd7sVQHMApinRDgGT1mUBw== +3.0.18.1 [Build: 1444491275],Windows,xqfa3CUd2GFiTqjJWYzcu9ZbxVVLng8qIMKlVxMqWdiM8JrTRiXBAaTBDd8Xc+flVe+rGSIOZTkXRsz1rqjiAA== +3.0.19 [Build: 1445263695],Windows,z2CS87ly6Z6AHMVfs4UjhL+xobHbr/QcjjvudTL7mfrfSwe4Bm0pBaoWw+xlo8Qvtkk1OQeYjZxwUXJOJJ1wDQ== +3.0.18.2 [Build: 1445512488],Linux,W9sU8xDfWZ+eQryTdNxXVXM5Ak81wJpYKDLOiJoJUuEXoxcPnKBWpTr5JPrUzheQvkUYUIJf6WzgGAG2B7GYCg== +3.0.18.2 [Build: 1445512488],OS X,hRZrg1T+25VXJffJoM9hV1qPe90HHrjbuHJM4SOj2QIasS+5bFSgzZ50/zus7Yzj8ZUovPWwn7B7WwdyiU29BQ== +3.0.18.2 [Build: 1445512488],Windows,F0hY25Dtja0wcU6dzC39rNuYbhnDAbIwPHC3VO9Oicf13kUY2I2g6scPZ3p195Cw9gUYdBIRYm8ucHEhtSeWCw== +3.0.18.2 [Build: 1445516611],iOS,TEC965pHLJhoiNA2N95xBjQfh2n6uasS3BRFraucFv/+WgAKCKeoUYb3tu6feO5zvTEEiH6YCsedQdhbU1FFCw== +3.0.20.2 [Build: 1445517273],Android,fp6DjpIL/GlTmI3o2QEhwnXUj/pY7OFvZVPbtFBizI2Rloqm+8i0jG8Iwk05ZBn1bDOF6acPzHjBwZgl8CeWAg== +3.0.21 [Build: 1449476724],Android,X/xPOfXLC8ycGeWMlBc5zbyjQdBj7gYFVaSfG95gcZLoNijUaWDkB8DiqBfDvmef2JgmF8YdKTdmwjUm2n5MCw== +3.0.19 [Build: 1455611032],Windows,oFIR1O/nAb4DYuJFlHQ+KgpljBKdle59E4+iNSneNp6RmhGc/I2W/sUIkkjPOlnWO/7SVCGG+KRzmQPrlvggCA== +3.0.19 [Build: 1457598290],Windows,FNmch2Flbwd+UFBd5i8obSRyV4MZlAjYsljWzklqWFOE+exiYYJqYGH2mT7+CmaxwJkzVHlggykRMIuwj9wTAA== +3.0.19 [Build: 1459504131],Linux,48s6oiT+4yKVJPsEzbPUZ2L2LqrKJ0bixxVmTFjS5f5EsfDFbD8bl7t3V+OQd84bgN7t8W80B/fjEW45IszpAg== +3.0.19 [Build: 1459504131],Windows,JoHyZHF4k/a3+QH1zPNSEzc40487fzbpssyRZtoWB5kbQorAJgwlpcScA08J4vjGoUbdaTZsT0vCw56wo/Q9Ag== +3.0.19.1 [Build: 1461588969],OS X,J4cWj2v28tC/8uRqXB1nnAQPfFngOFE/E4Yx7uKMY+Cb8csFrhsJW4J8i+t3dpvZeMJ0BJnB0a/dZ1iL4zh1Dw== +3.0.19.1 [Build: 1461588969],Windows,KYo52MA89dowkYpFU1KixgHngjbJ6F2Yi++5tbaqBlBpz9YikX2gI3sqmU1kP1ghsKCLKM7o0patDH1hv9bmAg== +3.0.23 [Build: 1463662487],Android,RN+cwFI+jSHJEhggucIuUyEteWNVFy4iw0QDp3qn2UzfopypFVE9BPZqJjBUGeoCN7Q/SfYL4RNIRzJEQaZUCA== +3.0.20 [Build: 1465542546],Windows,vDK31sOwOvDpTXgqAJzmR1NzeUeSDG9dLMgIz5LCX+KpDSVD/qU60mzScz9tuc9AsLyrL8DxHpDDO3eQD+hYCA== +3.0.19.2 [Build: 1466597785],Windows,sDOzu7rCGb7kBID2WbBk35DjPijKkXzujnsAtLhXxhkQ+am0JlDOpuU1ISHhq9gCl/Qo0dzc723o0AIPI+yoCQ== +3.0.19.3 [Build: 1466672534],Windows,a1OYzvM18mrmfUQBUgxYBxYz2DUU6y5k3/mEL6FurzU0y97Bd1FL7+PRpcHyPkg4R+kKAFZ1nhyzbgkGphDWDg== +3.0.19.4 [Build: 1468491418],Linux,jvhhk75EV3nCGeewx4Y5zZmiZSN07q5ByKZ9Wlmg85aAbnw7c1jKq5/Iq0zY6dfGwCEwuKod0I5lQcVLf2NTCg== +3.0.19.4 [Build: 1468491418],OS X,Pvcizdk3HRQMzTLt7goUYBmmS5nbAS1g2E6HIypLU+9eXTqGTBLim0UUtKc0s867TFHbK91GroDrTtv0aMUGAw== +3.0.19.4 [Build: 1468491418],Windows,ldWL49uDKC3N9uxdgWRMTOzUuiG1nBqUiOa+Nal5HvdxJiN4fsTnmmPo5tvglN7WqoVoFfuuKuYq1LzodtEtCg== +3.1 [Build: 1471417187],Windows,Vr9F7kbVorcrkV5b/Iw+feH9qmDGvfsW8tpa737zhc1fDpK5uaEo6M5l2DzgaGqqOr3GKl5A7PF9Sj6eTM26Aw== +3.1 [Build: 1472203002],Windows,0HO60MuQm1Emn+G+ai8aJWFwcFF/y032y8pnoFGSgtMZE8RfuEmb+epDHoXlSHVwHaWy6pAafU5GvzAtKmFTDQ== +3.1 [Build: 1475158080],Linux,G0j7r7DswTMF+Fuqroy6/BR+tn02AOy0IZPlg9ZIW6r2m79yudZgrbm1TB4XoUpiFfex3ImdjOQnaFRQPONpBg== +3.1 [Build: 1475158080],Windows,jVCy5/F04fJ1aFFiHPXClAwNNHy9V9VcQP/b4kwPBTs242hqt4hyeK8kw/iFnTBtvdE44lv7ug4exrrXAh6jDQ== +3.1 [Build: 1476372595],Linux,rJDhRKN4NZhUZDVVK33cIvBrxCyc/UT4casQfBAkD8c6ZgL0J48BYIRPnGGAauwZyJtEyJieuZUiMRrZ1t6WCw== +3.1 [Build: 1476372595],Windows,RFV+pRwf2vMW/uflREuz0PE1K4J/EnuGq36DSggBF6wCjNmLv4IHokyb4rN16LW/EWZ8ny1zZrfdp9oRtb99Cg== +3.1 [Build: 1476720122],Linux,q5nPwQYNVpRIHr3kIjDECqgI55XRRjJnwuSQF7oNDO19KObGUtLiOpvnH70/5lQV/LnTW+Y8MOAep3UF4gRuBA== +3.1 [Build: 1476720122],Windows,Vvypi6dNQifos6pVSYKx5tQJSS/fyx4/3N8RWLnoLqSqrOiwepc4pLd3F+mafm+dSC996FQNNATGDPGPxsB/Bg== +3.1 [Build: 1478701553],Linux,BDP8PGSwrXJjyZAX2FUPnII72ovKOO12cr0B17cUS7Kvueuk5xRi6cC7q+sz8yOOV/+JIDB/RZix3mkSeAVdBw== +3.1 [Build: 1478701553],Windows,6M7zXboPykVY5FP1LFeDho+BtAoWXKiT5gyIzRxm/Ht8BY+dVFTLEnGrzEFwHEjo8ux0ZVAE9uEwqVCEcvYMCQ== +3.1 [Build: 1480583762],Linux,4TE9KGToLdye1zZzEz1OSjF2lsSRJUtcRB00nNvdSrhNCJmpyuSyTu1NSJxLnOud56B9MF2z2EQo4E99rRqBDQ== +3.1 [Build: 1480583762],Windows,IGq93SEt29FgghlMGD290LEsWBxQ7gW+qZy9Qok1xUiWGsxVSivYrtJ37V9jCA5pSAD3XOXui64+6cLiUN5LAA== +3.1 [Build: 1481641346],iOS,SDH0QNTA1wDQdfIU0HbcRugD3qkkPHnvlSq/IeW/I4A2myFQnDbzm8ilEGR0vOU4NoTae8CH5XsBmRqwyPIeBA== +3.1 [Build: 1481795005],Linux,xpJQcdaIImbctnJw0PnLQOIZBcmN+HDGcjxoIW8So7SSdSYLyUI5lAECWaCewbYmNKqaO85YqXPiNXfOBM5fBA== +3.1 [Build: 1481795005],Windows,3TpZZM0V+PKHELFnsfRPoKjEFfvfHUL/6mUP5LHbI3nvmdOjRqEEKi4ndXZG6OpWOKQ3VeadHDH0KBfD8EI2Cg== +3.1.0 [Build: 1481889010],Android,eH8svg9XpltTbw+UYkQ4ixfqpbEAhwO9nmDDUWuI11swEU3Ye5HKGlFv70LxHZSgYlEqEH/N1J9U4ygptbPIDg== +3.1.0.1 [Build: 1484223040],Linux,xWfxm14Vw53mTMHuzeaIM428KkoI/2wuoR4O2TIuy2Q7ZpwaN48vG0rMJbUQNVycP8rRHg+bIGuFiJai8f5dDg== +3.1.0.1 [Build: 1484223040],Windows,oaaorJ4co/sS2m5JT5oRiu9AieW6kfFY+RENqPfp26iP4pbWbf9GcZj+JhDA+/JyLpfueCcSulZSRRbash2JCw== +3.1.1 [Build: 1486051051],Linux,UvsdbWQht3KHW2bdgfSYsh25G2091NE5MK4qbhmajLt2+v8ikreJGfnEsVACn54htHKhp59SnJTWly9m3c1yCg== +3.1.1 [Build: 1486051051],Windows,41Ed+R6kN3IRMzxd55wiGjKlz0Kj5txi2j/K/fO86dbE16sTTWU60/5Qom61p0OzjKXn8rSptl+2q+838lKVCg== +3.1.1 [Build: 1486485240],Linux,NAyvIAYKfS8I/e8zug/XXg8XEbjjFJQ7CjRFaBQKLoPF7W8GfTXqGzFdIRmllg9GLYKm93kEf+dCFNzkLIagAQ== +3.1.1 [Build: 1486485240],Windows,CZIC/dYL5ntRZZKoa5OFf6sJUU+Fh7nyI2dSegOxoLO0kJTkVVp8FZ23j/gOKvFZZyToQRkmNvHnBAYbp9XsCA== +3.1.1 [Build: 1486712038],Linux,umeERdZkG9pS3oeJTirnYK9Q947j8lVlszz2VXBPcjhQrsiKFM6lIkbj3K2HSqA/hJ+sUOcuZgo880PmU6ZdCw== +3.1.1 [Build: 1486712038],Windows,sryyx++NhRWKDAo+Tnwv9N+IrOaQBP0XjjDszY0BBv0YIMr4jmdHtgrwzWkUqhU7kfql7qBWIhlb/r0l1ZHeBw== +3.1.1.1 [Build: 1487668590],Linux,0B4RK2WOu5w39+CLznQtaexYeNqqBwU9YHBvSLw3bu+OAne8XtFc2NJzepjynrxwc1/xsmrm8uEZJzqzF+TcAg== +3.1.1.1 [Build: 1487668590],OS X,WrETtyinA18FGhiDC458SwfGDozCnM+euEDmCeyC1YgQnfaEC49FtoVAbw2fry/daonzgxmyNBymVHhoUX5iDA== +3.1.1.1 [Build: 1487668590],Windows,CchjMitGiVGfRlGph0D1mDjOCJCnkVxR/WuYvNHdPyeQUCncRWML8jYxYfnhRF6CzViwYRnsmZkN+W5oenB2CQ== +3.1.0.2 [Build: 1487778817],Android,vX2nNdYEMnwAZ2wAOAp0hsDhg099qaLv5r/rzNrfAMpXfI3JnTU7bhPxAZIh7qGk3+Geh7ffuefwoHBQRoThAQ== +3.1.2 [Build: 1489662774],Linux,W9TgKEviDgWvrQErw8vaoQcPboaUx8xRL5MPoQzlur9eO2yseHgvzkpWGYqSQyCI+ptcCpTHaXRFym0imKnfBA== +3.1.2 [Build: 1489662774],OS X,571chpoaq6bxLisThXfiU3zB7pU0NOmH/Qso8ABTR0TXmcK9Y16pYwmPFs/d7fmcHVeI3xSM4dbgzKjRSB61Dg== +3.1.2 [Build: 1489662774],Windows,5Aaj21gGFtrjW9424ezfLa1SMQBpZvgQgcJLZmrLoNMe4XebBPV2s8rxEDAIodfFpruLxLFbFpH63A/BGnJyDw== +3.1.3 [Build: 1490279472],Linux,Y1M2TQvKLGmUSP4YPuTBQOeUxmF+jaqazFXuN4v2gOKP8QmxyYOsg9PsG9z7SFYQkgneQxs8QdzC+IGo0bOWBQ== +3.1.3 [Build: 1490279472],Windows,7RPY2bzJmMdgVX24VuKD3lTnYYb6yHWqfn2x21tFOjXL9q+2t7tU9Vy8Bh5/IpeiqklUHTWc23mWpYOCoW9eCA== +3.1.2 [Build: 1490288199],Android,ODB8HVKiqknnIIhKVxhz/YoO6cbm08FFSohoDyTSR8/PQBAkSccjKWCXHgBIlml+nxJ4dOBs94+HBXfDHUQFDA== +3.1.2 [Build: 1490291439],iOS,mTC8yRgh04oHF3jKleXVy5324ysJKp2LQIUhWh85MXqPTjh9CD0pgiUIoTuCzDQTNutAzRefcLVwniaIhNCnAw== +3.1.4 [Build: 1491993378],Linux,wJPx0S2Q2S8EgSEpZhu+Yp80d6xVQDX5u9DYgm7XxI7sh7gJIoBbdaE5cfjwR2UN6XFyV+V/2AV4stB3CxtgCQ== +3.1.4 [Build: 1491993378],OS X,JSg4RcthTCvJUSXTLhrmdPt1592Nk1lG9AuXg+yIyOBL6tlb030+hXniu/QrI2NeNHAMYxTJgZyi+rTnu6sFCQ== +3.1.4 [Build: 1491993378],Windows,rwdyEwnJCzbVfNCqbxMrRyhL5BSYqYSzKQkeZ6m5KImc1F8VB8wEkwwwyxoG7SimC/sxIyy4h27CjBFP6rcgBQ== +3.1.3.1 [Build: 1493128735],Android,Me2oMSfwCsCCGsBtgDTy+TCidslmK66JxQVR2qFsKv0v6izk6o7jzuPIFdL8Fo4rVegdCyuXPbzmOPe9j71YCQ== +3.1.5 [Build: 1496989945],Linux,874htNIqcKQfggAbYrkm3OaJAaqIgWmdqKxQUpi+g1+2+aFf9Uxb407ikxG6p2Pgnk8v9Oo/chpX7E7ZCUvfBw== +3.1.5 [Build: 1496989945],Windows,vCK7AxxVis7dQyEy5dwV3+ctSX3RUudj6OoQLW0AUDkYzkr1zp17srD6BQNZUBpaQRCQJqqDsCT4dYIpxt1vDQ== +3.1.5 [Build: 1497432760],Linux,xbASm01EnV14LfoXSPARGULDZRzsn8aqQkkGuHv3efXKc4hDCVOcFglYFi/aDbLc/KkAJlHo0WEvXZHNOXlcCg== +3.1.5 [Build: 1497432760],Windows,9yBvw4TOcihVsVlN37Gf3bV4EF1nyLMbcq5E+7WbootiDC+GNEA8oDRSeGadHhquf/B4G2CIDhhvjYW/X6+rAg== +3.1.4.2 [Build: 1498644101],Linux,Rv3SzHDwLIkuUqySQhn279jf2b7PPzCQH2q53zHWH5qyFL/Qw4m/n7ZrXEF46/sUSpOPFPYjfKMKcN/9IRCoCQ== +3.1.4.2 [Build: 1498644101],OS X,MMVozpqhiRqPHFu+skm8ftODA2waeWJx2trAx205schgiJMz+H4KOLfoa92Fjrn8kAQZxpA3krUro/iBpJYkBw== +3.1.4.2 [Build: 1498644101],Windows,WtscrpvJG13kbF6aoVzsGwQuE/WwR1b8++ydDc8IpmiXLw+zFC6zFUvLinOeE0zZgh2Hs5Amp3DZoPJSynOWBg== +3.1.5 [Build: 1498740787],Linux,pMgKa82Qhu+5V/S7EWv0+sChqG3Hcy8k5cp1EN6TG2wiZWZAoWR2GLC5CW4+SS4fRUrLADnR+PaEjB46N3T0Dw== +3.1.5 [Build: 1498740787],Windows,iL8prlQuMXIMBJrszzjyPa7k36GA9DsyVEOg5L9uoK/EFc5lXH4Pv6TYj4yPZt3p6cd8OMkPfuHfXj5bn8fpDg== +3.1.5 [Build: 1499699899],Linux,cdnb57y0GEtvwgHoubRU9f27CEeoA4iho0JuAzmdFrTArFrFSlI9kGKuypVgjKGhv/+HcVzDCj/ncM8X567xDQ== +3.1.5 [Build: 1499699899],Windows,muYzth+vZLUobeluM0GMW/U59T34gn70zVpvnIyT5ADWlcsRQ3Ex0t2iqz0yTqcgn7/e0wAmqS3OLL2ctFT3DQ== +3.1.5 [Build: 1500360741],Linux,lCOva9P9UYmAUw1s6je2f8/44GQjj1ijeK7PadhYCY+oJp9nu1gy/MVD5xAkIuYwuJlOhac3JeBg8XdEOUAMDQ== +3.1.5 [Build: 1500360741],Windows,0mCCWSFXyuWqKLM95/b/8seOCljvFCuupu5tst6G7hzTWQlPIdlsypdnEW+uN7XJwKacdQ3axHEmiTo6GpcXAQ== +3.1.5 [Build: 1500537355],Linux,Ea/9gUeh5HuXyiOZ+gRDPOn0rDHzXDVSYB70qy/BtczJPZn/0dDwQgRAF7/W6vHcaH67j+IF9AtUpuDCA6yzBw== +3.1.5 [Build: 1500537355],OS X,oiS3ROFEy4r7zhkmCuj4cro2kIwntHNpuTFpFB+zV+AkfwX3Y2F51/JJPWG0J63tPR82n3ot/JiDkJqPKBJpDg== +3.1.5 [Build: 1500537355],Windows,O9WqHB9oX0qe9AXIYmJm0+mzl6VLxNvrGF0lGlovLaig5MXUIwd6T00NkCj62OkBbzM3eECs9FUuJk7N8V0dCg== +3.1.6 [Build: 1502264952],Linux,P5cZgEH0ZHNdWRHLnXVwIe3xUB1jTqP3ptwqLkTqdA1d8maBliXF4uWVXYvcWF8vG10zhksMiHuhsf/v62L7Cg== +3.1.6 [Build: 1502264952],Windows,3l3IQ5y4PHAMro9/i2UqBT7xGZUE7sUcyjqWdhG+5AYhnVC5GuHnv4l44TtPneEcxWIYXFtoFlr2rlPhFwrkCw== +3.1.6 [Build: 1502275280],Android,sEg1lt9N9lck/Kub6/N6kffI28dEsTrybGLsLc/MeWWfZ/t3EoVwwqCcBxEbUZyszx1htnbnWbd/dYBcrjSCCw== +3.1.6 [Build: 1502873983],Linux,o+l92HKfiUF+THx2rBsuNjj/S1QpxG1fd5o3Q7qtWxkviR3LI3JeWyc26eTmoQoMTgI3jjHV7dCwHsK1BVu6Aw== +3.1.6 [Build: 1502873983],OS X,ELteM70OI6OkQ6hjOr1m1ZXxDtOeCI7pqO2ce7+Sw7CoUgKlqxreTKVSlHpD7XfCEuqo3AdNfxWUNAaBci3DDA== +3.1.6 [Build: 1502873983],Windows,73fB82Jt1lmIRHKBFaE8h1JKPGFbnt6/yrXOHwTS93Oo7Adx1usY5TzNg+8BKy9nmmA2FEBnRmz5cRfXDghnBA== +3.1.6 [Build: 1502881949],iOS,DXVaZKOza0ivNdKG66VPD/g+TYwio6XmJlCfralcUIpJuh3PI4ZgAnjxzXONzTmgFm0O/rb2iN/vvxIYwhcqAQ== +3.1.7 [Build: 1507896705],OS X,iM0IyUpaH9ak0gTtrHlRT0VGZa4rC51iZwSFwifK6iFqciSba/WkIQDWk9GUJN0OCCfatoc/fmlq8TPBnE5XCA== +3.1.7 [Build: 1507896705],Windows,Iks42KIMcmFv5vzPLhziqahcPD2AHygkepr8xHNCbqx+li5n7Htbq5LE9e1YYhRhLoS4e2HqOpKkt+/+LC8EDA== +3.1.7 [Build: 1510583507],OS X,OmMyxPhOHzkVKzOmy8U8CivSF/c3f8bYMhdAPLHVM6k2Ws69IzMUntr/yilFw4w6hni6Bz/Gd8Swe1L2YqCtCg== +3.1.7 [Build: 1512049856],OS X,CRpQYBwQr5L0vU9os6s/U8e1X7kvGAnc8iUQ67TKxywSwH7cfPRooLCTOVtevt6g0Xs2O+C1t/DS7wzyOHmHDw== +3.1.7 [Build: 1512141423],OS X,PP+/cBUDtSyV0k7lm8aYvYWAs28KL+KmXa+f0pUpDqjQDKy8dnDzJp16F4YGJxJ+2ODGPkp5YQYwts3m8T7+CA== +3.1.7 [Build: 1512391926],Windows,n2Ntx8GVlLGTmMCILg4QbXkMA9CI5FTSfa3LcrOsz07pK4FEPHa3u8eOD0g9rFMdmQSia4jYyMDWR1KomIkRAg== +3.1.7 [Build: 1512665843],Android,J04O7RCgM3ZlecpZz5H8IgWggyCJQB5KG4/MEEB5/mrW6XJEK4J5IpU3jKztkvy54B8Nrj9tbwMaRujZfILSAg== +3.1.7 [Build: 1513163251],Linux,/j5TZqPuOU8yMYPdGehvijYvU74KefRrKO5sgTUrkpeslNFiy4XfU7quKW0diLHQoPQn1t3KArdfzOAMk8dlAg== +3.1.7 [Build: 1513163251],OS X,41eIdGPhullYi9ofXewHPXf232ZbepovkYsmR3Kc4CPlA5d/K599m5BZYBYwSz1/YfKvbTzzg0VE0FRbhcZmBQ== +3.1.7 [Build: 1513163251],Windows,tdNngCAZ1ImAf7BxJzO4RXv5nBRsUERsrSOnMKVUFNQg6BS4Bzag0RFgLVzs2DRj19AC8+q5cXgH+5Ms50mTCA== +3.1.8 [Build: 1516099541],Windows,nwdwhrNjGH5IhaNoYGpJOKl0jsSYmq5f6jb0Y7ETfNNf+NqF6djEd6grCUlR7moKnkFdpRFazFsZD3E+dze9Bg== +3.1.8 [Build: 1516349129],Linux,d7zSAZK8UBKLhZBl/QBSXpSOnKuSDOIG5dybmJumkO8gnH0jHvpdSblyVoj4r5J6A8V00ocp26Y9U7mo16qQCA== +3.1.8 [Build: 1516349129],OS X,T4Ml4baqYyBOZYpt1XjxNDfkqe1iSZQoeCsMQqxVvvv45yifliizwe+5hkddsctxwY3Q1P1+/iTiW+Log5DvBg== +3.1.8 [Build: 1516349129],Windows,scnT3q9ViDVUSKceKSPQ4p50He1m0tlT9FsxSj8YMLfOoh50SKbqZEzrRTJ1aGwsGYb8x88JhjdlhDBRPhwhCQ== +3.1.8 [Build: 1516614607],Linux,LJ5q+KWT4KwBX7oR/9j9A12hBrq5ds5ony99f9kepNmqFskhT7gfB51bAJNgAMOzXVCeaItNmc10F2wUNktqCw== +3.1.8 [Build: 1516614607],OS X,93J+FDUbtRjonzFnQpGdgN6+o4jwI2M65zEKftQILCdZlGHGfc7z5Z9+TM6nU0/pnPgTqvKmaw9WYPsh88iCCA== +3.1.8 [Build: 1516614607],Windows,gDEgQf/BiOQZdAheKccM1XWcMUj2OUQqt75oFuvF2c0MQMXyv88cZQdUuckKbcBRp7RpmLInto4PIgd7mPO7BQ== +3.1.8 [Build: 1516718352],Android,XUoyBlHsOy13YVXlfDIAGsVEiBvxpAtnK8tU+jljrSoCQMCk7GqkYmwse/t9FG8tWVP+EkO5MUNunp6NXYjOBg== +3.1.8 [Build: 1516865456],Android,sG/qsKb9iZpBRXFSYY2Tuq7ZLUKHcmgA/6Qe/cx35L3risqoH4aGkPkDicuKtaQi8Ikh4IrQz6xe7V49M+8VBg== +3.1.8 [Build: 1516887927],iOS,pdWyIOpTWECIdA2NExrjqY1a7Q0alFyU7MgiDJYdiUXAspusOHwMIcfKm7oAh+Ty2gcgVgOh8wAPyZcKFKYXBA== +3.1.9 [Build: 1520246719],OS X,gTeib0sqVKETwmYTAD6rrzgmqDHE/smMgOPTiuHPj6218mgPkhWuRWAE8pD+gm3cLMBfRl/2XlllMViYbok0DQ== +3.1.9 [Build: 1520591856],OS X,3Kf8a0ShGCPKCnSREnJe40BxQ/jBPoBx2qFM5JDYHsQPPsL1sg5seapmMBdYoqMnkYYK5IHN0eSkrnwzXTPpAg== +3.1.9 [Build: 1521637641],OS X,XljC4PFgstQBBbk1dPwGWSVK4eGIJCURlbONVTkGsatSXhDqfNdpLabDbEkxc1FTjcnNUAzNwDG3rn7uiFZ1AQ== +3.1.9 [Build: 1523609596],OS X,ZtO4KjCcr1J/+ENQdwao8kheUQkcIhOahr0MmnToGRoUtVpVdXVLYn3esU2i3rG6XLLpfTU7lWUAhlWw6G3kDg== +3.1.9 [Build: 1525442084],Linux,wBcnfNU7FA0CvFeisKhywZWzmUqD6IBFbYQTveMvxWowXUjWwNHTg9tbRLQ1YgBFDdlOwV36VMX7aAMXMX2rAA== +3.1.9 [Build: 1525442084],OS X,WVaMmYPig4eG2JUM8cMMW2MA7+IoRoPUSr74CPe7oS8TLHGjYxPr1FP88op6YsFFQrPJysWmIsnGR7BiFXjHCQ== +3.1.9 [Build: 1525442084],Windows,2SLjPTFXM9hQyNkeEGYIzs0fkBffyhsh5z+ZuaCcZdDfM8vgRM5lrAU6KNspFjLddcvw8cXw6gxRY73ZHsRVBg== +3.1.10 [Build: 1528537615],Linux,jEfjYy09JfbJPZ+W3fwqygOu8uuc5raYTGpbJ5F8dHLHpqUfvmCyJVKoXRieMNkmPzeiylsUc9/HiV+8bt8tDw== +3.1.10 [Build: 1528537615],OS X,AJMF6gyw5DBtzAuW7aA7YcZaLIgOHFappwzWtE+0UUMYgMjMkSZ1LewDaW3YyRDHuLG5Nb7X26VNhFNZu+ohBw== +3.1.10 [Build: 1528537615],Windows,+/BWvueikGg4YkO1v2uuZB5vtJJgUZ5bL8cRfxAstfnCVdro2ja+4a+8rGUzDx8/vvTZOUVD6U95hnWb638MCQ== +3.2.0 [Build: 1530183207],Windows,6LYlvxFIPCVnYmmFd64H8SRmxsX+y3IZOe9ju8PbZLI5j2K7ni6Z0BfEyhVprYP9VA5o4bXVrV+uNbdGSKnjCQ== +3.2.0 [Build: 1530280071],Windows,c2M9CuucssLhQVIoye9KapFVYK7CGs1xAb6ugYivrYYs6AqkxTPP006macLaQjCrVeKTJoJN0xS+swGQMfj5BA== +3.2.0 [Build: 1530790120],Windows,hs7X6QfM1zdlKKCY2GwMpAEe3/joZqWT8hPdNj2cBRNM4zEP/V4A6nNRtQNwNbaRpWhbqdNK5Zk3c2DkKy10DA== +3.2.0 [Build: 1530859847],Android,pjvK4iy+bB5X90mQI/Rzbkes27EokJjSOoGSXCqpjuPFj8Pe6BXt3M2E9VH/1Ec2hf8h51mr3D+cycGQpHq+DA== +3.2.0 [Build: 1531390529],Windows,OLjamtIbU0PxYhLtSQrYbi1yhZZrJbGAGQJFNtZ4DZ2Ae2eeudQWY2Y8r0T27rLNckdyFqPydX0PrxKHxnZ6CQ== +3.2.0 [Build: 1531481279],OS X,VlxQyIng/96p9Kvag2U0epcVFQUubJ+cVMUUxut+rHh6znj3k0NPL/c9/vwxqOXwsCueebiOIEjieOzaPv2tAg== +3.2.0 [Build: 1531481279],Windows,Y74ib4ayZCVp7el+ou1X1k5qCjRf8Vg9zX3ACqbH7jtIricC4Mhds11uvhE7MNa5ZWPOU6OPrHmLlMW8+tgvCw== +3.2.0 [Build: 1532529142],Windows,GtYKBlk8a+tse8WnBVE9XPxg4fHVnscQ6GEQGMyG8MQbZYLHw7dwEAEmtQ6ygWerwETUVKxG+qNfGWZAF5/IAA== +3.2.0 [Build: 1533289185],Windows,757W7J3m6dYThNzDTLZzHfbU1bxqcKyTqjZT8OOZj+GQsyvrUhZhBe961sTqH1zZaNYuzNKyzeIXL+pAS9iGCw== +3.2.0 [Build: 1533739581],Linux,Vt+iPp952TU4uKwGXY0L61mXgBNfXg+1+16fnS0snPU9fhkfOKzdPN4rBELOwJ5XzZc33KdVC8rzZGYzlQceBg== +3.2.0 [Build: 1533739581],OS X,WkySbYMiHN22ra3Y1cktHyeNikQ4fZ0K++8brc+8ImYhuzrmuzeGwL+QNaPJNty7stTNCfRUSpDzVAWz5TYQCA== +3.2.0 [Build: 1533739581],Windows,TJ1XoCjQz+VxW15qiGInWf5llTBtVu+2m2ShbY0/HWTM7adLyfThq7wzSgr09Fvowibvu91nOFxTlIpPXCAVAQ== +3.2.1 [Build: 1534255236],Linux,betw82OYRNjyhXDHmmUKwR6xfvyPHBMdkn+jukQKNG8PPLKOfLFb0OAMXPZxp9n8gio840gFowwA/jnbg/OMBw== +3.2.1 [Build: 1534255236],OS X,AWbZhd8XH+s7uu5Qkb2QkdDcc9/WXfNu2iKWD+e6m2oTrOmI1Jt55SsyDTvkpBpumnWsrtR/GI2nK9HbmFhGAw== +3.2.1 [Build: 1534255236],Windows,RtNOb2UrlXwwy3lplxRilvknygxamwb3eKlRRAsG5YjrMEikStl/Sf+oJgFUFBBMSJ+q+xPx3+xfOmMxAkB8Bg== +3.2.0 [Build: 1534407950],Android,rY2Hhki/5tJZW5YyJI6S9o9zuU4IGFpONwR6JBJ3Q7Pukfj08z2brFwCmGR61RzH8IaoPxoAWXIHQoHp6fUABQ== +3.2.0 [Build: 1534410132],iOS,BIWgZdgGSu6yPwCiEDQuORaLRqV1Z17ZLcxYdLqM2hfWXiKwBOO/j5eH4IH7LGubFfDwdGcVW2RUYKATpaJAAA== +3.2.1 [Build: 1535010120],Android,HHlJgd/XKWFdPOR5N4n2hpsjZ3y5b+4f4x1tLk397GI+gcALWlehtQDSaxe2R975/dFcEWmHiFd9zSC3tsecDA== +3.2.2 [Build: 1535010838],Linux,7uY1DWoJD2x80002ha6jSkNRXGcfHAqS9hdJz80JjafvhmxlhQKSwfsofFjEq10TI8LFbhLdv7TQxd+gPyNEAg== +3.2.2 [Build: 1535010838],OS X,qvbU2yq0wzSxPLPClraVmriM1Z+yB9qq5UzQ+gxuwE6dG8k/eosJH9xBhL7bhgcJKRgY2vsL00vbiLk19c+rBA== +3.2.2 [Build: 1535010838],Windows,ZUdctNEUa/SrRrXbqFCESmKIVDJj0nJrO0vwvxDNJGB/p65vf5GqvX9p625FOXO50dxxHPIIAvJDEjM/TxeuBg== +3.2.2 [Build: 1535459906],OS X,+aKFdPYAhzafs+eBAfjYn0v4lVlIEK0Eq/KLT8qwI04/bZ/OYw7eQyioABDQXMpE/7PVt/jt7/AzlYWJikZeBQ== +3.2.2 [Build: 1535459906],Windows,ErpAeuVpXF2IMeqeCTdoaKLEKSbQkquGlr/QsohLnxwcqdW3ltuPXofu+nJRK8IgRRyDfockqDOHSSud8hRYCg== +3.2.2 [Build: 1536327256],Android,dwHJuheBuCMZlUGz2N+DeyoWokK9/ui0CCV6HE4yJ6fqjoyFIyuX9TqXho63tNKXDa0XscL1U4TOaJlgU6pWDQ== +3.2.2 [Build: 1536584091],Windows,z63aqvx/q/R/SAsO/OcYl3duuj/RuDswghIxI7MlttMqvEuYIQQrHU92kn7TkrnbOlaVCe0F+RFrilckcPlUBQ== +3.2.2 [Build: 1536587534],iOS,4rsRo3H9Uw0kui/cQkaBiqYy8ox6/gC6jDUVktcB6I71m1TeqUYy/IYMYbNSBtv0bmKntvcA0ZU79+zoXUkSAg== +3.2.2 [Build: 1536915823],Windows,aBGFNFtVk/dmfk8cEecxKYreB4ht0LmpFBr86R90kj+1MFjSTevzaJTNywm+oS1hru5VM09Mzlk+k/8JFtWGDQ== +3.2.2 [Build: 1537178465],Linux,P2NaVyWrk5AkG1KE8hTPCT6J0ql0NzLeeII4BF3WarfVjDbekqKu2sQfO7W3OSJKN3cH8w5470csP4LZ+hrkAA== +3.2.2 [Build: 1537178465],OS X,QbSOeAPhPHgZKykNbEAlzGLZe8w+ulxcZXbk07wOBGLK/vWCfQlyIDPUK5DipGBUfRY9yJvxfUx7g9b5dU8aBw== +3.2.2 [Build: 1537178465],Windows,LHJV3O+hoZZlKWDPKH4ZMCoPUarYWwnaUgfMP+Xdm/4sY5NYUYjkVQaU4FS4pqxii5jx6O4cFToG7ekFB53NBA== +3.2.3 [Build: 1537790492],Android,qLdDfrZyNIdl1pDYtyrGbOLZK/Yi/i8PE/a7QOInsEa5/RBz+HW8EBGPvazz+lLZbHrBXyp875NyrKtLnc4dDg== +3.2.4 [Build: 1537790492],Android,cJVVnQRoUWsYSaYKWZ/sIGAAMTpnBDFu8T6shyH5o9AXWLVyu2qRmVVuyvKmMSlEVlYNtVrHIlC2AHtq3l2nDg== +3.2.3 [Build: 1538467030],Linux,pEBdtUvRUmczMmHZM5xmeZuiRP/Kb/H2YShNKGpaat8aPTmG5EF+zsbjUFNWW4tnt43Yard0bWDUsrJ9/mmjBQ== +3.2.3 [Build: 1538467030],OS X,yr8F54NuExnwarhvcJ27f3LvDop1wqwrhyqEVvpliRKi0hLD3e+cW2mJWRkq0eDjPRQ2kzPvBst9yNH1MsuYAQ== +3.2.3 [Build: 1538467030],Windows,dZ1i/CsCaAh4F7Pi2F/FfaBpdTmUuNVsAIRnqm86FUR3HhwBRn+xlmbwRF8gObgFMuwFMCLmawncFWplSILKAQ== +3.2.3 [Build: 1538494750],iOS,YgRxbZGpaxVAPuC3bln8HiCdgyx8EgM37H+VCSjZnn+05+lo1w74P9LFHSVqr1NBuB5YtKNWp0xjHRbBZVJtDQ== +0.0.1 [Build: 1543011433],Windows,0yUT1LLSAOTAMPiBGOAq6lUPnXv2N49clNjQ8MSmhNQmI2lFP1LT4Vo3XTuZ0QX5IBQBxnB9nJooV2Te11HhAA== +0.0.1 [Build: 1543414034],Windows,MoJT06d4BNOJrTlC9EnTi74rpu2rv8TKvXck1FlpNfB1IQO2DgZpHPjQbcpMnkstYFd6WBWVJvM2GAr71K+VAw== +0.0.1 [Build: 1549019113],Windows,N/GCBSNBRQUruUvJ+YM8IxeH+W+OkafgefmerruLOqrD9PRtFQ6WLvQA8rY/egFZPJ0Lu4dfaTDJ8UPLtS4xDQ== +0.0.1 [Build: 1549639384],Linux,iyFuMGDAoSE8LnZuV+ezxQ0iP1dgY/4FB9yZIe2emUnS/go5HA9zx945Clwi7zO/U5xgTLGxBQvDD/IONLS+BQ== +0.0.1 [Build: 1549657968],OS X,8usYZFvBvzaRRLu7EWPT4k3/7Ikhhla/Q53Q/qzxBPH4E3LoJFg1OH+IirFlTNze518j/Qx2ZyJ2RS1oHrAWCA== +0.0.1 [Build: 1549713549],Linux,7XvKmrk7uid2ixHFeERGqcC8vupeQqDypLtw2lY9slDNPojEv//F47UaDLG+TmVk4r6S0TseIKefzBpiRtLDAQ== +0.0.1 [Build: 1549713549],OS X,xNaB5RLET+B+Y02CirR0S+qEKUqwhgQqOAbg3QHDeekc1bl+bJ68FDJUW0LZ5ewY23Vrm5LtXpRCloKIoDUrBA== +0.0.1 [Build: 1549713549],Windows,OgAHgZJmuhL/SMIbmWzGNqvJ47cOAWHSVAcYDxTJswU/B6zzEDD+kB711uqlyFH9JDZb1tbzbi45+NlcMwlJCA== +0.0.1 [Build: 1549829683],OS X,MzkDQHfzv1nZhM3y99c4neMywQvRho2sQ7Pv+SCh0V8H1LaMB/0Ui9VkafIYhaf/gVi+I9wCvM8jDvMgVaCdDA== +0.0.1 [Build: 1549829683],Windows,Tx/cUfXAdy+xB+X9e3o/OgwIoJf7EKWb9mxXc+a39+vNJzganUFUEoHnuRDyUJqZY4URM15/vhbyqQiDnRYHAg== +0.0.1 [Build: 1549895652],OS X,v/sgnywcuwFMKhOlpoKLLuT+6shYyY5eHVSOo9pm8EUzcpHFe5sh8Aa6EIi/Zisnkf3Nt6JrlGS5++bLV6h8Aw== +0.0.1 [Build: 1549957568],Windows,F7f5rksW2FaFQsjRi+6Hs5fUQVqBLk+9TcKSyAxqUcwsG8pTpeb1ImfVHPLdmq0Ua5tofVeSoeGlfj2jiwVrDA== +0.0.1 [Build: 1550066976],OS X,Rau3KBAqvD8p/lm5M26r58zk0KQJjGqqKO+E7bcOLOtikJCbCrceTRATlqoxZKRjE6Ngf3LdsUtsDYab7TO0CQ== +0.0.1 [Build: 1550084944],OS X,xdv6EalStVMxsGrjJHtcaCqHlhr2OzWRiTZrDMYMmgTiorbRbzMYdrQsNw2a6E1efbuBuHs8mLIkAT4y0KJNDQ== +0.0.1 [Build: 1550143598],OS X,sQtvL4f6Z/gBf89kgv02UFHJVufDqKWcS6bPqvNMQHlSJrU/BN3HksOq1Bt4Z1fh/0NJ9la0PuUlMmKg8FAhAg== +0.0.1 [Build: 1550226976],Linux,22vWrtMv2ObaBwrQGw2CLs2LzUQJ94KoXiVuMObXf5pfoIw2MY4ZqMt8oL9CCyQBtKl6vV3CZntLrAR25ljeDw== +0.0.1 [Build: 1550226976],OS X,kXlZanPcXrP022c7tsTaMUVCljTN4dTDHiXlGXDbtwlpqfBZvuw5k6Qm0nsUsX/lK707+2Z9xpU+WLOh3NxkDw== +0.0.1 [Build: 1550226976],Windows,4jX+WqL9KZilTrNvb8Gh6sKjVYSvgAhm+HGDgioifYpszS7nPK2UJmNxKE2wAztufWGueJsD9oEvdQvG4SjIDQ== +0.0.1 [Build: 1550255704],OS X,SfFM7wo/5BA0HxKLHOqgh35LiB5HlqtmHSnCvAiUECBDlXxL8bRmTrrXvRHLUGP+4IvM9RzMbnj9/q1vcftWDg== +0.0.1 [Build: 1550255704],Windows,D8Ci2ZJERAKMKsIBRCPxCsHPaCFajgR30yuRlNdr+QVAHmhsKODF8Mpa/YFkYpdxwGY26UR4iUDQgiBOu09aDw== +0.0.1 [Build: 1550502842],OS X,VfMBVc8YKYh9KpyihQz3c983AAOV83Gss+t1M4jeQ5AFl/+Kn3ZcVZQhjVFQnfWQ8RuVtagJUTTKlDs5XeJdCg== +0.0.1 [Build: 1550679784],OS X,nx9CIytTawoAJdYJo3wT+zTKD31lylYhjUpK8AN6ZpvlIQE95Fm7lkzN8qfEK9NRdG4p3rX/6oVXT+Iv53MvCg== +0.0.1 [Build: 1550876871],OS X,hb10qtSWPUw8gSbdQDILIRgT9RRaCM0mzj4m9MQo2xLv1EYNZZD8svVsV/qrj6uTxtJ8WLS4RrOtkgm9qPC0CQ== +0.0.1 [Build: 1551044658],OS X,b4OpbCAVsZLtkUJ5DWzH/L29v8FZN1+3Dhdi3jmrivZE1TPTdII8OoYuY5spNKJtQma8BSJHjW0XyG9YT+NqDw== +0.0.1 [Build: 1551204931],Windows,uT/wwWZnLwO4dMIlLFYiOq1ot3p2761RNGno3KaGOKRCR7km680zdws2hmgU1lVGXTmmYdSDiKwcDQPckk+lAA== +0.0.1 [Build: 1551459948],OS X,iz304gq0xhX0oYrgn9ehoY8Q5S7xeeMX8gBgQ7CYfrdQnWMVusl8NY7qJ0SJJRQhFo+l/FZBmGGozscluPMgAA== +0.0.1 [Build: 1551711227],Windows,5Js/GD8nfYOfvR5Aa4ef3B3EgItH+bcQC6woFuR94yBDgQ0W8TUQ59u4GGufbjo6s4/16otHLJ48q0+Q4HptCA== +0.0.1 [Build: 1551713318],OS X,l4lTnkGORNFQh6N3Rrm962oaeQVhKnliOYv0aLJPNCw/N2EKLMDQ2HBGdNWQSr/iWevkJUcXFQAAXy1Ql7ydAA== +0.0.1 [Build: 1551783896],Windows,KT+SQaENLWvvIpuGY55oTqOJjhamigNWl48uutyPPJDPZEcqRAkU/lh/+wrKgOl65jsNDuJOHVOlEda8VRMzDw== +0.0.1 [Build: 1552322960],OS X,rCRrdfzjZqAN8MfEm5dM0dvH5DIsTxntEEhlCI+AxNJjCgZKGnygGwXPT4unubpF0AuljnTP/as7QVbDRqf0AQ== +0.0.1 [Build: 1552322960],Windows,9EU17JQJagk/elGn4Tpewc52XsL6nkeyEDgiXBgKD3hPEi+0Froo2urFyosoFaOap5x1L6lg5lf+yyBDNIX+Bw== +0.0.1 [Build: 1552499895],OS X,OiIxmD9ntH/NHcgAImw3bR/VEDQYQR8oQMagFjjbcyQP14nDhcCGoG1Quq8Y+2q58UerHoLYV83z1Pok3zkMBQ== +0.0.1 [Build: 1552572862],OS X,AZ/MCSPFSY4JnB+YhexNtnp1IN71whrShaY+3q5FIBp0/CpNlsqeqZEf80Al1kK4KGdelUIQFwEKrBZDoAtHBw== +0.0.1 [Build: 1552572862],Windows,my05e2+UaIDGYec2KG72JGRRAOEqosp1kA1vaIFHuf7s2KNNNZPqh4bsnmJ2LWARQVJWFvrnnjsEwjsC7GdcBQ== +0.0.1 [Build: 1552575092],OS X,RerNRKL0lwhRYOYBUfIcDNB95dTIQUc4OJOsXtUTZnV5b3M4WHMb8uugT6qWZhrOObzEQ9/Wk4MazMejIyk6Dw== +0.0.1 [Build: 1552639727],OS X,dZI4OOZ920/Jz6uN3wdSY/cJBKIwYi/2Vabb/DKRI/7ne+TbMF52jHDtKR8farlOR6LKV2kgDEFfZTzPWdBIAg== +0.0.1 [Build: 1552639727],Windows,kQ+MQqHTHNXXdDr7uxwU/ioX7z3mwifmG+y3iQgFO8+t6khxdG+r681nVVJbH5DWPWkp9EybR7O+tkj8VepqBA== +0.0.1 [Build: 1552661204],OS X,/rsQcIITEztmEqkR529p5QZql3wX8PUHiRdD3Xj5J7qXfmIIdHqf5IplMc+zC4Kcst6mc+RSYjzA8hqq55FfAQ== +0.0.1 [Build: 1552982242],Windows,lTI32KaoJMMowYoN4YWvzYM5A9sU9qmy2ZFQHnRxXQejwLWv96XDeYZFBBB+BbsYlD0wbWZtvSz6diJhEnAKCg== +0.0.1 [Build: 1553161313],OS X,xiE4CVM01BoGLWxPlCBVWKzSzVFOIu4uu+1Zq1PXKzS+UIdZk+bqhqye0cHtVDwSaz6z40/4f0409K9ZcoIjCA== +0.0.1 [Build: 1553512400],OS X,1cP6H/YKjgFj0dTlSXHOZUJQ64t7hkY23vDMEJz2A1J47KmZXGwXphNHdD3GN5Pn4IfExzA0w3X01hrBb0InDg== +0.0.1 [Build: 1553512400],Windows,3vv71iNuOytrgxh6AN0W0fcxhe3LO+0L9CSKd+I95RzDeoFOLpb3L3v7mtY8RycWxvb9L9afpuKFn9EbXMTeBA== +0.0.1 [Build: 1553695906],OS X,mmpn3i5p8NlBRZK84pRrVjLouHBHMNG8ajL2RSXGcK0O4Oe+fQWW10uMF+RcfEAI7JMpfCX9hI6/CFr5zRkxAg== +0.0.1 [Build: 1554384958],OS X,KiRmVipTS+ZOMv/smwfFw7gNDoKrLMyHO5HLXT6boyo3NwpQDoOyc2UpMOmMNKZTEx9dA9uCb2q3x1SjovLjCg== +0.0.1 [Build: 1554399512],OS X,WWVBed7WmK6eLaScLDvU/AOzi3tHaaX15VciJfSZa+maEyk9mEnGpfYSccb/25q5gKv1xjHrssoy3LDLOG20Ag== +0.0.1 [Build: 1554736383],Windows,Wf73FFZU9xp0RgCeZUSBgR/4OTlvcdUBbSXjTxMaNMEeHH2G3vfOyb2HDoN4WgE9UDkDYeK8Lef68S2hru+zBw== +0.0.1 [Build: 1554822978],OS X,GJJS+cDKE7eCzEMb8FORdSWP3iVkZ13irxGmEU/UicafIjgFIpNbcFTPCzJVCJ8TbJ+uXz5Jt2LK0wu7eGkmAQ== +0.0.1 [Build: 1554822978],Windows,t/BvQLC7xOtcPZ6A1StLsc9DtOw9TEii++82zrwOkEXpQk/ts2UVcYNeonNq+tSnxuPeRM7AVQQSc5KNz5I4BQ== +0.0.1 [Build: 1554918032],Windows,swQxkzltj92y6u94gjl8i+rUdGYtGB6eWgdbmtPRzoQ6D6Ju1SRQ0J35jxk8lpL4WRp+OkBFmeVKTsJ2n0ZnAA== +3.2.5 [Build: 1554991343],Android,HkOn2tmPaY8qTNhnpZl34QkmhHJzOBVuUdeANQQoCMqDyDovii5zFJnGALyuab5/bHPl9rqy1jllmhWlm34JCA== +0.0.1 [Build: 1555000573],Windows,ss6fgeQA8LSSJpjEia5Jfh3G63JigMqCdkyqlhH7NgMzacBV/Phbcl12GcDXYlzCt/QY2xhi/ku1U+1KVD0/Ag== +0.0.1 [Build: 1555015683],Windows,AMnbAjVfFPOWlwcEFQjz0pokTLpjGEN7TdH6HliidbMBQXLlj9T/LmwRr+IT/ZjpY9+znSXLbVmF2+d0jLRLAA== +0.0.1 [Build: 1555082010],OS X,o/GYOMVcxtE+JWFjozRjS9FJ/h35gGcPfvZkc23AlglNXI5aj6oGg3Gin3M1fLOnSOxn3TSU5WhaQtvCYZgZDg== +5.0.0-355a06f9 [Build: 1555407897],macOS,1NtwyJX2p7rkrN/hWD49iu0p43r0gnaiDY+2W2aUVyGhh5cYjPz84IxzNaR4UPs4dgFpJPJM4pdf9KivwJmGDA== +5.0.0-test-192 [Build: 1555445179],macOS,e3HFhHXYOgw0BsMgkhax9sQ54BA722ZEb7W0j21k9huKC7yISTkDcrAWGCXe+pjR0mucjazMYHMzue6kJk6NDA== +5.0.0-test-192 [Build: 1555445179],Windows,2qdOjcl4ZcqYyLvp6u5oHTH9LPbergYHKASwWc+Sj6iBO3Y/jSzCawuDW9/3nKzlG0lbi/JcFtyku4DN08mCDg== +5.0.0-bf7671e7 [Build: 1555448654],macOS,ayQ8KcWuXKoPtmjRfH7WuY3ECyPWKL4JqEals0SkgB1CNqDR/PBgryvOUxN+W8N2d38BMH7g8VkdA2XeTrzZBg== +5.0.0-test-197 [Build: 1555495120],Windows,MOS8hPR38S/LAoMn+R9JXVsV+cDJVAyI/Dfpvt3NYKwiis1LqdWZymu4osfcrfJGdpSg5q6YZa1CeJSETaizCQ== +5.0.0-718a441b [Build: 1555496184],macOS,y8el2L26T6NR19KOphUYNtQ0NTe39z9PGoyYGEuQUPTBk4vG/x09RmSppdIKrj9ZV4sl+hQ8y11rCi3rRQ3bAA== +3.2.5 [Build: 1555517253],Linux,+nqAMBv2NxHYfPwHyRmleALMU/2gpiv1LAV6dmrLjNXaTS3BwLBVuysSuqHsuiK3/Xff0IRRFANz8qT1ztJqDQ== +3.2.5 [Build: 1555517253],OS X,xrP7+C0BjffIZf7FD21P/xYoCSTmq8nCa3w2q3McX2DlUIEjfMLAX7uepdeiNYZfspAWJmi9QIkpQCltNBwqAg== +3.2.5 [Build: 1555517253],Windows,iyy+8G7ksPHvXb45ijQ9Kfr8TMsCc3sGRKJLiPArx7YMPu8YV4GgYzM4+MpuMQUTlNkU7w5B0od9IJ/7E4nDDQ== +5.0.0-59fc92f9 [Build: 1555588817],macOS,p289ARagvIGDg1lknPUB07x1NUqXEN9kuMwSMKZDrO1gC0wrwAqeaMLt91uNy3VINCOjoDhBdnxMiBed4xCuDg== +3.3.0 [Build: 1555590310],OS X,4K5QbIPYfu42+ytMNgJOvYHB0kY/S+su1vsJ7zuLVlMs+XHbNhJEtjMANjDJAxfJ+fJ77VLBHf1Jo6Q5pSJFBA== +3.3.0 [Build: 1555590310],Windows,eKXdV7wEuwhoN+nk97ety2gAiNM3afKEejHNyc2slGASWXRgrorsEb8c2hcfy9D1iM/OGmsj54inilYZQz76Bw== +5.0.0-ffa1a6e8 [Build: 1555609180],macOS,DPJYkUdJdZVIP+92KuGAJ2ytN6Q723moxG+nFGD50s+I/0kPPEw6pz3B8vCD41mG7pp0aPCQoMBFqYgz7IfEAA== +5.0.0-01c1042e [Build: 1555956706],macOS,D9odXVufvwsTsmzrCZ3iOG+zCGagT3gmori1+EWm/Q3A9jUvNiTpOxUoGNdVJ72pADeVczQldGbG44RIX8zYCg== +3.3.0 [Build: 1556009531],Windows,dhfCi8/4JnkIh3iNPr/7HwzAlVfMgk2IXDdHpyduLZ4BiIOwILZuHVU6u8b/j46yYUklMulweujLaI3IRn7MCg== +3.3.0 [Build: 1556116957],Windows,fOs05Nq80Wvcu8wx7MtITPrCLuKZ6kWY7rwWGYWByri4NbVpmY9mFpfzqBcB3MgnMkp/kTU2jteCjtKjI3EEBg== +5.0.0-20262827 [Build: 1556210877],macOS,0Z+ODov6Dcu0oUuVQV8h059RbFN9+Dj+0KTRWId1GK9d2pq7IrEMzWJHI+R92KnRyaKQnOmH1RdnVzEZjeLXBw== +5.0.0-test-202 [Build: 1556234251],Windows,G5U66Tyy6vajlxvHMhboeLzd91lS1/o15sK1FyCBvbaETjRy78R33FvSLak2bOKwFlXecMlNf8HlhrsulJh7CQ== +3.3.0 [Build: 1556290731],OS X,TmPMXMIBrqHO4CWg9fcPxSKG0DxxJGb6D0pLkqJUZDHJ+tOcM2e9s5ZAmTzeDPCDnq89f5pOooPa8iPEyo4yDQ== +5.0.0-alpha203 [Build: 1556295552],macOS,DaV6Rvgau7bZng3HQr2Tt8nDffi/bNWwaBhL+OkqiUShZE2X5CPaCYix1ahZRID+XF3jANSHu7anQNgaNQ2rAQ== +5.0.0-alpha204 [Build: 1556312473],macOS,R0GsDv1WkAMMACsoigLj8zXtIDieUIfVQ7Js3kNMtV2IY3EHAr/rEvG/R8OQYJjtxDQYHu09D31BxXOLabc7AQ== +5.0.0-alpha204 [Build: 1556312473],Windows,liv9ymEJFPqK0x/duZzn9uJqfkL5tTq2WOn1omAMkomTef7k5wd0FQ71ioJhBAr5UU4rKceahVMVhwFrYwcQBQ== +5.0.0-alpha206 [Build: 1556530824],Linux,jIng2diWQpiV/D0tMDJSoA24IB2kB1weMJi16NdXRVKaULISROJHhbZKVZwOvl7Dm2yQFneUXguxzUE5bHWXAA== +5.0.0-alpha206 [Build: 1556530824],macOS,AaYqqXfOM9YSHTCNw/dVBrLUx8e/Kb+m7WmcRfEOrI+gqxS+EyqINxPQxpohpf7SW3OU2p2ic3BqaR89AFCqDQ== +5.0.0-alpha206 [Build: 1556530824],Windows,Zi50u4yizVqLgbK9Zi1jM0M4AOojMXvzSk2WhOFGdtNEaz/F4KvitnDVjtu5hzYIyrHFEY472lCCjL5o/qcbCA== +3.3.0 [Build: 1556542489],OS X,5yXva471HNY14SB2bwv8wc204PIxZu7FRaNMFPHRbruAP5hVvuCFI15SBIas+OSOwxJKqnzYkKfxAbRci2sRCA== +3.3.0 [Build: 1556542489],Windows,VRm2iUqx3CYHIXog65jCFBZDNr4/fa6RIaItQgcfCtncrK7h/c4onUaPPH0pJZ3juwLML7xktRX4re3MoHE5Dw== +5.0.0-alpha207 [Build: 1556616734],macOS,LIv/VLt/oKLDhOejNGJPQ36/7smVaUn1ChGj2FbqLSc1FJBczX/kKuGtdYAq0Qlfh3tD38NzKT9585FnFrwLBg== +5.0.0-alpha207 [Build: 1556616734],Windows,qKNjBD/w6eywswACwGTRB2Y3x+je1htUDrsEhm9+G67wysTZeM8LMgcCz0V8+zTo9b5YNNC9N8aFxl8NZeQ0AA== +3.3.0 [Build: 1556630414],OS X,LCnJGOq+P+cY30Pn2oOOK488op2EXEun1MgeMiTXlmzj/tjuvpdrxoiXC9Vu8C97eoOBVRD4hj6fN7FODaklDA== +3.3.0 [Build: 1556630414],Windows,kKY5l53E4SLiSWqc00CiuCcfeNziXPLwcXDCVcACIV45tupxzCo+w+g58qP+Z5A83NoExD+50EIuOEPzK+8AAg== +5.0.0-alpha208 [Build: 1556660248],Windows,UTdgQaFrU15818vsU2raGj6Uy8A3jbzVY2RighZqrxC/HLlA/h4IWIbiAPE3Evxv95Cgb7Vg93ufYhpSNY8EBQ== +5.0.0-alpha209 [Build: 1556801404],Windows,FhUBPJ4W9+B3Yb42X+Rw9/+hEjwZeYTnTL39h7J8WEeYBrj7ocDSsnQosz55VNleHUgLCABSn0BqG5yEJf09Dg== +5.0.0-alpha212 [Build: 1556813029],macOS,7M9RrXON8iXKOTe1N/lVC0ZuL1HIWuFyI4kWKpnTe3EUPf9LZf/tXGzRPHD2C1ih3JXxEuVuDSd46a9rwVWcAg== +5.0.0-alpha212 [Build: 1556813029],Windows,hpXm9n1GJOr5eSoMKH4U6qUPHbcoGaCjCV9heCmQa8PeunGa+ka1sgAf9H8njXUxCoQQYQDKazrTnb7DnGFIBw== +5.0.0-alpha214 [Build: 1556897845],macOS,37CHmojr18Zo1y0Lu1g/HjPAUvEePh5T/Iui+zcOobPJFwGgCNs4X+cVBGf9vzBOyd3qSi/CxbB1KL/VM9XNBQ== +5.0.0-alpha214 [Build: 1556897845],Windows,iFV4wtdkvLQPQPKtpoB4eiBNy+r0lU6hVw/C3t8ir/zgoWmuh7DaQbKu6+0Sx2zNeyg8d7AspN3ApYUWLk+5Ag== +5.0.0-alpha216 [Build: 1556918526],macOS,UoCCR0jcJHW0z3NuQsIG1XBipDMgPiHbD7zFZVnB97Q1RgsKwRyvOBumXrAeCL/SEAprkAmrU0ofYQBuR1NjAQ== +5.0.0-alpha216 [Build: 1556918526],Windows,sWDezOByhJ2GNjO5+w3oGWpI9jXXZy72iBSdSryHBMVCW3c7khfLzmpipqC/3yUACQU07yEwThcYLsK4+UYrAw== +5.0.0-alpha217 [Build: 1557239244],Windows,r/rlz7JCCAVmV1FT5mhvu6plHA6Hnq50vkSd0nlgWuvZ42OtGtpklLkk+Toc3BW6f7roO8pgqbr5rKlry+KmDQ== +5.0.0-alpha218 [Build: 1557333442],Windows,Smg0cmM4kCTX6Pby2dFZmqbVm/60S92m4RVUjLf2tXZ1lynNmJTKS/M0cFFRpYQhw9RHmKK6oAEz5rtKv/8bAQ== +5.0.0-alpha219 [Build: 1557415390],macOS,WgNuMCz2tpWDCGABKIBCT7VopmskmlVcbFM2z6ZDqPTFtmebu2iKsJ1VofMiWPknHWnllduKNW8ocvTQiJywBw== +5.0.0-alpha219 [Build: 1557415390],Windows,sXLcoviMWxxPVR0+BD9Kpv0pKDBCyk3DSKZwW2AOa0YZhrfSgTXciDXbMmOgOk362OHLxcKAw1cjGgNTrh3KBw== +5.0.0-alpha220 [Build: 1557519031],macOS,tDngpCe+wRn+fGIxTdCg9cFBIyoSF3XYSaw7ZDmumjPDRwaNqZ7U0g1DVe6xRtoOhZczhIUM2ANAaVfhhOvGBQ== +5.0.0-alpha220 [Build: 1557519031],Windows,J2z/+8j1Ls3n/f63eIhKB3IlK8vOVlw62Y9fUqUDlYNDUDWdOg4PakhvMgw26UiL419/rx0Qm6CfdjDgbU3hBQ== +5.0.0-alpha222 [Build: 1557769659],macOS,EVTuQ2+e/AXohPHoYo+VYByUjeYvP2JBy/aeYuKI912zVbrITSwG9b7JpRgAJyPUyvsLnAWKlwYA9RPtXCNIBA== +5.0.0-alpha222 [Build: 1557769659],Windows,wwbvrQ42kySxiyVqGGRajKho1yLFKfmoDiVjg5NQGUpag3lTCVn66ZS1O56nI+sfY1Yj3IwFiZbgcxbXPjBkDQ== +5.0.0-alpha223 [Build: 1557842114],macOS,oAgBumoab/97kQZaJTE/Nc/NrMVbM7B/G1Ob4mUMIWF8Orw9KBtDNJ8e3Hq1TQzNUBDiQ6Q4vub0OEUGld3pCA== +5.0.0-alpha223 [Build: 1557842114],Windows,pYAtduIWDXlkr4FuGXUhNkk5lJLropb7aoY/qKABaf4GdvWpbN9KmdgbCMvSwhXWPi0+YZoVgHS81CYWkHGGDg== +3.3.0 [Build: 1557914437],OS X,+kZH9b/Ka86RnioFhD+RS8oYQHu8Ijb9vqLdySKgRY05LVU5CJtWOCQ+IrNUOYDVqMEuHzkPGDFQFO85tHhUBw== +3.3.0 [Build: 1557914437],Windows,Cc5W6QpqeEhSa1sODAy/pmLRZ1nA1ZsUbDhwg7H0KjWoxy6l8JWMmviXLWuA8RuDzJJVJV6bQU3Hf6QcMNlRBQ== +5.0.0-alpha224 [Build: 1558094517],macOS,g0J4+3KSC1LPYXqgzO2cwb97hCgijJnOcgvuSElBLPrnhPSyC92XQZUIkBF6AqkOtIoK1TfbpvCZOpy61d5cAA== +5.0.0-alpha225 [Build: 1558176095],Windows,B37WMPFIacoScNJ4yiL/bngwZ9StFNACAJ65LezIlL1OIq+nTexacjc/qLr4oncCDzhoLCUxumsCR/bzkxESDg== +5.0.0-alpha226 [Build: 1558186695],macOS,DTRDsFrz1JRxAoqbsIiJwL5O+dn3+RDcHaQO5KS8auxPcZPa1NFC6A7cbUlDiez1zTjWf2uuGf5ZhMcv+JZIDw== +5.0.0-alpha228 [Build: 1558453482],macOS,CS8WBiOC67A/vs3iHbrG7PCF1Nv5Zcde+fiqbXha1KxJKjYJKJ2BiyfuePUtpO7YL5+G1DuDZrzIg0pFYcseDA== +5.0.0-alpha228 [Build: 1558453482],Windows,+yW0rVsjHZNWYWZLPOrhWcdGUn8xumz2dpUS+gaJyR3hR1paxzicQq58jBmZv92MmsT2Wj3Zs+UzQf5NzHLlCw== +5.0.0-alpha229 [Build: 1558545291],macOS,QHxI/Co5ZTPCPlvr0YBuXzoaTbJdl1XxGtJt6TjKBjE2VLjQwRm5Bx++jYY7Ff55IwUUhTZ98j0UTMwVsxVcBQ== +5.0.0-alpha229 [Build: 1558545291],Windows,MS7HlWUlkp3IZDBalR9xEcGPotoXh+23QecliSQ4B+01dpz7EA4e/VqknjzZrn4ns72qauMbXT/zqUqR6zAcBA== +5.0.0-alpha230 [Build: 1558630781],macOS,dCxOoelZNVXI377eBmeplmiXI8PgQUYRSk7WVnJ1cZvFQeMIEbzKHgvA5PVD1Dyj0i4FpZpucmnACglNBxY5Bg== +5.0.0-alpha230 [Build: 1558630781],Windows,llzRK5eSY3jWVuHvCwoeb5Nl10YKw6Lk5F+tAt7DkUMIwEoM7U3sxFHeMf3J/yYrenAKb6FgqB6WHqXYINPoBA== +5.0.0-07b4003d [Build: 1558632796],macOS,Bq4/nAP0mR6SYuXx3J+Qk4+UAcnqraWchH+x5GMlZ3d7qnYkysNn4WlQCEjLuO2Idayx+xdLQmq+jASWTYzPBw== +5.0.0-alpha231 [Build: 1558722704],Linux,3fMgWCWzh/v8A+EM45vXindYtEMS/Ofpt11eUyHntfr4algP622X9iyPfdOFJnnFH4ISAd7Qh56T2BvVlFPyBw== +5.0.0-alpha231 [Build: 1558722704],macOS,Dndjvq5Y3GPe6IB+9BgX+RfNqzh6CmLLBxHMdXwUvbB4CE8TPqBP7gZwnYeUjf4Ij0yOSitmeJMLseHU5UcyCQ== +5.0.0-alpha232 [Build: 1558967089],Linux,3T7hpgk1meh3GGXvZW72K/3uQolAUHFLKVM8RP90psN5oIwYmxFDgnAsoOIyktHUYyCdF6JqpUN6hl/yOYY7Dg== +5.0.0-alpha232 [Build: 1558967089],macOS,PypsLXiPjW2EQkHbaUveezItfhMQQ5aonMWlpqWezfP/zoxtvUET5yf9lFY/PqO/bFtShhmPL/tXKBI3ht4qDg== +5.0.0-alpha232 [Build: 1558967089],Windows,gzCs9to1JZ7EnKIAQ46LzsSu9VgL4fOijAvgu6dG1itUVI9ilE8WSWk6azeJQoSXXUqUhVlJEdRsjMAsSMvIBg== +3.3.0 [Build: 1558980407],OS X,Vmf0Mq8hgly/4ChaLz3m0/RM7IwJdEXyIOljGu74lv4ZKOLHE9o2K42sCdbrtG4IPXTaBlEiItNDeFmAD4FhDw== +3.3.0 [Build: 1558980407],Windows,QVrvVgvXctohZ6wGzvJFB3SnHH5TTqYHLJ0A+j4KZrpn3EKNuXpmieIjJ4NiMx+Kce2hO02FXSY/KVT4doTmCg== +3.3.0 [Build: 1559042453],Linux,U+WzCGMDh5JYkFfA7ZPDt43sZhVFW/8tHNXPeHAP+ZOK+3W0/c8TvkFiW9NR8j190KswFVYb7NOhigzXsn3jAw== +3.3.0 [Build: 1559042453],OS X,MsN0f5qqK36AtXMMP7i2yE7bXFHRST/cbB6PaD9HMDomK4q8cG5qBVIGXa7KG0PAAZUtJAXwr1c+6fCIzBJRAA== +3.3.0 [Build: 1559061820],OS X,uG9rtcA593JtA4RuwRYuSD29I1cNWa9rYub8xndRbvZ1z/qhqUk2oGwnQzeQOyzZRDzExfYiFwLLi4LGTNXADw== +3.3.0 [Build: 1559143149],OS X,JTB+B3tPBtR81UKWwPwELq7WX5SnJ8oY5yT6MyCqUAxoC82XEp7ZUYvgyuLdQ01eHNpmQNF25nyH+4+vBdeGBQ== +3.3.0 [Build: 1559144369],iOS,xXYmjT4t0D0Oll99yVPTsRXxJuqFr4ShKEtetow7ii6Qwkm3mkMIrg67NR8foo24bBQgcY+s1CQC88CD8WT6Bg== +3.3.0 [Build: 1559151651],OS X,d+imICJxJ0pW1jeHdu1+zi8P0RfgViiYRhVwSBaG39O9oWHVIriaRJKJDuqrdnjGCehX174Zyg243Ul+02AQBw== +3.3.0 [Build: 1559151651],Windows,R8rfsRoxzUGuHQIwPiMPeAC687o8NW3fzjA4f6Ivgn6b1JTSjAO2qguKhJfNjGl7EVFTagNManW9bSib6bkkBg== +3.3.0 [Build: 1559172971],OS X,ycEAOKlOA1FT53mQt3WHCbTOikB0KTgbtsJM2ZPnA7pV4cBbG7xJ3FS5WZd46lDDcl4RQuhwIIGNXf1JJs+VCA== +3.3.0 [Build: 1559207969],Linux,rF/2IHXSOMtJrVigZ8nz1gj7AO6OUmCMkPUCvtmiPXHzopjETT+juLcclvX7jUo3nElMMxPdm1ZmQcTM2HXqAw== +3.3.0 [Build: 1559207969],OS X,ZhFL5PsGfyPzPdnSEO3u+r0v1/3yrLBtQMErAd0IwJz9vY4+rTZfNhzfbxLhbg3l7NRRd9EMHtxsy0quXJNPBw== +3.3.0 [Build: 1559207969],Windows,YR+Frh2ZvoqZABO/hk0fLM5urA970HHgkNuiFCowTQkAd4n5Qv+Z9bPsjrlZF8UkIJUacX2f6yXrbEdk6fSFBw== +5.0.0-alpha234 [Build: 1559301070],macOS,gMbSOGIYOP1PpHz0Aqt+xefZSytby56+8Z/IE4yg7Fo73b9LMb/qfQRO7VvlzwSB8c72/Sw4OyzPgB56+pmdDg== +5.0.0-alpha234 [Build: 1559301070],Windows,X5SKQ8c8YGQvu4FC3E9pDzTBQAiz2SBwj7Z/woedk7feGBrj7hx3woASaEtQ33pVO0KseWVWbt8plUDFT2TuAg== +3.3.0 [Build: 1559307127],Linux,u9pIc5sk0+s1KqVj1Jrwl1eEu+1QUXOPTtPA9Q1Smt9Ym5N9mi6BOrV6Ke3DE6uu/7H0hBSYh2aeZLThX+LPDg== +3.3.0 [Build: 1559307127],OS X,uGMlFevcA6rER2uq1xdapqzmLreisA98yi/6LWK6GR2TyVWjXwMQ05DXAjflz/N4JUbuIal16BsEF/ByZ35LBw== +3.3.0 [Build: 1559307127],Windows,His8U9cnGKfL1f93iCm/9H5TSmtRFBBkcPW2czbcY7bA71IvQrXB+nxx7dNqilVxPZxqfB7yuKieGdA6kO+FBA== +3.3.0 [Build: 1559395482],OS X,RC8j63bAAQydHNNlBBJWhUS0NgMvMFhjgn6MNlzC4zQaoD61OuYrrrMyx6ks4gLwZ/+RWLBkXMZK4p+cZT6LBw== +3.3.0 [Build: 1559395482],Windows,npVq0Vd6BWXh3bhUNDAzAFU2iuQ/KIClddTjTk9QnBnF5l0uW9g1VkyjqBcDyLYpZEsa1ZFWVKOKlgnEjJJqCw== +3.3.0 [Build: 1559423503],Linux,NZ173oDGAENOy9GIYGpnWPg4Em69GM8UX5C1jzxglbECIWzIcH5r4fVnuDbTZJiOgmBacgsg1y2RbYk5r3LrCA== +3.3.0 [Build: 1559423503],OS X,O/Q031RHvRZiYRwor/T6Wru50I9bX+pcFEpiYN6WF+jh8vti2IVkkTqoKHzYu/W6K7QN0JKcmOahoL2xARdUDw== +3.3.0 [Build: 1559423503],Windows,ULqbAwG4lV8TBYWv/W8hRfkwlXFURxuhlnM8AQYWJsPEIoJyeSQjMxqAU1rHySTqYPMRM+Q/dHHY5uD2nFJwCw== +5.0.0-alpha235 [Build: 1559482103],macOS,eYJ/ihasd7Szx2o6ECEY2m0e6GYfGIDDRVDzaIFqq5TJvqQuBFtuFx5eaEfddBRfBAmPhC+14DTYvW21IKvvAg== +5.0.0-alpha236 [Build: 1559578284],Windows,QBAaSF/mQotdakJI/1KemvF2juB96IpvEqCe5fVlnSM3Jx0UV9jLnTkdYlBUYyLpRkB+DWO6GN48FnB27zNqAQ== +5.0.0-alpha238 [Build: 1559732615],macOS,0lQWZ052Se6L/o2FZk0+kLzbDS6o3acKPSCMhISh/0CZZ7ETcF/6xjVVBGZuWPNPIL+/00ncu/AwibfSUM+HDg== +5.0.0-alpha238 [Build: 1559732615],Windows,EusUrcu92SYBZj+5MjjuduCIyKYhFgEaKc70EQokZAxeeMsqATBYIzkggF1ji8DEUCbfohSiO+KMbLXUdtTtCg== +3.3.0 [Build: 1559767425],OS X,a8BpIJkdXEgxUOrFZ7Uk/fxLxOTGNdcyf4mPDC6BmXpdxjcLM5ps6U45o2tnfrd5xSONtPhaMLLLD1MhiZ2bDA== +5.0.0-alpha239 [Build: 1559815502],Windows,91txA9V5csVkRKKs4+pDDhQO5Yh4Ca0Eh/EcNAbk9yJSUVF35XfXZFTH6SNr9xE3QpfHYgHG67YPM0TsuA6WBw== +3.3.0 [Build: 1559832098],OS X,H3LyDEcQz3Rcz2CGd1Y1PqhgdUzAcO/5uoKZaeJ3qAuAc4DrChbsduBqHCb70cygPDcHT7iqM0zAeZAt9RFwAQ== +3.3.0 [Build: 1559832098],Windows,/klG/RS8bvimBdtvjJySVY7J6W810VoT/naLsi8t1aLTxA1UA9Q8n8Ze4rbMYXWKUqTpgP2dRlqnlPnV6uYDAw== +3.3.0 [Build: 1559834030],Android,Ux59iejFFnEANHPjL4dmwUgXKhvnV7dPqjzAIqYMNs0RoF9RyhsgxEaJO72IgNt7D3yaD+4lGtYfcEFG8WDKCg== +5.0.0-alpha241 [Build: 1559838513],macOS,DJytwJVmYEhdcEJHPOo7sg+oTVUFK5zRk3wRJn++OBNenKCoU7uSp1+GZbjU3nIDqrdBj9CL72dnjbCJDeVsBQ== +5.0.0-alpha241 [Build: 1559838513],Windows,AouFlEmYwG+IhVSQN1IAN5mOLQnEos3XnTkCyBoPfyvxn0EQ8kCg9L6aHj6x4kd+KMGe1h/94oYk4vS3M1gjDQ== +3.3.0 [Build: 1559847347],Linux,eu5V4pF+XgYBg4ig2/C8NEpAjBncsoeHJXDyHAXziZktezDNYTsJIIW6BkFLg4N/TiIdIJif54pCEM4L7oeODA== +3.3.0 [Build: 1559847347],OS X,Aft/7c6PYAmhwJctkpgPWbDgV4fkeN3vt0MHNEligntg7xQBSyNECO38ghO0dl25Su6A/vHBXxxobn6YAr5wBw== +3.3.0 [Build: 1559847347],Windows,gffOfzgmsY79PAQ4Hk2zHU7fpYgOsQU42Li7GnuGzORdmxmw5EpS1+sA/RYe7RsMdzkNxhvPQ3QhM2jDxJjQDw== +3.3.0 [Build: 1560032346],Linux,X8sXjPPNm42tCNhFrfNhWb4OiZMlkx2HXaLOAOJilEiG+Vs77BR//AxUuB+iZa8crBOWLgrE66oh2u4q2QcuBQ== +3.3.0 [Build: 1560032346],OS X,2iOqRuzxYSJeB+7MB20alBy61Nm9E/UlqgvbRxtN7MYTLhy0kuaAXjQYpI6HImWM/X6UJjckZvAUBg0aK7zbBQ== +3.3.0 [Build: 1560032346],Windows,9IPmbngc2CpvGe9inLOFpoJCxoU86yObNUJ1fLTzuPJCh54j4zFidNnv3Xe59gKgMzDHZ5/7H65Hubsi8j9+Cg== +5.0.0-alpha242 [Build: 1560169692],macOS,9AbGQKw34QuJg2gRcfzp0JkIdmyVWrRAUn0BOKVscQGo98CoiAEKJixVhQxsoDBb4YpgPhdTeBkGMuJy9BRVCQ== +5.0.0-alpha242 [Build: 1560169692],Windows,Q42kSe5LxJ1/sNqojdxgBwTsXMXvTmz9Ipk8eQptq6AiwOj0qS2UqapIU8Wlir0zvWYN4675mT/e/ce6yn8pAA== +3.3.0 [Build: 1560189475],OS X,WhDvkhicz+E4w/g8NRfDIRWOb8vEJkHIJjW8IiGLzx7R0o51mN7AJ9GaSVfH4za4+TGdKGFrs8Sl2VUlreqFDQ== +3.3.0 [Build: 1560189475],Windows,glcuW51nfgvusH5yBKRGvSfRRGD7I+5hWEXmK1spfOQoPVLMe46u/oxKJeIKMietJ7bLAG1t18dCI3CysuBFBQ== +3.3.0 [Build: 1560265364],OS X,Qscrve6CfWXAshiOjvUSmshhHV8QKx1FsrUmkzaOmRAFrg+SZYvjLBQsdV+xSb4UyI0v77iyXQDv82Q4/l6eAg== +3.3.0 [Build: 1560265364],Windows,3dnvBngFvSg1elIctIK8j/TWfdaxaoaf+4W3dc2v1QBW8AhTx+2zlxOaGBDFXYfL6asP82krFgoPXeEtVFVkDw== +5.0.0-alpha243 [Build: 1560345924],macOS,L8dmXQrk3+gxHpIHr6sTxr3ujyGI68oCtuOLYLDSfv/6YkEzxGJPp6pcO774ptrllOj7Td8RzTsNSaEQZo7PDw== +5.0.0-alpha243 [Build: 1560345924],Windows,ijnSy4j+gfMrSheNHP1NLhGr9J+k/jvpIaxnkmI7iwDMNg1Gqn/SIjpDqWvcdztETrDlwJ4doYYwjteGubnxAQ== +3.3.0 [Build: 1560464251],Windows,bkUu9ipgPnyMDOCbJG9rPTB87JWx4ZpCk3tKGut6dXnXgenYROA+BvPzN1k147kJ4Jdyh504E+2E7laxb8eFAQ== +3.3.0 [Build: 1560504952],OS X,5lk5x+337M2JI/TRCD9/zZoUBBqLiKjf3KdLvqyt2dTk0VCA+aG0LWgZszJR0D7lbhtA4ez4OY3GjyoOa1+uAA== +3.3.0 [Build: 1560546557],OS X,FY4pOaQF7XKxVIgIIuMJOhka9b7Fb/VLtSiHRkOstOItA8alGsR8BAD6rKVAJnBuGFv5uG3RcxHF3yydBriECA== +3.3.0 [Build: 1560850141],Linux,8giDUlJFDtdmzpfyngDzL3UP47C1+U1iwrzROU70MoiSeswf1oJujYeQ1bx4dD2OPxF4Avi/XgbZUQ/Y4NcDAA== +3.3.0 [Build: 1560850141],OS X,Z/UJgrYae1BsdKJfvMorW4/zIQ8E0sKBMTBI5Cm58oYE3TtCE9+1FpUE9VkqWSm3J8SMmu2+J/FpaK6pa8KaBQ== +3.3.0 [Build: 1560850141],Windows,v9gCHwBYJKBxLWwptMvqhj+tvWuSAz/AjcThvv/J3ZNsPeivRk4P9Y9YtalQbIRkrALQSC+qNc5wIAw4HG2cCA== +5.0.0-alpha247 [Build: 1561047486],macOS,9i+SzqDeOjSdwfQEhD/hC6arCpCaorBbELfKSVqx4CifMIv+xOtBkWPhOqg5ISTKkqUPeMBvgberODEgilMbDQ== +5.0.0-alpha247 [Build: 1561047486],Windows,7RDCJ1DN4Q+bh9FQlDdkYK5OURj/H8kwrPcxKCUXB67Al0ouj41vNzOCYul+c2hNNrv4wdmxjHjYN74T6dDVDA== +5.0.0-alpha248 [Build: 1561153809],macOS,YNHobK/oj9XzKKo2A/qcckWvHfhu0X+WeOu1rvfHHAS6S2ri8839R7GiVvN3+w01ZfxBWI5z3590Cqb3cC2qCA== +3.3.1 [Build: 1561236585],Linux,2WaGpMt2Ky110SIh+byPcwkS+Dn9U2l7VffcJsoq2PNy0ZQ+o+N2i9wR4/7kEgtgB4SHIdoA7W8rQW2LLqUaAA== +3.3.1 [Build: 1561236585],OS X,sSQDnOTwkEeo1shjPUwbs5w/xU9+5641b4695H5uGjL956turKroMABAyco7Xu4FEO6NWV0MWQDmzN5CUNEYAQ== +3.3.1 [Build: 1561236585],Windows,IV1j5Xoh3qck4Vlr3KqNuo9FYxKJ1BhVTNJ1vf2AvCQPEnQP6cYb9L4bBE4fsCw/+OiyQXt6IWm7G2cuVeC0Dg== +5.0.0-alpha249 [Build: 1561367386],macOS,MKOmBOjtv+ikyJ8NuYfr82CJCPcr1f5vBa55XTMzsV7YsN75hiLxTIHY0VOeAlI0MPnW8Mrdf5tDZHqCayiYAA== +5.0.0-alpha249 [Build: 1561367386],Windows,jgzbESSPVFNW6ZS5SG8XhSLqN6uJb5ZHFM7Hvt0JeqLSBusvLap8VEyEO0BPAFeEQV+yCs0VB8U8ny8LzSnKAw== +3.3.1 [Build: 1561495949],OS X,zCiWyOrsK8oVYT9iiLacxAB6x51Cf9jVIivvbh3gcagSudLFB/U+ZxqFZHCYxDklqTS6dBvjHaTc1OrFQxFBCg== +5.0.0-alpha252 [Build: 1561656532],macOS,1bujQHTuZ1AdYDamCS5VkEnjSEeAztO2Y8UeP4ZlN1MFrBh7dTkIN2DoGTI1/Lk+oXYua0NHgnik06UtkgICCg== +5.0.0-alpha253 [Build: 1561732636],macOS,sTvuj4X+PHD38NdHVkvLprzM/fcU4J12A0AMlYRxSXuPzDjVfLTThQoSwK8Ih3AZL6xIoegehhHolaZXawlbCg== +3.3.1 [Build: 1561761890],OS X,whf5UirES/hy/MeQmtraD7++MwLemejC79wXb2D3hwMQQH7kS6ieUOpkVnt/9PJxn6wVg2HeONo2uT1Kt9MaBw== +3.3.1 [Build: 1561761890],Windows,oGoGqFyELQKn/ZWpZl0r+oFJVpByp8d7C5ZPiaf6QjvG73uUrNvZUCUTaqTGf0QkLdktXD0HNULPqlxCfrf1Dw== +5.0.0-alpha254 [Build: 1561967684],Windows,jT69rm0NjtyA6BuZ83zcm6AD64qCgU+ipF5qI8g1XAGyejLIBS/WLCOmqCUFZTPJgBXXxpzWyBmC3kHOxJVCAw== +3.3.1 [Build: 1562186016],Linux,EyCld6pZjXiiDEXmA8iJmq0BHyiXknORkKJ+9ySuhbtQGUf0VOsfYYJ+dNjhNNwlmYmsd2ZD6rJ2oeaG7Mi5Aw== +3.3.1 [Build: 1562186016],OS X,l+cJl+SdNwU8e2B3lKL6s8NCsBDhgQ0sXOM0qq6AnsCFkERxznGaLY51vgg2NQBINtqAOueA5LNec+bZXyFMCw== +3.3.1 [Build: 1562186016],Windows,3U+9nlyiUqF4rcAOhKoJgaSaRW8TQzwiSfkEXq3MH/Gr/f9ur/khYN8P4+kPHPopA5l5IYU21G95Ift1hCrnBg== +5.0.0-alpha257 [Build: 1562592572],Windows,zmnSfIV0k+PRN8Qhd+2DMZQo9PuZraAx6ERAyMVyqu7UnXiIKrlMDUNSr1Ul3EPz4BzX82QSwB3tyeZYHZ1nBg== +5.0.0-alpha258 [Build: 1562611926],Windows,ae4LAzyzPBlPcWFQEoiYsuheWOCvW1HnqXMEM+Y6Aed9tsCewzYglA5YkBlbXe9HM1kf3c/huGy63qJrrJrcAg== +5.0.0-alpha259 [Build: 1562680101],Windows,rJJ6ECPqdvCw/4pFYAlKoHJ1yzmz0CskKfP/E9dG936W9efpnIt6ZHB5EywlDTksA8gTHanxl6zqNgQ4bnbuCg== +5.0.0-alpha260 [Build: 1562686022],Windows,Cq3SKxNkD3w7TbTCp/4dN2Pm7POHie5wTugASXsqhQBImLwvH5PpxxpuBGAHCYCP5tYswKHL/9grzeZFK/Q/BQ== +5.0.0-alpha261 [Build: 1562743548],Windows,xGhA35RYhl7Dnb/ruDpLSD3hQHEcD5f6sZOdGgHMQ8w1/DqBHDg+JPFc2pPapN8mS3sk6R1j+YXLCMFNpM22Bw== +5.0.0-alpha262 [Build: 1562749547],Windows,4qye7Z9lHZFEEdn9kGRhthAPbekPZ/kiwlZ0n8HR/Qojz28dkk9jtJGBXi6SoeSMisGa1eRe+K1f5plpdNqxCQ== +5.0.0-alpha263 [Build: 1562771414],Windows,owzBAJ05B/Zj4aLNC34famFSFtrg2oA2NROFfJkstXWKA6c8tCuWxa2e8lUqO+5FluF8SrCG09k7hjOwWQcSBg== +5.0.0-alpha264 [Build: 1562775539],Windows,Ta3PfkIvQHU+zyx18Yk2y0e5pSfUZ/7sERryRyJTgwQIs/FbmTxwqX9RVzIlnPtkWevF+A1U0kv/FzHIZvX6AA== +5.0.0-alpha265 [Build: 1562849836],Linux,t+XvNBHJr2bfK88LTXeixtr/dClF3vGFwLSiCdARkcWABykx09uzczpFRtCJWR8eYQ3ov5KXQFxce8/oeI9TDQ== +5.0.0-alpha265 [Build: 1562849836],Windows,RIDPBmjBeYRpq6ZUhKG8FdEjIw2ikTMmvr0jFTMXpth34KXOAdX+iBRCH4arRDUmwCRmjqx0eprrgt7LYFihDg== +5.0.0-alpha266 [Build: 1562943568],Windows,cOTquwaHmv9Gcv+ubFzSMS3xFR9UN7r9YXJWmdoIv3QfIetEDlpntTbklLxpRPLIUSmEkdCBQ0iDhpLB9ql3AA== +3.3.1 [Build: 1563026407],OS X,jmdDSzzwrzb/qtgd+AAqnCzZSpVng/lfmVYXEt9avpbNE0w5+MNgvkAqBGmtD9PNHfiGFC6tfmIaVTElW402DQ== +3.3.1 [Build: 1563049771],OS X,jUO4qwNRZBeBm+UV7+ft0hvxDHyvS4jRpB6Tk75UNJbHz9DYOTfix0kbPB/c35IV3yJpbKnYoyQaaRQxKD7SAA== +5.0.0-alpha-267 [Build: 1563202431],Windows,W26q3qQ7Ntn+1cqXQGR3J1j8u46qMj+ADEwuTfT1F80DENcCYe9VmbODAGd8wPDkY1it7B24VYMMSUWJzy5yBQ== +5.0.0-alpha268 [Build: 1563300665],macOS,D1DlyZVevsgVnp0lVoc3LjLsWTjo3g7AJJV3J0bCl+yW5rvKfLsz/JIdrak2MtuSbQdJ/1yXLKONbcBABfz7AA== +5.0.0-alpha268 [Build: 1563300665],Windows,FJN1araOIDI8eFoiY502BwABOv/Me8VF9khBb3tFaBH/L34c2fzTspIKVwZFs88AlXjGuZNHaatEhJN/LG5kDQ== +5.0.0-alpha269 [Build: 1563374719],Windows,LWPHabA4y5rnzvl54YmRS9d4reoQVV6m2xraGfGnhdDAeKwdlwRfAPBoypSM1GUQf0170CYNW+U8ylrhtZoODA== +5.0.0-alpha275 [Build: 1563647591],Windows,DR2+Qid9DhlZViTHp6aEbc9yHmqUK4Dj+ktgZW1O9zBaSozIx1+n4InG+41GlQ5bAU/W1+bLhhw+Jfm8YTL5BA== +5.0.0-max-updater-test-3 [Build: 1563793735],Windows,7BgxUIi/tZgE/rfJSkrn7LDoFxDAS1x1gJ+LT53/dzO6olR5njakmCLORQthMv/GOdFhoSl5rl5mfajzAmtdCQ== +5.0.0-alpha279 [Build: 1563868868],Windows,KinjpNU0pUxwJc9qoaksQgXQBhaT57NsL8ofj+/qN7GRTxuRP6gyCWUf9vw7XU/dzouyDFC16NZ+Mj6jKF5zAg== +5.0.0-alpha282 [Build: 1563983977],macOS,UdsQQGhtR5gFl12iQg+nLQyoBgyCPIIezEk54x0zWxfYA4B0hvEFyn4N+7oVKBXa56Rl/71zQsvdgyPnrPV/DQ== +5.0.0-alpha283 [Build: 1563988444],macOS,4UcLBuEHOsP7KPXrH5PoJWJwkd59XBcBvicsIKyqVdO1TJ1BOBgDkGD+/Qy0WM8UXx7Bjn19WRk9/0EHGxK9Dw== +5.0.0-alpha283 [Build: 1563988444],Windows,i+rGXZwXJBEm8SrP9BlU1udbNbZrST3ZliJSwZ+rf+GpQN8kU2Tpmr2vw6IqpYmwidi/lIyn17LHaWxS8GpADg== +3.3.1 [Build: 1563999377],OS X,6H3kBrosheF+ce6+bzJFnBeoMZ+qKXQVASW/xvSXqwL2IQDOC+2KZj9PvaDLqvZRLkXs5EHCKu9RTgSiTrXXCw== +3.3.1 [Build: 1564146308],OS X,zQYCeNs6rkDp/383oOB39toCbKwl6KgfPJps4v/3duXSbVpotOar6sb+4QgrlubK9T+ypuwExnNIZyaf/ScnCA== +3.3.1 [Build: 1564146308],Windows,2AzTbQOY/RXgTIISnT3vS25Wow1FBr3CLCU7f0hDFEO9FbFfFu2VB7GAmkd0twJkNKyG2T8uCjMmBeHibt5tBQ== +5.0.0-alex-scroll-test-1 [Build: 1564164327],Windows,K9aAi7XNPXDPF+rmgIUHOcDNXfTq/liLQWFZY90/1CxfH/IY/HK7UwQo5Xiny6ZKZnvhxU4oM2gTtqyhjaCVBg== +3.3.1 [Build: 1564391039],OS X,k0iL0DU3iIOnL0ZHyIPtOo6Cg7ESCzrSDoLflFjO9/hrn4PvFBtb5gsTpj4Q6Ua15AEFYeemL2tqyeyzU5AxAA== +5.0.0-alpha291 [Build: 1564408069],macOS,JhaFJdvPijlh6tu9olWfJgB2Ps/FaG+bZPMDCBWE7uC3Citd+p9uyMrw7qefaEvKotJqRzMq7LsU5vgmrPSmCw== +5.0.0-alpha291 [Build: 1564408069],Windows,IGd5L2DM5Pn4EKhWmxB4onfII0UgZ2gE6mFX0KSoQi2DENuVE0ymnaj7dSd01wabiyYkSiuDyUrqqIgKNOkIDQ== +5.0.0-alpha292 [Build: 1564497029],macOS,PNWDdpHthSNKYCd8w3yCljxM8QBbdVN5f4hC04p6LZrS9oCQXwaNFirbRd+qUxwdF/ZaCGz9W8IQUvQiqOodCQ== +5.0.0-alpha292 [Build: 1564497029],Windows,jlFBHcHdjFMn3nYnFUK3CgL3uxtb2BQQ4Dsc+gqIYOMrUPzS0CsMD6kuQJFUOF7aIKQ8y9euFKtuv9G57fdyCQ== +5.0.0-alpha293 [Build: 1564586764],Windows,ZT9k6ShVBg3ZF/koi55DJttu1vcI8AmZcULRfN8YhGQa9fEkS9qIpj3gP6HKq7fh9dESvoKksRORq59RiH8xBQ== +5.0.0-alpha295 [Build: 1564653261],Windows,BFrjFCQZRX/dPiHhIqOYj7oUZ9TXeNUdZEengJgfEvTboZ9t4ztVG4DWX6wORiior1Xc7e3+BtUxWq/FronKAw== +3.3.1 [Build: 1564671328],Android,0IDm4WX5vzyGfNrXHxd/TU6t5AC+AuWx3KF8Bh3n5R+adbrroIi/uHqg0WV8xxWThupRDp0UlqyH2STRuu50DA== +3.3.1 [Build: 1564678999],Android,kPqHuXEgLxpThXc5XYdvTLk+iaY0AL99jf2WJIXKBJuCJmD0pfW1Ep/zYCxU2NGsu4HIHMMXnB0d2lkr7AHiDw== +3.3.1 [Build: 1564695891],OS X,U8tvJN1f5SnXikUJLzobwuWqA1N3eS+1GRFcVnztpJOwBOFT//wee6I1WSAoAUHFshK7HSrWnGJUBnXT1Sd9Aw== +5.0.0-alpha300 [Build: 1564750918],macOS,xc3aQ7iiWOI3VZb4gHBg9OhQcTxqSu4HgdIBj9N58JhrYz2ioXkSZaNmjRoTjmlIrcPSHawMMozKkjQ4cfY7CA== +5.0.0-alpha300 [Build: 1564750918],Windows,1dtJaIlnJj8SMM4fdL9APze8nljwAYtEPNFiUT5J3v5E2h1pW8aJnnljBCWSYcFGgKL3Jrj5okC/Ix7gR86cBA== +5.0.0-alpha302 [Build: 1565122993],Windows,0pF71saHDtwBs+WntxBBjIdZhSyNBpsth8qiqDBlKCf54et7bN8zvhlUFuySO2nQQQTaC6Nbn+H1PeY2ERvuCw== +5.0.0-alpha304 [Build: 1565173045],Windows,ArizbxJu/9+vi4QrBLWeCneB4e7+do6z4PAcGymxNGtL/aLQPqmAkhpCGs++YWndtZp6HrysrKAYwP0vB04EAg== +5.0.0-alpha306 [Build: 1565180063],macOS,vRWUMMtf0bOSVNxCOlXrvw/e6YLHCzcLqocEb3SkSmG7OtXrMSzV+qp7UyhM40YdYi0zQblZjCMo9cVJDBKyAw== +5.0.0-alpha308 [Build: 1565255370],Windows,reS/VSqXlHry/XR+hg3j8nSp25o5gmuJnlKM0IbC/FW/ufVNo68qhVOgtqYY+8VZbf4f3Lf40CKh3MxPwyYuBQ== +3.3.1 [Build: 1565359284],OS X,X2zQPJvqLMIHhFOqg2VK20pz3th5+x3MRYNq9fSu4YeH2RQ2yuiVA+gutHOGfaHJfHXddGi9pHbmfqsG13tiAw== +5.0.0-alpha312 [Build: 1565621064],Windows,oF7DxSVLcG/rzTMH10g10mc0yg+MRY0TICPdBoU3zOmMwDm/9+gZWsvL8if3ifCSCAmkSQ34lB7rb/3Sah22CQ== +5.0.0-alpha313 [Build: 1565694680],Windows,+OscPH6RxOtkhFOBunnFBI8QsoVLZOLuLfTMf4CZpJRdwwlly3QbUL9Prx/M0yaYpPozJ4vKMajyWxlXAmJ0CA== +5.0.0-alpha314 [Build: 1565805211],Windows,cWjRa7Z0tIYKF7HUQ6Z52Xgm6P0GnD9vn8yi1Tt9HZYgREohgPIssdpqDCkPx7Kwi9hxfBnp9sjnJ/Z/ZzC7CQ== +3.5.0 [Build: 1565805756],Windows,0SzCC2IGgn+ovlPoZUAeyxxSsuqQjyJkK1m2be+PfjniFU6F37cw/KpX1rBrllnaMrv2DFiG54ub1IHF5j/GCg== +5.0.0-alpha316 [Build: 1565975113],Windows,7jKMe5MDxTa+5KZ3luvBCJPG/xkh8t7bx8PitvtnNTVedQmpZUECONFtP/ceM1+Flq5x8OCkXT8tnF9E7dz7DA== +5.0.0-alpha317 [Build: 1566233926],Windows,bOlLrOlFsFwvXk4YEjcF4xZoB/T7MTpsHlOqzNYBGeY1dvk5ShiHobmDVUSjNVoHkvyYC6Jti3FlJdTIq5viBA== +3.5.0 [Build: 1566479450],OS X,Mqkms76I9VfgFUELEursGojag6/2ZFrELtGs/VwmDFxLVFJ134pfsobaCGljdOPJc61wUA39A//hqXuN/ZQRCg== +5.0.0-alpha319 [Build: 1566479610],macOS,ESvw+cfkAgZRjlh7X3GRMhqZq1N+w5iTm3dQbFIbIFuBFwWgoyYk9RQVo9ZjjkEBT92Xm5gSp2/dCK6pNZp+DA== +5.0.0-alpha319 [Build: 1566479610],Windows,W9DQ53AWolbst7XISRwIZHzOYfm/Y/Dmxi/wD6oUIM63SCjLBuGYpUoLlLIdkWe2bTRZxfysv8CMiiAhoFCpBA== +3.3.1 [Build: 1566673023],Linux,IdO00q19oqEwf9CB1R2c+2ZALMrUC6YPwTohdmD9abnDzpfDH/P/p70oDolrL+pRLoh1LjDiLtUdKRETLbeqAw== +3.3.1 [Build: 1566673023],OS X,dNpW3zyuLCNdhCJpCbaCHWob9xnHSbrRNyJgNShwAPQfyclrtarPLOiTYN9IgQbIGxTu1Yo4fra59VHzpHhaDQ== +3.3.1 [Build: 1566673023],Windows,utZjz6KhPiaR9zdhS3NvbLpi4oTGH/vseHd9/mUrLxYYD5JvfeeHH6nzLf8H3manoNrQnONsCcqUOvYglCotCQ== +3.3.2 [Build: 1566767614],Linux,UhiFNnz8npgT22qkLXlZJnX3T2n+a8usv/0cTh+tgybrgsFd2WIuI3eabWCibPeU+AYeHLaeYR+x+pF4GX/NDw== +3.3.2 [Build: 1566767614],OS X,JiKoykMS5BExaAEMpIYB3JRH+YturPua/Q+VTQxJGRi002zni9b8ReitLaJJQt2EMcNAbDpl57um4mekqFvGBA== +3.3.2 [Build: 1566767614],Windows,fAjM3pPl95eGXrhFcsvCXgdI6Epr8XpafOJZlYbFws2VMllYy/4DUleSVzPuVqu/TCgrTaqb0wP+KANse3/vAw== +3.5.0 [Build: 1566810730],Windows,KJlE8//AeT9nmBTs0EIjEZT7+W2Qc/J76Tevu+QlnP8jqG+079SUeJ9jZkl+L9I0MwBTyrCSkpUoDGv6MH3CAg== +5.0.0-alpha324 [Build: 1566898458],Windows,cfTebCrUaA/YvCMbLPXC2Q94+9Hs1RssCo2w8zyw9psLJ6x6A8JGiYBAB1VFiRdh0Roc83q3ghAYr7ia1ay1Bw== +3.5.0 [Build: 1566914096],OS X,JiMiehYrCDP2x8U49KEBRtBtD7QgCxqJ6ALhs1Mt/IOtSluOuR2XhuCBUOoTRe20WfgDfHhlUk/AbAdKgdmyAA== +3.5.0 [Build: 1566914096],Windows,dRC2UOZSRcleMujmFMWtN33/AqfFuZeM8M1bxPckUnLWugC91nv2DqFC9ohTKCzlCy6fE5Pnm+FUF2ZpYip8Dg== +5.0.0-alpha325 [Build: 1567003912],Windows,Gt1OMdHeKcWpo8A6sfuMM4MwZITOgy8xJo2t263rsLRq35pbtgr6UtjsAeMqxlIZRGKnJsG2l9qGZkYihwBMBQ== +5.0.0-alpha327 [Build: 1567025817],Windows,VYcfgvRKy7btgTQgxpfSYRupK8dAAmlayqa3bs3x7gWrwZXLQH11OSRY4HBOx6Bs3AMMGdooTs1FXpFWbpMrAg== +5.0.0-alpha329 [Build: 1567160967],Windows,VLAHSsiIyvBC+Xr9NWSjR29chi/aJ76IRG4lLUZoec93cr0KFraQOFIZZUJqF4wASq0wB/Xb6cWdiCS+XUrOBQ== +5.0.0-cef-77-test-9 [Build: 1567209083],Windows,QlubfeDQgkhhd6vk5zvqg81BdItyEp04TbS0hj8WHxab/lwBy9ell8EuTyU65+xMDdliGb8jmyi3UZEJ7Ee2Dw== +5.0.0-alpha330 [Build: 1567246409],Windows,ZdPf2YHlMX9moxzE82/zKZQ2QPqThxPa08f8rLzgYCrtLafjQcY1LjIfev0tB2hKGKzPd9aRX2UhCWRaPAGvAQ== +5.0.0-alpha332 [Build: 1567435866],Windows,KOKtxZUj/qQ6GAh6HyRtkLipFrfptUa72zl548InSwGziz3s+METYqEX6ghqlxtmjPjopdKeozY0kdBCp8VjAQ== +5.0.0-alpha333 [Build: 1567450575],Windows,92XoD+2CniLMhP+aopIUMQWGrbrFtdX+CaNja4ZKs4CSAg6JuiPtKX9JHldnl03IXPUT5exxBbEojsWkuOd8DA== +5.0.0-alpha334 [Build: 1567590370],Windows,+F0kmE8CmGE7gz7r3VaW2Qb2HmVyXCNwMO7LVdHJN+4dlYNu6taoWfa78HivqXUZH4s+zOfjweol3tyJ3x5UCw== +5.0.0-alpha335 [Build: 1567603533],Windows,iifdsQpgwFyiN1LpUq4oCvA2oMPTfhO19Ic367PJDxoJBErlM3COoW/LJyaR+/AyfoEPYVPzK/HVsgm2VH94Aw== +5.0.0-alpha336 [Build: 1567680535],Windows,t/bEfvxvDT2TZkLmU42Q0Mf+yXcOqizJ8G15RNOO6UgTjSnTjh64bJAwAayko6IMN/xZpIDgx9m/9hMhGcPICA== +3.5.0 [Build: 1567687511],Windows,c6+vv7Rp1fQsFxkKlYfy4kaF8/5Xh4I+ZwHw+hqV4qPo8AsPc5ZTwcWtK6Q9/6WKs3i2msq6p47mg6sBHSa6AA== +5.0.0-alpha337 [Build: 1567692133],Windows,vFDmsTT6gI1njnCOJv3mLt9EIJERoBubpEiadmZLBaXdXmbsqC655Ywq1Zsnt9/5axOLobOt5/C6ZHJfuWOVDA== +5.0.0-alpha338 [Build: 1567761846],Windows,I3ifOYOw5lNb8+vHLgbFQl0/SGNSw+1w7E0mCT/Zh5GHYbbrpxQDR0a9SdUHi7TKQ55uxTAt0Sc68fhQBEABDg== +3.5.0 [Build: 1567775523],OS X,d5asvnlZOJucbg1E3A2JUJ2IrxJ0Q4pJlrMwvZhsvxTK5D2dW4TUJIcQmDnndgC4FKrk//VMHsnrtFIfhhrCCQ== +3.5.0 [Build: 1567775523],Windows,496shsf4bckjKJsMYlJW1p82rWxuL08+GMZP9S171X/2rXeuXWpQ3AfkI7tMve95MiZ5/GNt6Vl6jn0/45h9Aw== +5.0.0-alpha339 [Build: 1567776032],Windows,1FwZpwSPVZQiwCkhSlzl4ki+cmhTc0C7LbzPSQTNKqFXPv/UMld0dw+05nCSng3UHVu+2MmuXUxfokIIA3GJDg== +5.0.0-alpha340 [Build: 1568047589],Windows,pNAG0mkBI8izK+bEW1bh5gEkaSo4ih6YAVsU89f+XsdXH4SvUq3PvWQy5aSuUSHAIgSChfIzFNbNa8Q5cmTFBQ== +5.0.0-alpha341 [Build: 1568138230],macOS,K1sdP0hCrN8CVI6urHRI9GBCbKg0GiaVfxt/WQR/x9qTzUj2Q2sFbJL3DEh/dadOY3gI4TAGUji2mFiERYfUAw== +5.0.0-alpha341 [Build: 1568138230],Windows,foVufjNlvsZPOejfZEUgAi8ENTHOsijOF+qAULN29FoUpWFKNgBFeDYOuy1Hf0pVkv8y9ariYjh0OWhcY5OnCQ== +5.0.0-alpha342 [Build: 1568216929],Windows,Vd6t8B66K91JwqEAKqitP6gobwsIQg7Wtg5ffH6CBGN2TWKg7BGCDJabCUHjnUI7hm6eCtWBqr0lFv9GTHxACg== +5.0.0-alpha343 [Build: 1568303604],Windows,MuWpPz3L+MIN7HAwbI+IeA5fUcHjzyIsGlQ/QrajpoWEkhfk4Fl9yB/q9BWJwDxDiRyT//KpRzPmYVK5ps7jBQ== +5.0.0-alpha345 [Build: 1568462524],Windows,hFUXangYNdyo7ENnEJ7Czi6JFRBRMreoB6cqWCWesvfoasY5VR6Wkvy5JyziqT9EHO7E7V+f53e/BpeV2wQFDg== +3.5.0 [Build: 1568483207],Windows,P+9QNU8aPVwf1Hk2oiZUUckRg1989KnGXj6FB2AV1GxGoeaGb0e1PYhhP5E3eTIjFDr0W0k9ELrcoo1+i0/IAw== +5.0.0-alpha347 [Build: 1568498600],Windows,p19wMaSxX8UXuvhlDlxIc/KrSdfJ9+o8wAXOtMRcprxu9z3nvcmpmCWMUIIOYQg64hyr7nms6hrGkIYH98CxBw== +5.0.0-alpha348 [Build: 1568542448],Windows,P53ztJ8EKNZT2cxr7InF0xFicDlGGHXyM8BOcxWv/kqm3VLVxLQCVE60XVY+ar1SzZ2KZ7ZD1Rt6NyI42wR5Cg== +5.0.0-alpha349 [Build: 1568550521],macOS,/risCZ6WJqff77LQA3hZqIMaL0XfeC/haaErc6bY7fuGwacTbtc80G6ZEGfFpnJ1NUscfHALAujH8VxDavWgBQ== +3.5.0 [Build: 1568734736],Linux,YU9jsFPaBFg9CEr4g2lUBhZj6e6f2l7EFI9grYLMB/BLPWu9B7k+aGzAe9OkMHXpT3Q0cqc+k+N7XSxXf8x0Dw== +3.5.0 [Build: 1568734736],OS X,cD1hdW/GpYEHd42RTeKVVqTPbMlcGNNYLbsrjE3bX3NNyBEw+EFDn6JiXjvJ2nlgkwt/BG1CqTjeTPxCWhg4Cw== +3.5.0 [Build: 1568734736],Windows,fyTB0CPBTj0jVd4NTUy8oBJ1PiGhrHpano2wGvEmzzZxb8A0A1BkRdmCyZP2hxJI8iLMnpEIy3SEXADl8kjRAg== +5.0.0-alpha352 [Build: 1568742967],Windows,rVdkwzZbfhuqxr8XrVT07NmI7KWh9yuKukRAeeVnA6TSiZlnDzVpKsFeZ+XRvQqlg9f6NQjM6mOGJFd4Z/TwBw== +5.0.0-alpha353 [Build: 1568828473],macOS,F+3xGce0D7mujDxL179YtEhO61SY6iqu5Fa2bKhWRY9C/cUGGSXDNKrn4A1fe5M8NkJDH2HsnuNCSQHssQnlCw== +5.0.0-alpha354 [Build: 1568887729],Windows,Uh8IYEDWqgJWvm0n3CW6wLZwxNtL2wQWxuePrBJhkLGWT8GFjB1DjPRHknHoDSBUgae+TDzkle57owFienMLDg== +5.0.0-alpha355 [Build: 1569001691],Windows,2HjF3/5YQt6TXdHAv4g1wXlt5fm3ffpmW42MERDz0lWaAEfgE0VsfwAAHXmiBl6Sgjt8ExN0kjGlNtUg3p4AAg== +5.0.0-alpha356 [Build: 1569007610],Windows,KDYbc9yRky+5ene8ASeIA8xawtKV+2FatCqvNOb13kVM1xNTmgC6atTmXbfGYxppEnmBwl23wfcieQlZgblNAw== +5.0.0-alpha357 [Build: 1569014091],macOS,ArZMgswMs1SK06P3JwW/LpDfEeeG9bnbxSI6QJPDIFgckqXrFZ/tkDFsH2ZO8/VqS/CnlUvEqEtqITjlOajAAw== +5.0.0-alpha357 [Build: 1569014091],Windows,Olo878lO79Q+Rgs+yh4Y1b8rbo9+GOBXg2ydwU8tVVkJNh6HTDSGKdx7BP5cko8eca2cXCyjlwVIvDjvvrmLBg== +5.0.0-alpha362 [Build: 1569439429],Windows,oiMZEu9yAdpPcbQiHC5QX2JLkndvZS+yjJp46DQnuG/7iYgwP5JlDHjyP393FQZSQMNClXwJ17jBXXGAtpOXDw== +5.0.0-alpha366 [Build: 1569577640],Windows,b50/TxvYKGnC+1+rKRPnJ1PCfKNIbsvAXdPeTcjn8BEYk3eYOT9TTMJ/Qg93H2sJJYWm01bb1SCqG546/uX8Cg== +5.0.0-alpha369 [Build: 1569852696],Linux,9EOn5V3u/349Q3dZtbouoo2UwQn6Oq1AOvXj4jBcZjgoLoDq8UfofVgYNOxs814RMEc60SsBOcvxYJAS8yciBg== +5.0.0-alpha369 [Build: 1569852696],macOS,AE+kHmgA+aHt7i23Q3+ghDBcHJUX26MgVoBcuMjexFcghUhvHI9ooRcR6S6LNPjfqfuPxLU9SOrC6beImJMDCw== +5.0.0-alpha369 [Build: 1569852696],Windows,IhRZBIxx+luuBhNtQAjfrAXS6plahEzfX4Jvxd6+c6WnnSlIvFC4z5CZ8aLyTis+1s/BlO/4vMs3RewsShHlAw== +5.0.0-alpha370 [Build: 1569948695],Linux,JwzqAbSxXDTD9VLF4BZhOFYu2etYzwqg3TmN/50WSejPvs0Dkb66wu6llyhRBVTE/GB5o/vQxlsFjrP2rM3ADQ== +5.0.0-alpha370 [Build: 1569948695],macOS,3Nu8NJNG4Jx5WTaZkuja1UMm5x1zPQjH/MMAwvhXcEDPLgPjFVMCW8vqrQU5GeiCehB9sYdq+IdAFYNfieEFDQ== +5.0.0-alpha370 [Build: 1569948695],Windows,hRgqeJvTICIg/tR9/7zjb7uu6nSaGR2ypyvj52sOXp0N1wq8WdZgvs80dlC/+eLnmWDWkFIpbq/AgBYNaleWBw== +5.0.0-alpha373 [Build: 1570024161],macOS,d6q4l+SJBwfp3WmDSRdr1CSPH3DwBFwLQUQQnRne7UgbhacrmbCAleroUBqSPKUay9QdPaECatzRu5GM4o6fDA== +5.0.0-alpha376 [Build: 1570136727],Windows,VMsCdtH4U0FpPSQ61J3hGt/tYL3Ys3N3x9lgOUiS3nlYdltNZ5PBfvL4Q64VpTImK2rj/8u6JKKTdXdgDuZsAQ== +5.0.0-alpha377 [Build: 1570211017],macOS,UPuXS+zY1OBoib5DYjuvgoeaFShhm8s9k38pkMY9AvHm8dy6AghFFkUT1YLdMO/n1ej4TUo8/lP5BuhRYl21Dg== +5.0.0-alpha377 [Build: 1570211017],Windows,UExsYhgJK3YjzwIZhm2ztveSGNpruZ7rpP0kS/d1lNTsIezasOw3uoiYq5Tj1GIyZMrVV+dZNzyCnsjtdpfDAA== +5.0.0-alpha379 [Build: 1570306886],macOS,hsSZSM2saFnDrRcrJdBGhqPNDC1EGopIoFnjKXe7K9bwtyEt2gTZ7uRasA46YQX2sTSKHCBDiaXj07WVH5ooCQ== +5.0.0-alpha379 [Build: 1570306886],Windows,lmAAKNKEjYw1MVqPiQpTP+fgHkZBr4YI7PVk92XUPweb+/qAHqrIAGGjRSaDqEfrYnWhtXMnJ8O+wGyZ9DIlAg== +5.0.0-alpha380 [Build: 1570376142],macOS,5aM0m+9G1SWQmfYiRzNNBTjUg5wlULAq5aVVQbVvL/LseEGRLafgTChu4K7Vn5avJK5dVbEyP852EGrGveK3Bg== +5.0.0-alpha381 [Build: 1570394174],Windows,kIadWcCh+5r216TvDS4+FVpvG1xWSVjJAcaKbKecdJS2isBlUogVLn/xcvq89GRrg4kZgIMuf4YCPFx6vPFgDg== +5.0.0-alpha.383 [Build: 1570427845],Windows,ZicJJDvBhYeB9CNIzUUPr5vQeJ2PQ4MZsrUqzrk+cwl8qO8hVyVoUa5BD+dqE+8I35/Kjh4k/VraNCgxQQEyCg== +5.0.0-alpha.384 [Build: 1570457406],Windows,6FmjeQaMhIELrglADHocwtXPH8XWODz5UOJDwa3wDDuVMX/K9Vnyh6+MrSR9UT+TuGBnVXtSYGpNeKL7i9LNCA== +5.0.0-alpha.385 [Build: 1570480817],Linux,8+c1g72+1sHXfYz5SHYO9ylwbOkoY0IthOd2Kl7Kuj4jR87mf9ATLqsKlZCfZ1nIbLs6do42CDhxLldyKgisDA== +5.0.0-alpha.385 [Build: 1570480817],macOS,tgmX8pvk2XSvVlmTNlSF7zteBfSdG+vQujanrpg73B6TZVpIMW52aC8E/p2X+jvYm09DNm8MVeUOPglfGtadCA== +5.0.0-alpha.385 [Build: 1570480817],Windows,RFB5R9JktLjj/ttr65Aq++U6gR56H3uccY2P6RoioahY1YT6UFr9rym+7tX4g6CjnQjXxhkYekewFr2Luqn7CA== +5.0.0-alpha.389 [Build: 1570642878],macOS,jQxZ7U0XmElM1Mg3UEtU+16RIZM9svvghZ1Pgluca0scXBbkA1v1x9tb94pDOvBS5UyANrFEUTv31PbMXAV3DQ== +5.0.0-alpha.389 [Build: 1570642878],Windows,WkxMeVeRlBaZkz1WVicXimyHKf7xBjWxOaFG1QmkMsob4ohzvz6qUZqwZ3QZKH61okE+T37rvl31mxZVtP6jBg== +5.0.0-alpha.390 [Build: 1570728651],Windows,UBZr57UKwatZBGZF8p8ZDtqy4dg/1lsnXyLgTrNLLvydRq6aOdFTsbzvZgcW8LwzojK2SKxM67VT5idB7VTIBQ== +3.5.0 [Build: 1570810399],iOS,RdN1+nQ2YRxJi66Yd8ta7CXUMsisWTU64qGNDTyuV2vdO/+vYQz6qOUaWjwDxzw3JAXr8FfCPcPaPo3suJj7AA== +3.5.0 [Build: 1570811287],OS X,fNbZJmz470itRKI7lejb4jOMbnorqw2KlEgagkG/tFtxDyBxTlb1yb6VbJkik86ybDPiMvIRyEhlYF7Pg69GBA== +3.5.0 [Build: 1570811287],Windows,9SgqZFHFIVXhObnqoJCEQuB0XHKVjFE+hrpEmOwj5f0xr5wTeznFeysUPP8g4cmhFHHyEzDt1EJu4ZCIEvZZBA== +5.0.0-alpha.392 [Build: 1570909746],Windows,NxrgnbjbCzhC9DI/MiwZTgXtm+9CzaqfANOGB8xcFQTPGZV1lk3hoDjdWOmr/7xF0Ulyx01eeQIgVxOALwHOBg== +5.0.0-alpha.393 [Build: 1570924185],Windows,TlIOn5sV9djXtDcUrJX1CnhAELO9L92SUeWbKw9CCpL+BDcFVRerGOcUfSL9fG02/xszfwOHSYyhtimRbUBcBQ== +5.0.0-alpha.395 [Build: 1570968752],Windows,eJ4aaEhWHVMI+7SWH98ufmfhxw3PrZ10fo3e2e1Xn95tx99D6TwP35tuj1hdyN4SjSGAiNrWri9yptT1sOfxDA== +5.0.0-beta.1 [Build: 1571050541],Linux,ojPTLLbwu5JAnFWX0To1uPa4dv2tX0CZ8a1kQIyvev+60jdiKxCY5ohN9VBvGaPenb/YJQinaZkjKbd4I/rfDw== +5.0.0-beta.1 [Build: 1571050541],macOS,f7PTrjSUlknBxanjdmAMamgzYdGSY7LDRCDg8Hi7Miml0TnciOgn5wukGCeayjT7bpw/DeV3kwnSaoEDZ7PiBQ== +5.0.0-beta.1 [Build: 1571050541],Windows,bIXuHNwfc/yJbpkrXYicrha6lmCC4jzXJuUSZjd14vMhmAsI66KW5n18Pg3TGFG7iKKhrpj0trc/4gpmDecBAw== +3.5.0 [Build: 1571080050],Linux,glUVQf9FU2STvK2jzW328FkF1AhrPLj27sVo9TzEC+2Qg7phv5UpczW9SGTyp3H0KCofYfmTR6OW/W/1tCoeBQ== +3.5.0 [Build: 1571080050],OS X,64wKoleYoqOwO2t4bCHaQevSlv6HyvU5vpOF+yjuIrbqT1um1VoIQuL3L9BKt10Em2sd6VR1/IciCVuTSNd+BQ== +3.5.0 [Build: 1571080050],Windows,4XIHXqnhLM6dRNFzdkNcbWxK/nX6iLBECc+6UJPX4PooBDyWOzul6yF1NKe/fg7bZDigZir1+OENu+O/tLwHDw== +5.0.0-beta.2 [Build: 1571087114],Linux,0ROgVlI/3lI0p5bm0sABq7zfG3U7E7qZLtOfPwf2RflkOygvVgKdlgEsKqpQT340tUcF6NuWZqiwoYXyyZnwAw== +5.0.0-beta.2 [Build: 1571087114],macOS,0S6T2tVpyvoBfPlsM2S1GiF8ookfbqNtFV2ZS/c3EM51ncuVEtD6YrlYC5tGvBPlggbEXawRFQAmM/BwnAZMDg== +5.0.0-beta.2 [Build: 1571087114],Windows,6zuLZzAe2WoM2BpYkEpG3u2zgsuzpWossd8O87wj+z+4+zeVTx7RvIZbW5Zzz3qZX46Rimz312PRcoXhQ+SLBg== +5.0.0-beta.3 [Build: 1571155625],Windows,yd5c0kDs0E94yjZ6uP+LPtoU0gUXddjPoTLQ0ZJBYGgmtGNE92qlHN+OOINwoae0UNCJD90JVua7CJDeF/FlDg== +5.0.0-beta.3 [Build: 1571214214],Linux,ymBfVBW72lTqkUUXWZmcahBs7nBG0hGEvAjEpp38iDQ+EIqI/VwVOPOgzVsFATumKCilmiIt33Pxj3+mePFLCA== +5.0.0-beta.3 [Build: 1571214214],macOS,eLT0AWXP9u0tzMpJzJKLpjFx/9FyU8Wrrk1Zg4AKaPT1539RmbOqd7QxKV6r61PBWfE0U9y5GHRuivCi1P8YDg== +5.0.0-beta.3 [Build: 1571214214],Windows,Gla9L+BRb4Y5Am8TbK0kvTTZ05G0HiACtO915NiP7rAD6Sd8+lXFsHK2REL+5akjvDBbHdU1BEwPBlu6RNaSAQ== +5.0.0-beta.5 [Build: 1571252771],macOS,eySiC0JfF4VFxQPa3XO3eoM088PLWJqNCY7gdScCbdBy3nHiAb5qz07yXkmme9r3egVKl/8S2zyvo9dJDMPHAQ== +5.0.0-beta.6 [Build: 1571338027],macOS,Mq+To2AHXyAAGfIGok0R2OaYavb6fprBhrMVKCNZBf/iHs8ORQnE+1ynozoWM1vIrtkRjl+qBBWMF0kghSnCCA== +5.0.0-mute_test.1 [Build: 1571396541],Windows,+ZNWBfOjbwPZfhgGq2AQKTZBdibC9z8WKOAQUWCCatoHvK2EmKkIYsu0xZ4uk2n121AnCOeJU9ZhZejN2W9sAA== +5.0.0-beta.7 [Build: 1571421490],Linux,XzAJwiiURMVqlo4UXDl/svVFxc5ne1VutLhkZDT2UG2QWsvFUMqTej+6EAeoaAimyN5zzoO5/mR9TBEsedFFDw== +5.0.0-beta.7 [Build: 1571421490],macOS,dNz3jnxhGwSLKTRi+R8nWAiotG8y3o/MtxcAVUGl5WgSCOBPIh6W9Lffeqdi2mq/NAq/n5b/w9rNuTIPK47eBA== +5.0.0-beta.7 [Build: 1571421490],Windows,0KhU3qhKUZSX8xAWLgCaPXu79njWsy6aAyHW7n9keeCwd3lLdcn+6i4kb9GefC6Q3jZOslTCCAvtBw+jwOliAw== +5.0.0-beta.8 [Build: 1571671044],Linux,ANXPHY1ZJlhEPAxngYChDm3XRU0XZntITzHlnZmBGRQOednkyAeZV+/DthWmYmgd0diJt1+qTnI3LNyB8PcUBA== +5.0.0-beta.8 [Build: 1571671044],macOS,d3Jh4QELTkUXMJBunpw6816XB89iHxTPONFDXCMaiCIlthWpmYpN4mOi4+RZKlTtyzShP6cyQ/quN9Lvpm5iCA== +5.0.0-beta.8 [Build: 1571671044],Windows,heRyC/ws7xD/RCMv+voQ69zpKKx00pAnPpQGSp4DqZvwmInG3/5jDaDbD+dD47BlDlpPmd7Qj9/qHkty1VtwCw== +5.0.0-beta.9 [Build: 1571949734],Linux,b6ksNapJZndbf5qa1dcvqRgCdcgay0KQrnw8IYkPAXY/OvccuoJ/LUfg/a01nXbxbh45kp7h5gTk9l0L9NVPDQ== +5.0.0-beta.9 [Build: 1571949734],macOS,Y+qroeb12dDsCO+OTuoERTLgTUWihZ076cODxmo6iyNPPVS9xy1zq8hv1lEtc4UcC3EAqusBRS2ikKY6PnsdAQ== +5.0.0-beta.9 [Build: 1571949734],Windows,m04/1RI/r2RM6aHwRrvENlB0/Px6UnZwE2Lqo7IgQiB4MpFRmAgMu7g/gVB9NdWeMdhm5ulsM5lyYrcu7dyfBA== +5.0.0-beta.10 [Build: 1572213852],macOS,Xtdmc5N1VOdedl10R+vZfxpNR1mRiuraEvP/wzZanttYkhKWvjR5kciXG3lLhLvb0D6q3lKfz7mBB4ejbhhvDQ== +5.0.0-beta.10 [Build: 1572213852],Windows,2xg5JB8a1KTy9R/kXvnsW4rBpGzOPnUSREf80r4vM9KYSj0qj0x4dvFU5Ny/w3Kiq0OKAlvG24cSiKk0R0TjDQ== +3.5.0 [Build: 1572274459],OS X,lRiaeecTWNnnipJ/O+n4DjHUK0C8hOc/3/G9ekOvhudNIkU8XwyXGuT+fR1l9SBO7VqwaZHRQcSJX0Nc0wVjBA== +5.0.0-inbox-update-test-3 [Build: 1572358097],Windows,94cs11YdtF8xxTa/aOrdm1JE5RPkZSQCo1l56qXiMpovFIqnVWisJ45Uv0FHEZCQ71w7NOQylK4u8Vz+OvOJDg== +3.5.0 [Build: 1572367939],OS X,a92Ue4WtLHiAxcVkZK1egx4W8vMCrvlWZQFtj4FO+ouYMiICWZbMtT0MWrnEtwq6OBqkkWBTYZje0893k/rFBg== +5.0.0-017dbfce [Build: 1572429535],Linux,Q3lpSvOgLIPQywUWX0okUdBhUD6W90OLbTEYwSFDKBQ+5neHf/ziBLoJ2jDegMXO3KShpMgsJIAS/qjsP73tDQ== +3.5.0 [Build: 1572447082],Linux,/5nJG7aByRNQKpUapx+cd7EQS80iEA9B+8z1bQgkrkopYfpYJD3PioUaI4oNCvdyq5I2ROheOcaHMTI9M7duAw== +3.5.0 [Build: 1572447082],OS X,H20O0S/45t4TerVsFDNAOXr5yD5VrI7Ps3Nx0RFyPwubYUWXDiIj+LO4wu8wbuxag9V2VJKxtAax1OVWYZssAw== +3.5.0 [Build: 1572447082],Windows,igVHTt+UUyZDHQpj8sEm3fGw+r+MDVkspQKPS/+fsxiVJr1vy2LpDQlpeZ7Yr6C6eECtCx7He58DXALTQD7JAg== +5.0.0-test.1 [Build: 1572609725],macOS,axyql5RDoqUxtZkbPY+Jw7uJgd0n/Rz8LeBbdu+Tj6mW3A0U0u+wPpc7qg2OWA5dRHQ0Ut+VF9okXbsI5PKwDA== +5.0.0-test.1 [Build: 1572609725],Windows,MJvx4bAduHXmC1AAX+w6Lv4vHAUatzBXfKhtJIV9SDKd/q98BIJWEkGCuBXEdBzk9VXfcTpLUefz47BPSQ8RCA== +5.0.0-beta.12 [Build: 1572868115],Linux,IjTT7wlPMm5/hORA7KY2Jl1WmpzUzVyGW1hn0lBfzfkCyHk0N+9S/T2l75CvsNf/oetkzyr6J4YNK/XUszbqBQ== +5.0.0-beta.12 [Build: 1572868115],macOS,SGNeBOp9Gy2rfT83IWOy76J1EK0h5GMEdXNZ6Hiuo22Bk+6UVRCVYUkrC0iyIdlxqug6Oy6xLTVn/IDQ97pCAQ== +5.0.0-beta.12 [Build: 1572868115],Windows,w8i8mSIJ3y6wnFxSp8Gh6CRl3i8Q5owzchsHefG3kKYqzm2oyYsMDOsX61FVELbyiQoQea+QJZgGHY+MZCTCAQ== +5.0.0-test.2 [Build: 1572958346],macOS,mtAt2UpaOYxOgoNkcMyCGvvRCRHjCd+kRpCeFT5s4lQZQk6E4WCc5Sy7pdAB2SMTqBGljlLijbVq8R1EdTwhAQ== +5.0.0-beta.13 [Build: 1572974727],macOS,YD9BfBDOgtH275S4yvRKehjnWropCs+PLjQXVFnCFYMiR+cNdp93LAABFqjFIA/oilR3CyhqZj3gFHxNbHLWBw== +5.0.0-test.3 [Build: 1573037288],macOS,+AqLKfemvASC0sYMz7/G1J5Yhf2/M3Te4/kYrsCgsq39zUxcViLJoJ/B0Poz3R5Q6vpugSpYvzGM4g2x3eBWCg== +5.0.0-test.6 [Build: 1573147021],macOS,7NY9EOPggMqcGPW66i0sl/xJPCPm4UIZoMbOGoYRbr0+SiiMu6LMj4+PnHyaLgEQgf6dQNYsCXLgs85/1DbPAw== +5.0.0-test.6 [Build: 1573147021],Windows,3DvO3eqDDRQmch2WEvZhf398j2EcTDzZl/IlDdWUVDO5HvuIxsAsiOQIap+Kgow8IpsE18psIPXxQReaVlR6Ag== +5.0.0-test.9 [Build: 1573214586],Windows,euaWnuS9dG+QcbOdxXl3EjVvw4C429+vPih5iqSvKGHiFP4lWRfhokHxMhl/6GXfdH57ofTEwaEYQ+SYiPMfAg== +5.0.0-test.11 [Build: 1573316935],macOS,b/eiifmXVqQ63MEYo99zmBU+ePyZxYjHapCp8lRxxqay4S7IYmLO/L0hsuUwuhufU3NRXBgSafPXY/qM72MQCw== +5.0.0-test.11 [Build: 1573316935],Windows,bLObW+PicJcWKpi+RsTc9v+sdNokL+LuKvkB9zbT4LDb+C7ygKZxW36eF/tnlOz+k/c+1K6pw2WiGYWEAr8BAg== +5.0.0-test.12 [Build: 1573502287],macOS,aSZbUd87Fm8nZBGZBGlrBevVtnS9kh1FLzAMdux9xL+4XT72WSdw/xxvrseuY/QRxLhQXjDIfrIk5r3A9lXSAQ== +5.0.0-test.12 [Build: 1573502287],Windows,fmzYSYWzKZv0BuQ8UZaTqjAEEnURd2BuD+cXRtNJU3GaI3OdDQ2/1CsbaqoMaA7csc4Q7Mmwp06CddRRGoj1Cw== +5.0.0-test.16 [Build: 1573563185],Windows,GtKDGT9AZueVNfCXAggCQVlRDO+SaDiy0gbhJvDkp/uSmhD9oO1PUcJUG1ma9yuvykxaIQNvd8PjgIlUux8jAg== +5.0.0-beta.15 [Build: 1573580845],Linux,WQu3TToFKUCviY0m91nruqCIcGt4tPwz0oEiyv80ujabD17rA9F7JK24BytwdmsDaVGVuUkMb6VXfWo9HldqCA== +5.0.0-beta.15 [Build: 1573580845],macOS,h0a42YDAzJnIYoU36COe372buvPI0QDwVW77NPy3XYrg2LjxkJH86sNmE/tkG13Fbtl9jgczFADkVxR7nDSgBQ== +5.0.0-beta.15 [Build: 1573580845],Windows,h4X53sXhFBAewG3RJPqxj/LJHjSeheMtFp1/ZIJ3uYrpJ081SqCHqdmabg5JdKiXX81jQFBy/v7l+mtEbX/hCA== +5.0.0-test.17 [Build: 1573581231],Windows,FbaymngIJXw8PmYIM0AeSyK/589RSgjoc8J4/fN2pdKL0J1W+LKHq0NIOY9CkltrDASyHMOTLU2XAk6iZj6gCw== +5.0.0-beta.16 [Build: 1573593194],Linux,vrwdwFiG2FGhjkfzAS08poN7aU6Y+JT8XQODY4z9QauNe5FWVQlQBCasZe161c0vlEw5CEtN4ObnYu7BtAHRAA== +5.0.0-beta.16 [Build: 1573593194],macOS,FdJ/YMChBoySv+ylNpmi8IFyh933MNTw51ymfks8BiVoAkEn2v9ieBLlApm/2XhhvWbe4TQdd/STu3SeEMepAA== +5.0.0-beta.16 [Build: 1573593194],Windows,/rYy1w+7+Ifb3k9PADIRdbDP+3vISZIFL0q9yh9+6xy6XJV5lJm2U+WqC9fKKto3J+y7pT4tqHnICzSUzcVnCg== +3.5.0 [Build: 1573741018],Linux,K69Ycxkm2mMkmnx2Z3H/tcexuwhxUCKdCf2HR+2ZYUysEssCI/xCMV5IyVeNtseX/Rj2rKFyU202XvtZvwuHAQ== +3.5.0 [Build: 1573741018],OS X,6fE/E5qKkXV9fMMEZoz2RqdHKA1jLAP3pRGDcFgIWZWhAgJ62S7zpjbjfyu5ei8zTf0uKrU6z0X8e+rb3M1/CA== +3.5.0 [Build: 1574093735],iOS,bCdY6e88YBCF7lpScGsVO3AWhKFHvj4TiaXftRC2RKDo1N/5FS3QS3/A9KAQDx55P4CdwN1qfbMmlFJQcXJ2CA== +5.0.0-test.18 [Build: 1574258541],Windows,LlcASnWNx904WXYagFMJtawQmlhxr1BVexhXUHPeIuXl9GNKs+dZvT9PhzM93yUDTLQPQ2TzPl0vx9+yxZX1DA== +5.0.0-test.19 [Build: 1574273002],Windows,26qGf4496+sTJsj36BNN1Q2Vt51DCgwddXGM0zwM4/RQo94/xtxEM0jOIcDoudkQU9Yh/dAUY5V+N/E809mxCw== +5.0.0-test.20 [Build: 1574327385],Windows,rdeWaZq1Nej5HjEMi9mCKUiQCJAdTxyaCZY9zaTmZu0H6tub28Tn1LXmsQ+9tcKSrJNGbNfjzC8d20DLNwkUBA== +5.0.0-test.21 [Build: 1574343180],Linux,ZtHZonfg6g84zkbp3aiiv5wb2L0G76UusiNCJkAS3q3RXHNQ1zCLWiCRbfskIoXlGqn3qJBQdNy92HSK4tbjAQ== +5.0.0-test.21 [Build: 1574343180],macOS,fsSlh0n45LwmkUsZ56OgzhKtAmX5DU04Kzxl4EuytwD4Q8HQ4660V1ue1rBNQx/YIFKLlC7FIF3qMTT6LBjwBA== +5.0.0-test.21 [Build: 1574343180],Windows,IK5/oVWmpkDcN2q1Z0Or79aHtWBZEIVtiVssQhpNQUItD5KBbsv36pDOwFRwuVPgngv9Rq2XJKOd0kL/yGSCAA== +3.5.0 [Build: 1574357871],iOS,9m9E+yrIfJKmRDvujRH5IsbHXClEbgm9zRms+iL9ikLhiM1gzIBWBVVUKFqmtpSSZDq3lnmkN9DmaC8gxhvPBw== +5.0.0-test.22 [Build: 1574873227],Windows,6m8Nob+e14ECagLHedtLc2iiNP8lm2eTOH1E5xBq8EW8EYpvUaWFsErg+pcjCDDruwlzlrrryrvJUGnhEKzjAQ== +5.0.0-test.23 [Build: 1574935289],Windows,n06nZYaCKCoqwYGi1pC6/v91SgojFrNXazJZzz1DJm4XK+utmCQikAMzJdXe76n0rfeNvAs2BQ35wiKAlSodAA== +3.5.0 [Build: 1574942993],Android,hfTN8OfwUhPZSgkDgLGZROwUfolrK8/ep0wXOIcSk+RM3rB9nrh6tpISemmJJDfUV3Cl99ySF/vs4WjIlICoCQ== +5.0.0-test.24 [Build: 1575287495],macOS,i40fx8lABCbJkHxFNh4HYYXXLJXM/aouoeC/Wfj3G9IOCc7D9twKMAgm8l2Zbay2n4Xk56V+L0jWctasVc59Ag== +3.5.0 [Build: 1575318320],OS X,srhE2XU7hB2WWBdzywlnH3q+cSWxBTBR+oISy8+jHHeCKjg0uUHIFUtqpnk/8xbvpykRJs6rW6e17ax4AiPeAA== +3.5.0 [Build: 1575318320],Windows,NSByceYLl/b8kB8+gDgoFdUJkfavpCHQ4sWv0qpP6qjIHT6izqx3IuzAR8Ma6opV117yASpr9R2RrOZBN/lhAg== +5.0.0-test.25 [Build: 1575368044],Windows,BOP7V84ukRS1fs/wuAMfZC9qM/c17Kpf7bkuHnzSjCbVu+rMlxrb/6uWE/wCR31pUS9/oUMQIDwCOhbkUTbIDg== +5.0.0-test.26 [Build: 1575420598],Linux,56IHXOCLPt3AgTc138PmVGMWpHwupetm2SfRtGezjVAs1O7O507sEGbpzTYbL7HHqXp7kAGv7dJB1AZNm1CJDA== +5.0.0-test.26 [Build: 1575420598],macOS,HJQkHM529e2eHdejAIEx4ICYpP9lqClnvyIyo3XMNKcR9Udw2WfUetfCD6VD0DmOygkU/vmI6O2re7EAC/MEAQ== +5.0.0-test.26 [Build: 1575420598],Windows,FSI7yKzzU96ftITn2uUKBV+S03rk4y/wAAdpLjoEMMzuVSoJrGAOu0hiu+TwaqO15ECbhKdti6ClYv49O59/Dw== +5.0.0-test.28 [Build: 1575626623],macOS,CXzUmy7PP5985/QDw7ysWktG/mlhYeN0NovrOYaBNVN6zqJOYskupSud5Pc5Nxj9PiY8gIBc/8fZJ+FSJGY7DQ== +3.5.0 [Build: 1575804173],OS X,VnPAOJE+AIi8WOMBz4ym+PCOQoFdwfp86rYX7u2VZK63OrUZ/aRpKF0v0Lwbn4jywPjL1bt3RJ+trP9+cdyiDQ== +3.5.0 [Build: 1575870843],Windows,RDv4LfYSy9Cr/uQmLh7zk5Smce5aYYAGYbZCAXJLK/tlOlXwzqxoCXor/Dtg9XhjAkVeXSdX+ZAaHwLuy1vvBg== +5.0.0-test.29 [Build: 1575906492],Windows,QCZAnoRiStjO5epvXlTvq0R3YHD3t6VMTOSzqdAdIooJMWiOMP0TMujDmDPZK344CJt6/wBTWz61cYge3nECAw== +5.0.0-test.30 [Build: 1575953901],Windows,rxTi0v79PMTDhbfdAZPol/BC/a+wFO5o1p75BbDJs+TDeM7/PjdkG5KySkkUbF+G5oDrLifSfANP/iUpvaenAQ== +5.0.0-beta.17 [Build: 1575970903],Linux,OxacBnZqUSwz5584fVxlK+odEKXG2RxUGVQVKNw3I5Hw+/vjLThjinxZcCQeoaQVJB8jQBCKpIqDBDAoueaTCA== +5.0.0-beta.17 [Build: 1575970903],macOS,c21ZfbMiZ9yWBhyXR5YzRWWyYAFYOgwSPbEkSEx0rnHkG59ovGEMjffBqB+a6lPItCjwep9poOrXdverrL4pCA== +5.0.0-beta.17 [Build: 1575970903],Windows,KTcasAx1nTBvGMIQt28UfyHmCRZzuzx0vIWR2FpCaytWPYyTVe2w/u9nWH5A+e9RFJw5pphwOwZC8EBrM5OCCw== +5.0.0-test.31 [Build: 1576066245],Windows,PdaEUU+pjbWv50o+rwnbC8VA9CtDLEZ3FW8s1jBbebebyNmMgJxJMbtwDii5Gh8J7KJUzG+kRTvx/KHqEY63BQ== +3.5.0 [Build: 1576090604],Windows,tPCBJ+gtkMQZI+EZSotMjoofEDY3AothGzxijDm9U8RNpZT9CLzr0eCfz70YVVwtg50j85iDVe/l5Ss22ef4DA== +3.5.0 [Build: 1576181443],Windows,XOVRDA3D2gvGUKmpuuCszuBCyyjUQUxvaGCN5EGidbNhOzJ6cPMPLgcAXXGn/itPGWjCSxZM8muucsgigwPxCw== +3.5.0 [Build: 1576513599],Windows,aVC4Jfjl8REU2dunFeHYH6KKp8jN0QEb6Q58VOveVMlm/YmaEPzNS7dDEew/rroLcDzN0XJkC6wqBtKdAt2jAg== +3.5.0 [Build: 1576585064],Windows,l04dlaw8vwImq58v5cg7C2ZbxCAEjStAsi334u6Wf6c668u9DuEDeAGLhxDSPe/ZjsSUAGavkYJXgqtdzTFoCw== +5.0.0-test.32 [Build: 1576586323],Windows,gaYHucbKUEFL3aHeeorqt2ECkTdBHR/A1onihLE8v07Kw1NT8b+/CWRnWMlXYxCQOyirWRFDRzJJSbRWfBXaBw== +3.5.0 [Build: 1576687348],Linux,rWCTNfEyCRtwYMxJXOZ6+i3KIxKvBjzSnzkmJF46CHEDBg39JrozRXa149Ognps9LLGbMhouXkVjdFCivN6qAQ== +3.5.0 [Build: 1576687348],Windows,ip1R1gGEy38Ce7qxs5IB53EBpuPqFg08mFw49uUzWWgsvdu0l87CTtNdDeF3kRxUeDvjGVqG30CVq12B7gd0DQ== +5.0.0-test.33 [Build: 1576756659],macOS,JiNrdoUplbYfox6cyRj3K2HitEzWdkKx91xcbpH5iPr6BlFQbmfsXfVGtNWol8YCls1EkDKXN1zPewVsN9KpAg== +5.0.0-test.33 [Build: 1576756659],Windows,qkP3ea5HOWUOvqK0OQYlB+IgAvwai412cfpayxiJ5k/UiFnc0wFDzIMXL+9ZNi/UoyMKWmjy/KcYuLFHGI8wDg== +3.5.0 [Build: 1576757477],Linux,lwBJK+yboe1k6rCKG5pg4AZhAM4heFMxqvvJMbhxaH3ORWOyPebQu2vkJBkVeRjGU6YUu6uS4ahlxlxdT4m0Ag== +3.5.0 [Build: 1576757477],OS X,2o4tJcBZ+m6evtUlAXzbPHzB1aqr4JdkKFs0sC5GTyIcW9runz58aEA5HxYyl1Y5Bua1LfO+856agJDIMFxBAQ== +3.5.0 [Build: 1576757477],Windows,QRpkkp0eeFNsdhg+8UpCwpTIqeMZbcmRkjRBAwjWklk5ycO58a/jxtkfl1vth1DvG5lRUd0ar/ZIEVwkJhalCw== +5.0.0-beta.18 [Build: 1576838043],Linux,dGtZXFeoReweKxKIr6O1xkaVvhucxgfDsmvotYQSeRww5k1GjWelPzBLC+tMxi+HjfW4pLbNl/zy/q+p4SGXAQ== +5.0.0-beta.18 [Build: 1576838043],macOS,hAVRVqR5Diiep7ON9a52mXbTIsXLrnXSDtYHWL0vI2vtmX2Cggl5OHTzXQdqpzlEPA4vB/oR6MnKJPwiaHz4Aw== +5.0.0-beta.18 [Build: 1576838043],Windows,hKp/R33NhawXiUKIRw4XU7ovpMDRK8YU4MLW+MwcA3a9TSJLahjZ8vWJaLHdexh4ehH13VpqLiKifjzEI9KyAA== +3.5.0 [Build: 1576948785],Windows,rDVnECt+GZtObMTx+reMnLI6Qpj09snDUDqEB9w8sfO9vZGvQEQG/WGZS+UdaT6RWeib21VD46YXq6nCKej4Ag== +3.5.0 [Build: 1577821118],Windows,eehDiOfKnpcqsAsAn+Bfw+WR2MQiLhQb5/acupyIqn4BNTAL9c9Ezd5miYBR67P1+cNEMb9OMO05XdKqN4nWAg== +3.5.0 [Build: 1578164171],Windows,ttMvW/20CHr6WYqUpz2uTMMsajuyHsvw4rHrMFwDBBd5yy+3wxbCgEMAZuFxqfUagsBIW8PMzowUMhSkjPvvAA== +3.5.0 [Build: 1578400308],Windows,8Jg14dG4+TkuBMbiSB58qV6zHmX3c4yDdjuwZ+5CO0wNkyrsUWcdMTUD501XnP3cPqTQViy+3uclUA2vkZSKAg== +3.5.0 [Build: 1578417881],Linux,ir3dtCoP7swQmDsEybluSgEAUApwZT2c626L6AqkEQd116EXoLEZvSJCNE0L+PyuTAJV07k3L89jdkCr1msAAw== +3.5.0 [Build: 1578417881],Windows,VSrAXQ1ps+hvIDAC9fzMjmG573M8XsIWD0JpV1BNmccZV9uMmL5EetGnDfaZDydxFj2g7wy5SEATDGuxwA7JDg== +5.0.0-test.35 [Build: 1578591798],macOS,jPdrG3UfkCYUOznEln0VYCSZyxY0PgpDDIIis7ucaIxkbuljSe+3aQVECug97tipn4C6KfHc8F/JtkN5iKViDg== +5.0.0-test.35 [Build: 1578591798],Windows,pvBDfcSsiVWZhIJaiJB/gmI0ELlD9+uZqm5WdmfZHX9aL3BNsPw88xXkafzN+ohC+UzcWDCfzm6aN4yyBVgwCg== +3.5.0 [Build: 1578609201],Linux,RIfBsaQu+bCZo8jT58X+VOruTMfsBZbMO8iWd7od+nGsonEGXgMY1W7iB38jpRa0JPY2TqOpDqk2NMWjtJLsDg== +3.5.0 [Build: 1578609201],Windows,qjxevyZi/HpxdfvtpRmRBQnHUhHh0c4QmwYsU0iaWl2oy0gqD1+onwfJQCLtHJoC0NixgI9Yl11aZXnXTztQAw== +3.5.0 [Build: 1578696214],Windows,cl3Ra0l/rKndWvhJRsmuL6c4/aKqea2N2N4URge35oYRuVu7QToTZuHjgM/xsSCxWcE5Jxud7PiBPkBxD52ECg== +3.5.0 [Build: 1578859029],Windows,NWE9OG8DuU1I4Ki5TIPge3d0WgMv5w/g87uZTnqmW/JhuMluQfc2bJz5P8Ny0VaURmIz+H7/ZactBIl77mdhCA== +3.5.0 [Build: 1578906268],Linux,1exAxKXS5X47jT7rb7PUDIXF+vSdRvJBPIQpHB2nLivjXLxq49gBnj+BLA2KU3fWLeCAv5u4cUnixrKsZ3dUDQ== +3.5.0 [Build: 1578906268],Windows,b2EdIfdzv5bFaQEq4gOnuT87moaTH6WhaMKDGNbGUjnrJ4Px69I3BcJtvatyaGvgeYaqjzDcjqK4MeVRSzvZBQ== +5.0.0-test.38 [Build: 1579022578],Windows,vVnfcWdAhVlpnba8sPH62U3R7hRGJh8wEyzbUDwjYhZdgJZj+e1k+4SINiy2XqIX8rkHeqQhLh9HKNz7xKVhAw== +3.5.0 [Build: 1579162934],Linux,+7j8+3pxJ9F8RTW3cwuyPZ/ECBjIEt7skiAO6vwYi0vEURCzaRboT2wAccb5+Morc1GJLQ3TWv1+F+/FfQj7Bg== +3.5.0 [Build: 1579162934],Windows,S7sriAuGvJAt/GqvEeU3qQrBbY1KabBwS6rdVr/MNkX7Qb0157vbK9UtNxe/6WaSVTWcTbU26EP6G1IL2ZHqBw== +3.5.0 [Build: 1579271398],Linux,WeJT/r4lHlsCD1SEpJ6EV+Aqfv2hVBz0sDfvfOZCQ0PIoU7NgyqeSuopvRv/YBnR5pcrTRPiUZKBXnECutiIBg== +3.5.0 [Build: 1579271398],OS X,3HhWtyi3ehFQrMJfa1s7YCKUFf4uEMvEWLv4tU0a5R2XNAaN5xM7GqWzxAT21mYzLVZEppl8dPQZ9W5IkzhvAA== +3.5.0 [Build: 1579271398],Windows,YQuBI583WrbI6REuuNi9xQ8qoHVBS/MZyIpzHXbJOFQcZvRIxxruvfJQChMpvc9/RehbZVe2KY8BW2nTIANcCA== +5.0.0-test.51 [Build: 1579367787],Windows,eCUrSXyKFRZXCfyFnOl7PR3r6VCDqzu7yytubUTTQb00jMoDbADYVHCnyc4ZUD51oHDlPWsStfczoF127BnTBQ== +5.0.0-test.52 [Build: 1579512204],Windows,CTql2Bq7+q3TVD0/sZh8MybbQyPi2z1ygWdkKDGMXHJ/Qhio/o9Z7AXMF3fhp2+rJrdGj6CCb9X3vT1MT6B7Ag== +3.5.0 [Build: 1579611798],Windows,p9AERgogemgDxWHzRVnq8laS/47iefIGxU+17XFXChG/gUzxHYzXA1BIPfG3zlXL/FWcuvNfWRdourPdM1JMBA== +5.0.0-test.55 [Build: 1579622615],Windows,ah6EIrqz/rbmYCF/PAW9qF1W5qS7De7LTGc76xgEC/HwYg77nWrAk3tYE5xYJN0YUuYL6vuZvtMI5iij7SRACQ== +3.5.0 [Build: 1579686935],Linux,IhWffkHKmt/jnYeL5IQxK8BXmwcdgNTiP9Lg6RMmiiMTFq6PHvQHjQGFNOrVZSgeLpEYuIIj+0cL78rPgGUoCw== +3.5.0 [Build: 1579686935],OS X,/TmafB2ePmpqRIcDgIyxzgSXioSQMPgiR8ATdt2AheNH4NP+MPQQ4DHtwNm5HVb7jTw+P5HfsOBVcST72kn3AQ== +3.5.0 [Build: 1579686935],Windows,TghaGBYGZwXlTXXvusH+/O0jdhOtWNdU3HcxVzg2Vsq/H5n9y6+zpHdfG/Ea282pZlPNmjAigJRPm2y/WmjeAQ== +5.0.0-test.56 [Build: 1579699914],Windows,r4aN1EBSyf5EBbk6wP4E7zoKDLY2tFphEp8tTATYQIFU7geA3h54fGznbZ894gMIrnrLV2Bv/CrmftLyH6VvCA== +5.0.0-test.57 [Build: 1579705006],Windows,LBxcwx72FKcPvfjLwtQHAuf+hcQPCRM6xQ7DV7Jxz/YAtNDdG5C7fAPrhj84XuJo1cufkQaE6fW/ucvao6s6Cw== +5.0.0-beta.19 [Build: 1579708986],Linux,sizcn7tabErfnzSilYrA0gFy/PPEYufUlAT+VDonx3RQz3/GE5NiM+y0Ovq6LEqMktIqkAqCfr7mAAcBgXZZBw== +5.0.0-beta.19 [Build: 1579708986],macOS,uyzckz/x5TIm4m6G3+vqrvZ2QGqRG5VhXZIx9OATLo5WOJbmW5zzXgiZdca3w09gvfo+ab4X/psJmayXJ7vlCQ== +5.0.0-beta.19 [Build: 1579708986],Windows,4hImRslbCAQhkjlbAWT5HWANA9yophaWEuE4AQ6YXh1/EY+XeyCI8+RBn1pqpDNuGE5FMBZWhGmGhoY/TaZACg== +5.0.0-test.58 [Build: 1579878094],macOS,BBuo+6vcCjeJ4bWkL5cvsuuie9dy+owt0zRBeroCBV+iHmHPirn6e29MW5qsCqMX9Vmm+GNIsxB9zgQ4z3KPDg== +5.0.0-test.58 [Build: 1579878094],Windows,lYrBlo3lKYXVFZDFaKQ1v7IfMFtoHU/BIlT5ebeAQOy18W7YyZyWoxB4EzFynmMiLTB/H7xpbqsYC2yzHCHGBg== +3.5.0 [Build: 1579960421],Windows,sCOi1sggRSo63qd6js7amPrQKuGs3Nr93DEuBgfCJSWMZxErXnXsAbSjhbl9UechjBx16qK61PdI5CSF1XQYDw== +3.5.0 [Build: 1580143599],Linux,nAUR3VnXvxdwdeZcgdljrY/CFl68sLKUfPp5lOPe+g7YWVpW1dR//Az2t6Q+WDACbfaJXVBkYwmMzJlSlW7QDQ== +3.5.0 [Build: 1580143599],OS X,DiIj0dFO8DYoCZOW/TfmMGkcaAdfLqqSgzbgV0nfz8/FCSnku7bpS8guaRINNQ9Majgq1Dfj9PVd2KMaucFDBg== +3.5.0 [Build: 1580143599],Windows,YRQLhax4q/VzwKpqkXWK3pgWIhuhJc4pv+Jd6yQxucPUiavIy7q5bWjQzAC/KsuDQSdKHqreUKjsOOl3jFFhBA== +5.0.0-test.59 [Build: 1580226872],macOS,h3DS6ezaHx2RAhXvuHDnPexpDvR41CO3Tm/NHltNinUbtzUOOzVIClX42WHAUS0mSqD7mFTrjkMjJJyST6RDDg== +5.0.0-test.59 [Build: 1580226872],Windows,7zZ5SSOInE7IVgyMw2doa1YgkptJpeVZGiFa9LGexY50HgZpG+UqqJUt7jBwbWIHxcxWIuTTrRGTpXTJfj+fDw== +3.5.0 [Build: 1580316377],Linux,rUbvG0+ZB8HoOkYDkThOPABe5URUWuFsCC+kS+c4ZpNtC70ju6uaLuM0FbG3AGiRcVc8SX9zMzagvs1cNVtYDA== +3.5.0 [Build: 1580316377],OS X,uRmSTbFGxBnghU7zAtS1624y8R3Vhvm9OWO5ZDwB4H9hxho+myT8ssHWwIN9VUWImXnwcFiuXS+lS1tjAV+3Dw== +3.5.0 [Build: 1580316377],Windows,2FEBFDRIkWw/cYRUbuSFvwADJGhZ1sCvFrZj7sZI72hrRRcCI1CYmTo/ukzWsEInAFz6rMf7qBaaOXfuU+6qBw== +3.5.0 [Build: 1580593763],Windows,PmLXQboEcpz7jB1v/Y112W7aFAJ3ltgXzg167RJF5UqXlWKeqLC6X8cq2tGYRauQq2RiGDaToMcfBrsKlU5UCw== +3.5.0 [Build: 1580672591],Windows,ssFQHF+iHGDizteHBEHI7It9t98RBUBXx4VuUPDsSWBPnpVR1/v5AIMnptFkSatOYP03JfTHH7ww52N9BdsMDQ== +5.0.0-test.60 [Build: 1580683977],Windows,8Zy0uvHADWR1i3FptlvwSPvLeKsJzBgLkFDw2QLDcBJykRASDJ8LP1VxxV/pO8KLemcwNnsEDthHvtnXo2c7DA== +5.0.0-test.63 [Build: 1580751860],macOS,A9h+7BIMYRncyO9oMUlQQFCsJVL0wq/ukLTBhXfF5s7JYVcmgDBaY/FGd6254ddUpJgB3aRKNhBpTuYWdx/ZCQ== +3.5.0 [Build: 1580753736],Windows,Z/6h7jb4vbZv4ERritKcJD51sxrd5Rfb4qTP6Km320A0Gw14OoqW9Qz2AvN6htjFtgcZc533wZYve+Tf9Jt8BQ== +5.0.0-test.65 [Build: 1580774583],Windows,Tk3I5UUdu8e4a+TaykPYeISia9SiSnYqvOFsLnCg3jx6tDH5qyPZgknB2YwVb1ULuKFOl2wHkKfYznrcyLJ0CQ== +5.0.0-beta.20 [Build: 1580775353],Linux,zmuCstKmjd5B33D80/ZzUJPnxGArcfFfsFa2ZeuRrxjbckZ+Q6VmIsJ1zY8sHaBq0hplbrzyKF7nfE2rhTWJCw== +5.0.0-beta.20 [Build: 1580775353],macOS,zVdI46BGmMQApIIB+wnhXrkOk0M68QwE/gwbqg27KFQqhDKBbMuBHqwA8lqDYu6cKiZIXNSEPtpriug94wlrCg== +5.0.0-beta.20 [Build: 1580775353],Windows,DgxH692v8HgBp7gZmvjovF5/ho7UIW/BiGq0rE9tCGqn6qWhD9UDV6h/mQs0rQ9xGkttvoXgjaXx8Jdy6wMRDA== +5.0.0-beta.21 [Build: 1580832125],Windows,m0or/uBBRVngzw13Vqg51y3tsLBsG4mAaHakIHCOEh3Dk9kyGavHeYYNq38i5AWRP0HKAzsngAST4yJWA+FnDw== +5.0.0-test.67 [Build: 1580844878],Windows,DvmmonitqHF6ElwmDmiJ07pEq6zWF1Ui5mk1D7256fDwVkxmjOlTWXeBAXQY2hTZi7e0i8UL8mKntx8Aa03bDQ== +5.0.0-test.68 [Build: 1580898716],Windows,+4HgRO1mbyi7Y7ERYf6rY2zl27PpOfOqqM2hplBpCwGYEXqk/kaDYgR2uzjE99tcJVPFkGabmRSKhpEkNuy1Cg== +5.0.0-beta.21 [Build: 1580909538],Linux,pxBYR/tOgH4jlnlRkn3r0KV8QDqMqgwn3laSnX7UlTAiuHsoWC/Ate/h3EJmErG5ZkrPpNfiQ/LwjF5XA716Ag== +5.0.0-beta.21 [Build: 1580909538],macOS,+onDe6gCP47nLw4O6h1YGfW/hcX2obp5lmbIssLC2QI+7ZM5zqlLVfadT/mlGEJQmkPwTbgfB7skWb2RNlSZAw== +5.0.0-beta.21 [Build: 1580909538],Windows,bIupsgUpyshmRXuk7BNbdyeVe2kaFeCzK7JYsAC42pTQd2c+BJ9d9k1s++98xUiawk02PJEMHHTOMbSzb0stAQ== +3.5.0 [Build: 1581008757],Windows,qD/zY2WGfK+bWdVtR9diH5Cd4gqNaQoGkyx/CXU9Uj1wcUoa1zl9Q4FyvKknWDUk4xMgW6TwV3/dqEiMCNrHDw== +3.5.0 [Build: 1581019294],Windows,OefT5cmBEGyvtnycUbFibrYGJ6fbfak/iWy9SkaPtDHs+6XVwuWF8QoPlpPxDVr35Gu0wf7CosU2tKM3cLinCQ== +3.5.0 [Build: 1581183683],Windows,iRBp5ZpaD2Rl+SBDz0FdDXULs2j/QOM5EQP46DZITMItEkve/XDRx06WeUvMg6F3QQbMGBM+A9XFCPwkrntfCg== +3.5.0 [Build: 1581524851],Windows,CAufZh4u1fgPkBO9ifw795k5uPG3jzzYZuUJF8ILt0549dOpptY5rPExQlN3DITn8PqYpY7KqmyxbNYGN9QiCw== +3.5.0 [Build: 1581573435],Windows,xsE0T9FneeP40ZYx0wSCCOp3m+4NPDpDJi6EEl0PL+N3f05rJg62yi3U0x5QUWZ5qTYWqgvg6xK+wxiiU/eXCQ== +5.0.0-test.70 [Build: 1581595773],macOS,nrbngLiQ+oFmVaiep1bqxvtbzhxs9aIV5099xsdzO61dPTMZzkv82QOivGQrrQFyJ9pAPY6NT7MYzUqiNfXeBg== +5.0.0-test.70 [Build: 1581595773],Windows,7hafwSRKQQ9JibQOLqkBY9Xvpcfee6W7G457dYfOAcw+7sVMDESgTZurizhGC48rLUAI5/EmHAHBX1t+0Y29CA== +5.0.0-test.71 [Build: 1581610274],Windows,Kx5AAFhCpA18Qpe8omponynjqyY+LJ5YOvLsFx0nyXT4ULXO7wOGj8zOuBnBmEfVdqNxp2D3g8h/+XtpETt1Cg== +3.5.0 [Build: 1581610500],OS X,oD3b4mzAO01Rna2kZQR99cacT5ga5wWb5Pbyb/amrmVB8pk9mBhI/lMd3RIZ2FOTIU+Whl+c19L1V6F2F9s6DQ== +3.5.0 [Build: 1581610500],Windows,YDLAfOb4eRCoIw9rfmwAAi2g7cowAb9UaDebmmRnnMnlgzmPWKEt04pavAHmISYUcUyVcgcN6Xd9TWGXkIp/DQ== +5.0.0-test.73 [Build: 1581688728],Windows,1kr/E/7znkikhDCNMOPP+e9EI1m5zxKM2UmvPw8myp05FKYYU4jT4qq03eDN9tXXsrVQo21cEaa2iCkx/DpMDQ== +3.5.0 [Build: 1581910955],Windows,V6WplfyLI3EUNzHpfH3fCsEQPvw+0ZOUjcul6/F7zdM8PH1mYUC/WabyXyZeYSFfkCL6ap8JUTpj/ndIbcLHBg== +5.0.0-beta.22 [Build: 1582011547],Linux,ujCBv4ax/Z1X1/kN5FRcbYx0RdBy910N6HXLMFiGCB/8FkSzn/fVnqGQq5c4j6hI+jxfnXazTVMR4P50G5N9DA== +5.0.0-beta.22 [Build: 1582011547],macOS,O0I6ny9At1k/tCunLjdOyoxmkAh00RkWDg4bMmgQtCgGUa2g9LsMninbuRgq/qEPBpA106to/Br7kCFtU9AiBA== +5.0.0-beta.22 [Build: 1582011547],Windows,lzu8BcTXHRlmB5KE+JFk+MvR00HKC+sMojtvZNTT8HF2IAYRQ8RYJTgoMICwVwXmqfnpeVWRm7nlN5aGc1w7Cw== +3.5.0 [Build: 1582117478],Android,vASJQFPECG2TpUh5ATsR2c/gVrvsuZ9QlMpKN51F+HnanYNH3oCSGoievQX6ACjsKH3OZihNFQZ6f5HRU/MAAg== +3.5.1 [Build: 1582118844],iOS,3ZiKmiSA9g1xUhb67wgAPz7duV97QCoMQn4OmjqXUffVN5cvztaUhIBm0oZ8n0DEXsgx8hulbqWBFIN8QgAIBA== +3.5.0 [Build: 1582288251],Windows,TfDGO2PFx40/+aYype6R4NymCpSmaVK5v5H0TPv/RJsQk9Eph9ImMtyScUfxi81Dm1QmUwAzUCYDT7oVp2d2Aw== +3.5.0 [Build: 1582632784],Android,WdEIgZGcvq/nA72e75D8Lg5XGpzM71uP3ACM9ytu6VOIpnhOvhDOBOEw5+BvdtczwU8mmfSBRp9YOe6weF5MDw== +3.5.0 [Build: 1582634532],Linux,q+AGeyyc0gKGc0bXXqYuv0Rbnk2OaOyrDZPYSLx6USPv1O2BE4ny6CH+cW4phg7zwQreJan4LwVPL9TXLscyCg== +3.5.0 [Build: 1582634532],OS X,HVr0/VEWh/5oMXA3nqYsdj8AMEtZs6lcMzTgxVg4vSPzi3WUOzLTgGx6SV3B47qzHdMlndRG+f8ez3VmUBo1Dw== +3.5.0 [Build: 1582634532],Windows,HIA8YsTxkbsOKakMQQtAwHvEm0fYR1vfpw4W5LJePO2Zi4H7DXPbW88jRS6YpyajE2wBrfDQQ4C1bcyLM4F7CQ== +5.0.0-test.79 [Build: 1582881429],Linux,v5iYqAuhZ2+dGwUdeVb7SLakgwbTgVyTHGA5aGUbpApvnsb5rGv5R56Oo23TbLJA+I8BG+MUAMPjTAq9bGphDA== +5.0.0-beta.23 [Build: 1583314601],Linux,kkzWsdmOEEe4NHmnfH0vZn3Bo0Lixigl/n91SaMpFVUj7sNmjuCnYYHHNC4lXOmk8jqiK2S1HCS9Du2SUhuWDw== +5.0.0-beta.23 [Build: 1583314601],macOS,ylP6xnnn2g0DOvkQE2DgwiDbhm6s1J85SIQRrTgY8JRa5H6FNniAFPgGaxAFmvfianclmn4k7Nm9/McVX1fTCQ== +5.0.0-beta.23 [Build: 1583314601],Windows,aQ38hj+f8Ih+KEy5a9Y+dAS8Pq9lecaVSRlAK+4+3FgTrl4vgooSRYfOsRl9sgP3bDDJ+mmYH/Wp45puckeyDQ== +5.0.0-test.87 [Build: 1583490334],Linux,TdwctqEYENLgcpBtOuCDIZzG1js/u7rsdHS8DkqAEViKsQ27VJTbCvW3Ti0z70mX6g6XZAWixxCeZEf+F81aDg== +5.0.0-test.87 [Build: 1583490334],Windows,zBVMxaWgifJDMm348f8rKF0fLrnI9w6mXLSDZ4pP183FZafhXqDKKVZcjvaTRv4G4wyt4pFHUaOBwd/ByTh2Aw== +5.0.0-test.89 [Build: 1584014675],Windows,AWXttmmIF6QzYfwuPgN7YT6+x00iQVE28oAB5kwb2elZ987qJe84FzkJZ6K1zaPBLeYn3VBqsCW+OdMg2CNHBQ== +3.5.0 [Build: 1584088288],Linux,9UVeO3R3xm1taUmEFTnngy0C1iQovwzWy1HwyFlIbBDDQaN9SHR0hK2GpNrdquliY0wtNSbAJ/7BtGhk3or9CQ== +3.5.0 [Build: 1584088288],OS X,wdYDalZQtOO0+HQAtq8xwMiWSS2bqXUltbyIGBWebrU8YWTFuIeqmhA9W/jo4W4yj6251qRLvxnFaO1SywptCQ== +3.5.0 [Build: 1584088288],Windows,yghoziODwuQ3LBpgUUHT2/kCTx6Ygbju2WxzM8bojYGGiuQrL/+Tb2XKETUhYJWfHZ8WH2PvIvB4MFZIcJO5Dg== +5.0.0-beta.24 [Build: 1584452452],Windows,iLM0f1OmaoBrg6IqLW0GlSJcR6kydwtJjlblwIbMmbzIXa2xzwXbtREgvq5eenK8VfBfckg2g/KZygGV2XOHBQ== +3.5.0 [Build: 1584525989],OS X,nX5cpDbTPvbzSivBfvqWGpjokX42n+1HlIKxmHBTBPhLbIl2Fn1f7znSY/31K3fj1hJPJVOyuOKyPsRHK/uXBw== +3.5.0 [Build: 1584525989],Windows,boQPV7FO3e0PJIxh1gSAG8Z3/NxLWbzVej7glvkQaSfvPWj3Bg385Ikn33wLHn6brcWHAo+fpdQdZskXFmj8Dg== +3.5.0 [Build: 1584610661],Linux,kHfR/JyZ6Ah06rW/t+dFIHkOgLGFth5CCbRr9T3xfPd2gqL5CeYei47LGBjA9K9GrVVRivF0L5eo5MrxGh/QDA== +3.5.0 [Build: 1584610661],OS X,RZJrT/fysauFMv9ugB82ZAZN/t/MSWeJmFLu35FXx/r+3O1QZrM8rDfU5Iq/moG68hPRcc12KloOvrlVTdfiBg== +3.5.0 [Build: 1584610661],Windows,8um3guYdjDlKHOUZMYqt//4nT9k+SBYnAAP/9CarVp5pUXEzYaTZlflyOi6hjYIDn5cQ7gdvrKmdXLOXBJiqCA== +5.0.0-beta.24 [Build: 1584621089],Linux,iTRafOxViAWbIg4Uc2je7KrxkNTdc8WjEtQvceCAsvPY/wL1tgd21Sy19iqASdAOJeQ302Kb06ajsq+8SdfhCA== +5.0.0-beta.24 [Build: 1584621089],macOS,eD5rtvlqnZOBDLN/2VKKh/DeNsPJMY/H1y5yn53MuFKJJDR8VKwnuTRXLHPShzgCEQrjo4EvoY5ksMFRpeAwAw== +5.0.0-beta.24 [Build: 1584621089],Windows,unVP5b7fNc0ZDXsA54GknvLR/FWIQM/obpQKGDUdTBJU44fOUk8p2Nq3o3HtcS44nwhA8Njxi6x2lsuOs8jwDA== +3.5.1 [Build: 1584725003],Windows,EPmzKEUtMuD+7bg4eEzU4sJTRI0wRB6kQx2T5GqCyQB+kgBZO96plC4uNcZUBtwSXYYbkNkyfQc9ZwgOp2CUDQ== +3.5.1 [Build: 1584726885],Windows,B19O3onHeCV8mc5mBqLP5PGof4VdvwLI8HFhxKsXRsDWOu04xbpJjkCy5RYTjMstCSo/Dkhl/WX0puT5/PEyAw== +3.5.1 [Build: 1584955996],Linux,YtR6uJ0zzFwlAXoV1ikV8DVD9y7ka0WCh46wvALArdCBw9zaBLE7ese6Uu3U2Dmg4//ook5cNvupeOlzHcGPDQ== +3.5.1 [Build: 1584955996],OS X,xk8NdgtqWPihDy1gUPGVtcLkfrl5Fd2lfigB0N7d9K0VGyCxC4ZvQOdX6kM/StTX1xulCnENp0wb+gqwjO5nBA== +3.5.1 [Build: 1584955996],Windows,LY20d0yqDFwknHND8FYADnvsKnq81kya6lAEnJEQ+87oN0k8KqTXMDpy/0z0yC54+B8Mo/P8kSjrpRugaVAPDA== +5.0.0-test.95 [Build: 1585049319],Windows,zhiNFDElBjkQIL6xELBUPjVIbYbECvby4qqq+8xo5r2RhF6ZfjebvmX2iqtEJsEyRoNqekcvAH7KGDUdzFaLAg== +5.0.0-test.96 [Build: 1585156359],Windows,w9C5vLHnbUcg7sypEF/GbrqiMnabQ/i1Xazcsc3fjF1STvHWHuBuRT2vBAXcGLIpqxQMz8J4l8yDqgBFzFs+Dg== +3.5.2 [Build: 1585741147],Linux,qILhBdVwjtE8enMjQL02b9i80CRybJgolFQWfQgLPjWLvgbNMeqAAFS+X7HB7FuF5VKq82biDYK2cuQJjTAbCw== +3.5.2 [Build: 1585741147],Windows,If7v4eV0QZjeSpH2ld/suq6dW08v0UZDRRTjDy0d/4mg+Ve+sENwGtggDZYPLgDj/3FEJLVuKZmBw0v1LUM7DQ== +5.0.0-test.100 [Build: 1585752032],Windows,VxWe1xx5ggANpg9NbR9NAG8Kn0KyJII7IphKVXElGKgVnCdHPSwINF+mnZl/l3e2P+EBvvLzTXK1I0wfbu+iDQ== +3.5.2 [Build: 1585812952],Linux,Fy5GNeXUzrP5chKDWhG4G7T3jj8tjg0JkoTNRl+tgrONOWNbNf1zBD+I2LNqJREJXvaSrXcMB1pOQQrWKIXqDQ== +3.5.2 [Build: 1585812952],OS X,VhEA3HpeSCbV06Dfh5wonQ+XMuC8dG96ZXvU5HCNLvkSatAfOsDGLaQNLfbkVZVcs0Hvf9oPFgWvAseSX96rCw== +3.5.2 [Build: 1585812952],Windows,6HIIG9j6bIUavbDFJR50Hk3hwl1j4BL/1hQS5Q4JfAS0oerwLNBbdAfXM963aOlE8yan9d/LWiXnuSKhQXAKAQ== +5.0.0-manage-permissions-8 [Build: 1585925917],Windows,NOVj4XEgHGfIgYhqXcryyaIOId/yVGGUqbJrWZ1tXSMog/lhiiuXZ0ULOibABIXD/QH08x1dln99AiZM/dLyDA== +5.0.0-network-monitor-1 [Build: 1586167450],Windows,LxpaUacQltAK5yxM++Vx3PJPtL0uC9YH9Qspyt3TQxUh0zBzmwIjRaNP3w+aNtyzN6JChinARB5b+LsPLim2CA== +3.5.3 [Build: 1586172156],Linux,GRdePYP+MJpGf6wtKmB2CEMZJ2x1wJLIX81CKqr9mVUDWyp8LTBzOJYxaldUboH+UGh2LOByHNR5EpHA3gdNCw== +3.5.3 [Build: 1586172156],OS X,8+NprKwynOC+wGqVZnaYc5g2A31f9MdoChKK3RYKd19lZEVRZngk5FFB1lIyI9TQKdNC4opfhGL3dvu9bAtEDw== +3.5.3 [Build: 1586172156],Windows,ujcLD9+x4JxR89dkHBEOf8ZxzX2yZjUNBu8mh5f9arIuNOBSbrrG3eRjG0qFNbQnRIUh058tSfes5TRyaF+kBg== +5.0.0-test.104 [Build: 1586348340],macOS,O29jwgoTOWgTnZYjhQobrMh607sddxbOlesu8xBU1oMtm74mLZ65dajvMJPb20jpsXhdCqk+KHt8TcMvNx5fDQ== +5.0.0-test.104 [Build: 1586348340],Windows,h/lwYRBPj+GeQZqUNyXOOvVfWlue4rr9FfGgHt7vMlPWCddPH2fNjDf9K7dNGoXMm5DDdVHUfPgcKfC6+nBWBw== +3.5.3 [Build: 1586353391],Windows,knmVmUvvQTTfOUCWlQncjWFWHXFqZMntUbIPIi/YLcxdW4iP3woJQgVTaIZPEiluMT5A7tb2lSk/r+Byh5R6Dw== +3.5.3 [Build: 1586853103],Windows,Ht2CRGb39a+QZ8YlnbfA8Ip8pQa9kRd2A8Nmj8veYiGMV4K0TaP7UG2bwuxxJC7sIdre1esb2mHric8ZD4hqDQ== +3.5.3 [Build: 1586955962],Linux,WxwBpvlHwS5fmiEn1S7ATpPU1oR8U/tdSzpZvAfoIOv78w+oL9UlTouDquVwrl6L0IXIZvRIDs+32EfbIZVmCg== +3.5.3 [Build: 1586955962],OS X,/9gsbyyJoyHW1okwykGgXrn2j29wvnEfnw6/Hvft2WS12CURxTv5L9uLuu36I5u3TzWOxyB9dEbD1FeZ201uCQ== +3.5.3 [Build: 1586955962],Windows,lnyUR4m/DQIpXkhOTqjrpH6zIxjo/gHgjoiQb4zDEuI039Ys+K3ST/fZV2n4u6/rJmV6fYgmoEKQ2OBjh9ULDA== +5.0.0-test.106 [Build: 1587037548],macOS,pb3fpCZJylNXmOsJcVMo5laRCtKWHrCBeUNGGCehZb76PC593skEWD4N6UmEAyPwoi6Fg6C7/cmbaWP4rtSpAg== +3.5.3 [Build: 1587566168],Linux,v5Qg6ng2ILr9Ca6iTgjfYnShBDwioRf6fyA6iODHsNUhutwq7yXoU8z64NJRGNuqLKVbS95Fpm7Npu3YAfm7Cw== +3.5.3 [Build: 1587566168],Windows,k+/YQOZz+AlZt6h9/XFgHDI49rx2ce/Ngewj4pvGpFUmI1c/4bP0bAeeK9Q7P1JIzzdwp4qh0CkaSDbVYLjDCw== +5.0.0-test.111 [Build: 1587633723],Windows,60DETVUkR9veo0Cc9WCV+t3r0w836CfRZTgw/sZH0LL6AwtAab8sbcYNcOBybSssn+QgZI37kdc7B9YViszgCw== +3.5.3 [Build: 1587971024],Linux,59chu1YQ1W4DdVj+yJOVmwhJK7s9p9FatqIjQRxEDmIb0CcDDO/K8CrbVnBHbD67/cExJbC3PjC/o/n0pDbiCg== +3.5.3 [Build: 1587971024],Windows,Kvmj7qX6wJCPI5GVT71samfmhz/bvs7M+OTXWB/JWxdQbxDe17xda7dzUWLX7pjvdJTqZmbse1HBmTxThPKvAg== +5.0.0-beta.25 [Build: 1588064367],Linux,L5rpK9OLT84Hgpg/NXSCwpHfrRc/JTtMa/kFfaD2rlF7c/YHiEnly/4+A9y0iowA70+5JEzyH6CBjkniiz4DAw== +5.0.0-beta.25 [Build: 1588064367],macOS,+Y1iB58sLO38/4AI1YRUlEhXhhrbkAVbaSmOcZj0IrTmQm1eY+prEYJPQgF8StFdjWmAGmMG3ezzb0wEzRE3CQ== +5.0.0-beta.25 [Build: 1588064367],Windows,VnoQXCs1i1iEe7miGKqxKkxkjFAPIryo5cSf+eBLBmiBMOnJjrsICg+HxHEHcOdUL4Hu7VfP+8F4tYrN2TmxBg== +5.0.0-test.113 [Build: 1588173300],Windows,hTPLObkRW1TRRym4E6fJC7P9ngYa5IuFwe75RJSdu0Cju76VHNIBKzLBrU59IgmD3MChY5sEiCBML3V7IM1RCA== +3.5.3 [Build: 1588250739],Windows,arEooa/3dcP6Ck10yN65zk8z/Lt7QnxgApOi+IoPafYFKo0b0QeZ48qT3Kmtu2VseU9YI7JQrfpfvOF3YZrvBA== +3.5.3 [Build: 1588261372],Windows,MwZT29nmkJekgubjZGJV08bDegfP5Y481bThFRBna0UDhECDEfLcdW/0BE6YTC7aCvbcx5EZMXE/R+jdRUnhAA== +5.0.0-test.114 [Build: 1588589210],Linux,YEEYWLVRGDSB/SfAgUEl5K8J8kZ6m+PkgLW3L3R0pxAmRhttvM6Db/Fxc1CjE0ShWMcIQmxb8qlDTTOxxew0Aw== +5.0.0-test.114 [Build: 1588589210],macOS,pNeLWGmMtRvfHj4GrfOZP4c1yjustIsh2rjddFWDaIZX2n5cO1ivnK5jzDkjX1hANUMlPTrIZReLIYi5k3L+DQ== +5.0.0-test.114 [Build: 1588589210],Windows,P3dUXUfUWuT5TXGcCP53CEQLJkAfiJQDH/ojNxyyrLnfbNUR1bX+Dr9tirPYjuOIMF4iVvNXTYiSHRO5ENs4Ag== +3.5.3 [Build: 1588756070],Linux,bWiXMVa4E++lbV6zpRywdvKilqfi1++nTZd1NbPnMUfQfVW0JNk5U5a2vkGft8Dd21RNDHKBt8t77G/PAEA7Cg== +3.5.3 [Build: 1588756070],OS X,/Z0BeU58BQwf80NuLOC7q5lUUcscztBUVePMpKSsUxumpJJQX34NsGw4N0DMekVEg9Ds8RQJk+xMopD+fsY0DQ== +3.5.3 [Build: 1588756070],Windows,WY2De4HPPvwdiO6ZglSXQ3zq6HkeL0ZQ7GjZSMXN2X77p9KDBxE1O5QdSTQjrXfl5RUkEA7hcgjWfTxOcI5mCA== +5.0.0-test.116 [Build: 1590740393],Windows,70tCpJiGP2b5zKIt6HzTREBqE0njaUyWj/dCVd+DUT/QvhB8j8coh7BZ+rEWzS0bco4uBWJBCPFY7RGekwh0Dw== +5.0.0-test.120 [Build: 1592228855],Windows,UJaqz8lXzZrmF7/nWZF0aMUcJQYyDluinAxDKxZNxSMeTLWUShnBHIXs7EL8yqjikqTTdwsMzEvNAZ1CsMGqBw== +3.5.5 [Build: 1594109255],Linux,AG3H2BCe5B2B8gQoYBhLymU2iUaaVth0hnUMk6tHK2Wa/q6Y5KEktbHEJxRE84LGttm7kzZbvNzFx1SIbdXhAQ== +3.5.5 [Build: 1594109255],OS X,6pAN4KDU74hkqHQyJmaLnQZbxK9tPAKfoocmHFYggF20dCIsrc6yKGkaKN6OoSC0BGaOpg6d/JDCus9IZg2fAg== +3.5.5 [Build: 1594109255],Windows,RP85L3nZRJe1EmD2uN2ujwqoqnOudzh6mCvpvNxn3vqokKQ/RImt53JpaVfDQANdXRM3iiCy5K9ilILdbDScDg== +3.5.5 [Build: 1594213121],Linux,qcElldtu07fZwpqJibMXCuGjdzgk1W+bHOmtrMRQzUEo+qxkETaR/dUpUqrF3WUKQ0XC58E0wG584toQGk2jBA== +3.5.5 [Build: 1594213121],OS X,WYv9XAEAMJXYm56+9YiSEufC7iUFimD9AIgPqXBbjfYqu7VHw6btHiWl67r6Obric2J9E+fBihAH4AUCllD5BA== +3.5.5 [Build: 1594213121],Windows,fL4Bx3UDyN/wgrzE3fgwayKnvMhg3SWcQRzJdt3eKno3rM3rlcVujk7yeki1Gs1xh12uJC+kK0lyGjxCea0CCA== +5.0.0-ui-polishing-2 [Build: 1596738566],macOS,Era2fdPOli6XWa1zj5mAjO7caaeQZsnOIe3KVowly4P3Pv8NDASk0+vw3j+Hy/7jkyaFDj+zRbEB72MKDNPhBg== +5.0.0-tschat-test-7 [Build: 1597217264],Windows,A7kIbQ8i2LYwB5cIjO+fwkrJFXo5LPa8dPj31bL4CxoCSh3VBoL8KV7cKAKgi3zMGbIdQ44j/XaAmsFy/nVkDQ== +5.0.0-tschat-test-9 [Build: 1597240212],Windows,+kSSDzRWNgs7s6RDmpJA1UoNk0Vvd28KjVQ+DP/6U3elwMx6DC8TF2XjEuV5TXjB7ti52lm0aZonL/y5mdrNBQ== +5.0.0-ui-polishing-4 [Build: 1597390040],macOS,SP70Ec4DgG3EgDsSTQ+aWxKRTpr1ECxJoS7GENe9Xrc6hHnOKoqTHxPZ5vOgd4JwvNL71cUbPZhUHx1jHyn1Cw== +5.0.0-ui-polishing-4 [Build: 1597390040],Windows,617fWVNMxefDPrTGXNzjkMMAy0PBSxMJzlOGUdOc1CyEFWJfRlaPYKykozgskjDtOR4J76EGURz86IBMxVq8Bg== +5.0.0-flag-test-3 [Build: 1597393952],Windows,brM47NqjZLKE2MdYGPtf0D730zbenP5m0xhnG3100CXkguPX/a1lJjTS7wpyRmfoHqJn/840nMlUmusH+K9RCQ== +5.0.0-move-testing-1 [Build: 1597499112],Windows,WVLzzHFy/sN6kvXEtrv4zw+qyUMQSLNt8k2pFt1GvO0kOqZEq08u3wDCy1G8O/3mdIIrMNYAUQpIijMAOpwUDA== +5.0.0-move-testing-2 [Build: 1597522136],Windows,ULSMPYrWPPcxhmdxdnQvxRFvYAZXKR/BveIN0brlQ0Z40bTusc9sxkq3eeuZB67dIefF5xpCmXQiF1rpdKVLDw== +5.0.0-move-testing-4 [Build: 1597581653],Windows,YSpkYU2/uYwzDWmXdXQjgtj8uk3ko/ZQJhZU0NVXyj7yar0pm7g8NaWIQusd0fVQxlkRdhvt8FNqNpcZFvnPBA== +5.0.0-flag-test-4 [Build: 1597915096],Windows,CXeiOEZDQrd5Xmwl6zNlkmcyPw2SydkrcvUvc42fVqc7KZN46G9CZQJ6AlDv6N38xRd+Ugqnxvgtt6R7pDtEBQ== +5.0.0-move-testing-7 [Build: 1597931781],Windows,4bUyAdFhGoaaGdKjaiaKnHG/1S+6piduMJgqvAAzWOhHstEZbqUOLJqfENyN9bNgoZhJ+5rQV30FxzIay4jJBg== +5.0.0-tschat-test-11 [Build: 1598016546],Windows,uSqM3SaZZFMQ+wu5WMDO1bsSVS8UO0RiK0ClQQqxGTa3/wSYId1nNeFo6uNEPfbbMMRddfplzGoquRAshCWhDw== +5.0.0-ui-polishing-5 [Build: 1598262399],Windows,ovnKt/9eEjZWmF9MEMmLchAQ+Dlror+Dnz4ULrYU7FmjpVZZgjj+U4qXzdeGkHnMSIq5NsNj+IPQwBCHfcKBAA== +5.0.0-ui-polishing-6 [Build: 1598444718],Windows,R/P/PtSOH7fiN7jcQV4ynXlWQ+mu5dszFutDCPxSbX94KiQDOyuKNRx6wbGIFCbKUbFsqfSWtQpdNLXSdxA5Bg== +5.0.0-ui-polishing-7 [Build: 1598531141],Windows,6EtepyA9GZo4oopLY4/eGNsXkBtcIRYFBd9eL7jBvefO/aWmpWUqPLUsXTdfxxiuDLqaAxUpjFFH6ys8UToACA== +5.0.0-4f3ac28d8 [Build: 1598636763],Windows,ipbprZW/Wj+awfG+YTkQ7qoWkxCTk08wGrKhUUKindDZ8KA+0qKyfnChOgUPrpu4SoQQbArw8hLpBiFpclbnBw== +5.0.0-tschat-test-15 [Build: 1599059062],Windows,0omqloYB4FSc7j0jknZ2VPEWSbqfTtriAT1RaP+FSaI7tnG6CAqG5+1ZAw1ngPtaithbqHx5taLBU5Gi1Q1CCg== +5.0.0-cobra-test-2 [Build: 1599165810],Windows,U7nvm2ZCxB9dwSGyKt4TlVPDoBXYVfCamV9uyilR5CcHKXIExtFkH2W86HUKJtMnYtWnb5sZ3PePT0LqzEO2Cw== +5.0.0-alpha400 [Build: 1599165997],Windows,vAzgabsbFnHs5ceGGJw8y65cb/0Aua4dei3iOP/dJ18H6jVhfEhAaX9K3x6iEgBbJQVZ9DM9CJ7TbGXAmdP3BQ== +5.0.0-alpha401 [Build: 1599486917],Windows,mFkz+RiCfiBWzElK/xhVd9N6mlsAzu80fTVxqYTZWNky3lF424z2FY5w+AjpwJdQXJaO4476CNMZdCiKeciEAA== +5.0.0-alpha402 [Build: 1599557851],Windows,QBcatWqkPlr7DSTr8UGNPd3UnyaC3H5Tqf05fpMgsqX8LwFrlmH/nkVoNFDolAQEzvlvSbPTAlOfkeLxqTPVCg== +5.0.0-alpha403 [Build: 1599578655],Windows,Wd2+dE49zR+vcFRcOavZ31cVGBTpI0/PIVI6umJT4g5p1yRjG2Y1DqCY51TEyFMTdL3Ki82TKxz0TfRilNR1Dg== +5.0.0-alpha404 [Build: 1599669220],Windows,CMsTD2jD9+Xs5S2gKNX7vtHMO0GpbiiiAyL3MGzpe5N0KlLpUw2L2G2hB3gGD5YpfKG4WYn19ehfo2+eJMm7CA== +3.5.0 [Build: 1599755905],Android,uxDkYjha2wFI0YQqFbresfwTKfUftLNUI/nNxHfBo6TqlACwDMKfGrtwNmzVUwR0Rpv9OhOOvJ/AwyeCY2LUDg== +5.0.0-cobra-test-3 [Build: 1599769084],Windows,JpEr6MBZnRsh71PkO8VNi0X7w1ABPt8utVPSOyyn+tRa+q6AVI0i2dSblnfTsgBnN9DEYd0yNUVItXkzxOTLCw== +5.0.0-54c87064a [Build: 1599843538],Windows,Oadma4PaBgy+bwN4i9HTq1TlK/+597K79TC2vLjx+HRAvqmH8lOt2dpTM7FRzZXvSZZD2U7tpJPDtQ8FSsnKDA== +5.0.0-alpha406 [Build: 1599846284],Windows,8YQ2CFzDErBCL/4EAbJkbTH4yb22vET9ZZ8f4b1I9NrPyKJLLVPmiJhqeayqJaHMaxRmjUV0SliI22PcgcdsBg== +5.0.0-cobra-test-4 [Build: 1599917420],Windows,qyUPfMweT9jCmjq7+nOy92VShZ2nuIZKHPWcZ7e3x6nqhT1bQSWDNdvj+mIOfn2qMsUh0wScnSASHBetwe2IDw== +5.0.0-alpha407 [Build: 1600159955],Windows,MvvOPDyWEHaDiNQVvFqUC7b9xT7IypfBF1CCUQgYycJSHBTXieGB2vIo0vWfB29Ng4teXvUf73VyyywP+YSsBA== +5.0.0-alpha408 [Build: 1600254224],Windows,zU8VYYXa6Nj2zuI5cNsX4lu6sN7FlzOhFCNB+q+KUtVplKNnQnTuNIw6qykGj757kie9/UsXpxIqiCqZONNSCQ== +5.0.0-updater-test-8 [Build: 1600284324],Windows,cCCPTceQ2GqeV1MdPsF+HJjteOhK6sy837lQzoxLHYi92IaChxpsANQCGGJmpMPA8FfPRujMqUO2wxPdNRVhAA== +5.0.0-alpha409 [Build: 1600339559],Windows,KVyePfU2z8XNWWIl/iFGHIWthdaTWZGC2qouCghpPr99uhQ1P2zqXalwJXwDE8mFhGP1/K3KiB4P+RM+MdxrDA== +5.0.0-alpha410 [Build: 1600365598],Windows,qN94hYAUzrC4037xTz8PKgs+YUpn/tcvMH08WvSOmZIXHC7wNrYZYZvHZ8uBmrUZe7YJfhrWgLxWxYZDfot2Dw== +3.5.0 [Build: 1600439598],Android,V5VxAFG1qIozePu/NwA7GC6Lkv/qcNR5sSQf2luqnwra1LmahG1B8HxSd43WHHS68bXLY0lepDjX6by1i5JICQ== +5.0.0-alpha411 [Build: 1600469361],macOS,Hufdiya9ezgpPW+tv5I8w00Scx3BbSYFBVBV5VL8z/Wyj0LrSE4y+na5XLmS2JUUl4cMVuEnimhzE7V0opqYAw== +5.0.0-alpha411 [Build: 1600469361],Windows,YioE63QY3Xo62SeFh9+y9YDqdBUacYEk2AHNbJiznOt0QfFgGaXKs4+OiZF4QHB0dkY8tnK0u18JQbFMti43Ag== +5.0.0-alpha412 [Build: 1600599064],Windows,7T7c8XivXygpk+TFtLXIGcBaLzr0+ut/RlOBY3/r+ymNJ4fMXr1jwNZWm0LTUnoRfl11dLwJFIQ1THYz5X7xCw== +5.0.0-beta26-rc1 [Build: 1600686231],macOS,l5WNBZhy1XSkDaIjTEqWexk4rWFND4krcMr7miKW2n4cCzuDO297wiD+JitHQ4WlrrH56ba2iYzXEQ7XCJExAw== +5.0.0-beta26-rc1 [Build: 1600686231],Windows,xuSjmrIAg0QFnqNa1h+93d3Z2pK1U1ZwZeR9G9obHsGFnDvw8a+JHGUDDyUew5rTSP391wyE+jaFoF9yEoCzBg== +5.0.0-beta26-rc2 [Build: 1600787359],Windows,ryvuIgSkD9wxkyGgviy6IKWiUCkTWXYt1EB9BGmtb7cO9wbg/YMgmhLFyxjHBc/T27GA963bTo8YPeN1fW6hDA== +5.0.0-beta26-rc3 [Build: 1600861922],Windows,dcReQuakK5hux2rvz032Ol4Xg/32ErtopQG9Ue05z+Br4o6EkWou3SOFXLs7+wEQODFCdWMwyHULG10ja/UpDg== +5.0.0-beta26-rc4 [Build: 1600948191],macOS,t3c1xpHIuySi89cBf6fQyatdpFsjy3FByJR2wAabHXXHdavLTAUWKDEHgypRBV7USjYAXaxyQKy+gJZBc623Cg== +5.0.0-beta26-rc4 [Build: 1600948191],Windows,T1o1pShuaBXz0ikD5yxHG85ZlScEp3yq+QZh7VbpvOwWRtsjvKfaQQ3wZNNzXEzvxHBrHdrxDQXwnoLKSpKlAw== +5.0.0-beta26-rc5 [Build: 1601022865],macOS,016WaAPU1cQq5tcgppr8UJLISyhRraHRcIBt1Zt5ivD0JTS2E5bnFeJ1599+5hAYtBZaR3r+CyBxdd2kbrjPDA== +5.0.0-beta26-rc5 [Build: 1601022865],Windows,xC/f1gV4UFzN1zRwSHmn5kYhRcJ9XJIdR32QlhNaf/GhM4uk2WOxo+AaFXpfVN8Zjf+YepOpecVTbajUF6m+CA== +5.0.0-beta26-rc6 [Build: 1601285793],macOS,kO9K2RgUzoU339T315xm6N/hdEM+4fyX0bfUWogr5y1SL9F6gE2mfFpuZUJjlc8DxUR93hZ6nq6gzjZCHhCcDw== +5.0.0-beta26-rc6 [Build: 1601285793],Windows,VK6yvfCpPk2VbqU0MStyWK7OKbGWqFy1ckLGTYZ2+pbpJAhuPRnFhEAfy9SOoN2McczquLt0CNzi2dt8MSkTCw== +5.0.0-beta26-rc7 [Build: 1601384917],Windows,7VKnNQeltTiOk09y8EORDrgcg2JhANV76y2bO8lt+RgOK91OVTBQcFtV7+Ph+mFPnVsWeeMdZqDHPihUX5NrAA== +5.0.0-beta26-rc8 [Build: 1601393829],Windows,T/Iwhz5+9ADH+uG4bTaSdFJtTpaEjQXt9c4SQRKR7sTOvLmOMMcI/aecv2zots5sUrb0loVA/6XKfVpOaDmCDw== +5.0.0-beta26 [Build: 1601452077],Windows,5Ky3eRSCxlef+IKraGDsCDGOuwVS79IReK3g0z8s2H+E/v+KRaw/l+cXjyBqGDUrLQAGmG5UmHbIiuAhz6ZFDA== +5.0.0-beta26 [Build: 1601476259],Linux,8JoozxphOv+RXiaqutCgokpg1+ObD1+7+JvOsPA5aeVU9eQAxYtWKIcZm6QvbFkMkcJY5HQ6V3loP3+m0TMWCA== +5.0.0-beta26 [Build: 1601476259],macOS,YwqNu9i1wmtlS2GNUE+wRHnzLXNFB8rUx/ZYhWm7PDBnzEbqMrZA/6n9Sh9/zQ5mbc67b6Ms+CY/N+T6jJYLAw== +5.0.0-beta26 [Build: 1601476259],Windows,bgzGTN3/lKVdabzBu+fMaaeETaZtRiM7Iou/juKI13o5dY4inVOsPXDmO5flq2/sQ9HicCIHBZO+aReIu+FnBA== +5.0.0-cobra-test-5 [Build: 1601543268],Windows,duCYmWU/OHzBDFMNDjEKLNfrvf4sltic0IhpsrDPHoqzuNkY1Xko36ZfQfDvbUHRFXYVVYR3thQILuCwEFr1DA== +5.0.0-cobra-test-6 [Build: 1601558370],Windows,XsbQghGaprnZaMF6snKzGXBChAq25KOllmkjlN9WDFPJEhaJdt0f4wsWVBOQ9KFIhkE6d0+Ie6tS0XVqxcifCA== +5.0.0-beta27-rc1 [Build: 1601630484],macOS,Loaqp/e/iy/3qRRdqTPdT/MFGjiQhzPqCkzOmdYcoMVoRt3dwv/Vi/ipaCpHNaSPKg0aIS7LdQoFGfputapUBg== +5.0.0-beta27-rc1 [Build: 1601630484],Windows,sQY12C5m0GDUhxXMsAH88dyt+pwZglSRq2hsHTzlh6CCHFFh2jMBWzolmZX2LCi2Y3sIkZZDWdeGAQ7a1rftBg== +5.0.0-beta27-rc2 [Build: 1601922246],Windows,XJjYehJ/lhThfRD8UIe+4zMQy1LEAtFY3qf1rcOYtSW0aExaM2gpLVVsoEUz+vGrkabk/zSiCF0dfw/owtsjAA== +5.0.0-beta27-rc3 [Build: 1601985868],Windows,81lDEQYZk4t4Rmw6Lm9pQVXQvXFY87viiM6cNxHr1VfQi567R7a9oEpLGi4aNs5tN56k8jwajo7SnHoasW1XAQ== +5.0.0-beta27 [Build: 1601995137],Linux,R0dzSefvqoYfC5BBia6KL4A0SWbQk2/JVTsJjgtf0nD9fID593Myv34/oyObKr3MI9dyggNGiLJBGucK3UcPDA== +5.0.0-beta27 [Build: 1601995137],macOS,DcfxKwqnole3TzHXGi/vgXJ+HSlN6v5SqpQfcKW7RqPft1UC20Om1Iyt97rREgE8VWpkvgOTfCjO0wM3O6j5DA== +5.0.0-beta27 [Build: 1601995137],Windows,AGF1tTgjMDW8/1R0NiTg3kTrEJ26NIY/HAmrBIotBjCePmFtemvEge/Ap8LqLblmnfnYwuNbF2QDlornXstsBg== +5.0.0-cobra-test-7 [Build: 1602056579],Windows,P3Qln4qvk5GsbwBxNd/rQeLFwJwPX6TnvRX4tx2OrjpZjse1LiymkUa0rJamE4OigA0VNUo5YqhWoFyowMrBDw== +5.0.0-cobra-test-10 [Build: 1602071823],Windows,4IReei/v9/1ZQ9LTNrZbRQBig1ybEy9oPZ0sgvcNjHyRU5oTlm8W1sH+gPb6X7TBaAlGTVwbxnzWeHj8nbxHDA== +5.0.0-cobra-test-11 [Build: 1602168387],Windows,14jQJo21vyK+wwLoAVe0s6HE+K8j/8gBUevO9yF/1byplcQKS/xwD1jakNCM7rJs8iLSo75vTkdTF1pQWJocCw== +5.0.0-beta28-rc1 [Build: 1602250328],macOS,An+eZ5ePOnilhs44F9Z0uGHGTFr5q7GaUkN2I1Xv2lPXbmRJS2ePiuLo7M7wAybymRwm/+eEB3bT/NVwCJQWBw== +5.0.0-beta28-rc1 [Build: 1602250328],Windows,8oW09UjVpXnQCDGBLJtyz3LzKQj69wPqBfHCCkGSkWcFOp3zqYrDQttOFjd7628rq8SczY9oiSJ85K3VwHPUDQ== +3.5.0 [Build: 1602492685],Android,lKoOgVcaAsMGEpVjJi181o3H37beWguSR5efJmIJMsMZ/n8Vf2QKxpV+gALOJKgFlciZDL+e3VOd81uyhuizDg== +5.0.0-beta28-rc2 [Build: 1602580552],macOS,oIEegsz45Eqs3RDI8jC5wdEu25TsrliV6c1gMaJraLRjvaU2p17xOmXzG5dtL6Qx81OGDqRF82ooXXE6jgymCw== +5.0.0-beta28-rc2 [Build: 1602580552],Windows,Fvk4Xr/Z+HXAlO2MhB4dRN7Wi7X6IxwXSlXH8SFSkwxiPAnBKcNwvS1RonjilpxXNRwqhGemahkGewJAMtzfDg== +5.0.0-beta28 [Build: 1602660382],Linux,cBBzfORlQ7Hgo+bIysxOjBrMn8R8C/cz7HefCctDZeqW/9jtQgdmC4j0WG2z44zFkSQpKyn37g/I14C7cg+YDg== +5.0.0-beta28 [Build: 1602660382],macOS,wNdxosl+2z6YkNmd4jaLwWHQiuPDE+9NvGqN9Y/edJ3530ktACUE9/KbtDhLIhdk6Fgx+SwxKhuusqxszCOmBQ== +5.0.0-beta28 [Build: 1602660382],Windows,pQ0ZCYZovulw3eqwdvzJpq/2d8XwqcTnRLggziiDmRn+FxeOtkWmemhlRZbgljo/GFV2n1Xj4T0Z5ktgMKXRBA== +5.0.0-beta29-rc1 [Build: 1602672104],Windows,dU9SLOX6O8CnwmohtUrViexxDa40NeIoW5TWshyd0vuB4y/vyP69MRxcW7ma1Z4B9GgOO6MJo44M5FL6FvOyCw== +5.0.0-beta29-rc2 [Build: 1602840532],macOS,kHx3QjHof8thbn4Y6us8PdWEcs5+V7LnakvBLWvZEGUkOg16xUuYWuoFYs6bYBVKTVgoO74+XY3/KT4SPBK0DA== +5.0.0-beta29-rc3 [Build: 1603115757],Windows,/EBNwj3g8b4OHFSGkFRpCffr8AeWBXV5qGzviB/EVqGvBR4f8nCF4onxGVsf/Iezl6BtoqJ0OcNAU9FHGTU2Aw== +5.0.0-beta29 [Build: 1603199536],macOS,EZtK0haoikiJyxO3NQyLEvJLPiL3V8hRgD4jrKLzsbwGSbrlzQMjA/7k3gPaRi5GN6QJgavKi/XJ0bFu0PVKAQ== +5.0.0-beta29 [Build: 1603199536],Windows,szczHLDI5WYcdftBao1SMIrCeCt8Z54Rfiw3Vc+X1veNGKKo+V4gQ8WR0h4pOmve3Jp4J1lAk/zIhY1GHtPCBQ== +5.0.0-beta29.1 [Build: 1603277784],Linux,+W6wJ0uz+9pg36eWCM/dgcDfjiYBnvfd3befRzTCpMBBhXABn2p5biGB+xGBllaR8q0CkMOV2oPCORWrfPfQCg== +5.0.0-beta29.1 [Build: 1603277784],macOS,aIAisThgSbFhvGL9QxDWs3C8e3AcfhG6pd/9V/5VGw6sO4aEf51962byGzxFoidCYG+yz37I/MuX/P/FrSUvCQ== +5.0.0-beta29.1 [Build: 1603277784],Windows,OIPofb7scMCORX6+SsAk6T1ndB/GtUE1V/XnnwqdqFiVjXHPVHCfYnFG163sHCbkYxy+DQapPQzNCpink/RSDw== +5.0.0-beta30-rc1 [Build: 1603375915],macOS,VMzjKVxPX7C3LgziUDO+3cguPTvuTowhPXNbHBN3ktMUkPeyPN61dAY/keUxNzSB2RoQzp4LMYOxT5cdGUlkBw== +5.0.0-beta30-rc1 [Build: 1603375915],Windows,nwz6Oy9f9Z9xao1rNhcXbFn9mprcW4GFmtEDrUArG70HRjAHUgbH0nxVyJqCQ2n5JgY0MAG4h6sEyFdtFNc5Bg== +5.0.0-beta30-rc2 [Build: 1603714412],Windows,S2M4cvuUFJS5qOCIzn+IC93bmrc8l8E3PxElaIGS8g9VU2ScNs9xB3gt3SCF1u3lFFJvc7zXt/ZeA09f0ao5CA== +5.0.0-beta30-rc3 [Build: 1603793389],Windows,bgsEUyHjvTl55ve+tV3/FhWEyDBtyQimszKh4KZoLD8dTWkx5nAPkoqB6FZP51W98Zg0m6IItHXBMy+hAguTDg== +5.0.0-beta30 [Build: 1603882166],Linux,d4pjtaDVETsz9zK2Yf/19Dj8gKurV9YkPVe1gk+6sQS/E5IwgZN0WcwEGmMj7lHOqWCyLsgtvMe4h82i0u/QAA== +5.0.0-beta30 [Build: 1603882166],macOS,yPfkHfZ9LAXdHnFfc96rdLFkveU9tjZkRr+X6PLIBuQcWPS5kX0CfJRrL0vPNJm4Z3hrbFk8MLRoDWkZf4RNCw== +5.0.0-beta30 [Build: 1603882166],Windows,Sk7MrmeeytvFmIHJXrtYCTnPnXNXM+OYQdz/OsKvW+m6UQuqiEqWutvnGH+d7eO6ewOSD2AO+dyN177THrm9Cg== +5.0.0-internal-1 [Build: 1603899622],Windows,fTvi3sI024I7nRiOJnrJFF0VH2YMHkcs+c0yAXbLsBOinkIj+yVus7NjK7MuZh6kr21T5ekpCRqSvYLntZ4tAA== +3.5.5 [Build: 1604062410],Windows,YE7gG8tUil7L7o0kk4EO6yvPARRG3TNwTcQFQLm6kKBCbfiC5u7OYJR0sy3r2kkFiCF9GbLggJccicACEi6pDQ== +5.0.0-beta31-rc1 [Build: 1604069291],Windows,XUUFhBoCvBRmwkQ77W2K/gZ4oOO3ofea0r5Xi6/3A4Dn9dlTQfrhc0GeEBu4FgLeH6jggfe7UnW306ONqHUvDg== +5.0.0-beta31-rc2 [Build: 1604331167],Windows,nZ0rkauM6FZIV7k9Q/hTHA8H1234uLKgtbPBJteBJ6cCqUhP0vtqXfB8wN3t71LlHlxHI4wWvrNVlkBRRJN5Aw== +5.0.0-beta31 [Build: 1604481627],Linux,UdQzwtuA/9YF986x9YoKhCYQML5E35Xt6/bnXHI20CNa7Y9k5W7bl4WJBXUKbe91BmdaO798dp4nLgawHyZWBg== +5.0.0-beta31 [Build: 1604481627],macOS,76JLTz1/BXuV6aHKQhCVOGooXviJMoDsy3r6LUwjEbQb83P2RvF0taKke22V8N5cx4+gVj2a/sIdVMbRshG3Bw== +5.0.0-beta31 [Build: 1604481627],Windows,UrzzT7VDY5k55hPwaRZ1MmAA1xWWEqBWr3EqpEHxg4qtmJM1Mw9Q4mmR41pAiRHV4BHMvn9l6YePT3BZrBBlBQ== +3.5.5 [Build: 1604483867],Linux,JJFd41bido/K1U6JfzKQ+XOopaFiJDjJwub6tuHv+4ibyCyNzYlB7pKqGHUEmBoAg/hR+mqHhn1d1LQfeIF7DQ== +3.5.5 [Build: 1604483867],OS X,ZexDMFulps0EgC6eLh3yf+Z3hDWR/u1H1HyaLhBA5FM01fdsFxfB1QgnSc5N+KSzsOE5ErchWQLipTjTg9AEAw== +3.5.5 [Build: 1604483867],Windows,5pvFQlWp8tKMVQ/rQNuAQPc1ujNyl41gsC1utJy0gxhQ+0XjNRgJnYu0C2lAhzEc8feXxG42Q+YDargxtdM7AQ== +5.0.0-beta32-rc1 [Build: 1604501880],Windows,aeAVy42rf0tsg29Kl9jYejxwA1g2K2SV34LCqN0ILtp3VJnYKYhkKkE8a3CI3x3EhXn5TqwwxKyIf4aDTIEXAg== +5.0.0-beta32-rc2 [Build: 1604657081],macOS,45+foTPJrbahtZiNO7Gr8P5f8ZwJdeu/5Dj54Poley4H+cSnpyEvdbbs/g6vuhJOaI0FbUcC2KPnjK1tQmkICA== +5.0.0-beta32-rc2 [Build: 1604657081],Windows,qPVigZMZdpv4SRprBWwJ2o8djXiinFr/d5oUgQ1iy/mQZUzr6D8JTUuyJ8yV1r9+vVcSkKKe3O2Yg4RiguGnBA== +5.0.0-beta32-rc3 [Build: 1604936365],macOS,7i5hLTypUCCR4sGhIrkZfQ5yJfLBYdbKm3JkDtqXq7l2677XssCmMx0fqzKcSX5j3KR36CKnLHcZ5yH0c4AwDw== +5.0.0-beta32-rc4 [Build: 1605002654],Windows,/Ik/dAPEPC0D99aOGNDYvG/REbwmcYBlLXcFSZwHq2V3DXDzeNUOr43gHlL1AzMiYd2x0rZrCcXrn3fLYMd9AA== +5.0.0-beta32-rc5 [Build: 1605018568],Windows,kBeUGR/3y5FDIp9HwvM7RpDI72GTgiFLdDELhjJ34IOPL3OKNvLEez9MB4uiRRoh7jYIuZZQwdwY3OYuBB5CAg== +5.0.0-beta32 [Build: 1605097383],Linux,GoVvALlg86eqEfMeOwZ7TAYNH5O+UrsuB45tVZD0NbJ4m45Z9XApYnA0SPDX/gdgxUTw7WqsWUdQr50zDJMZAg== +5.0.0-beta32 [Build: 1605097383],macOS,h2c24ww5+HNInt+CzeNvGWWtxAKPSiUTFKvGKJGlviPtP+lvxzUsqTKvuBtOBDhcG+TM9kuxUY2U/7RUcWYWDw== +5.0.0-beta32 [Build: 1605097383],Windows,+Hzkhe5qVBsBkNGbDtqrGJheXxXTkjLEZP1lxO2yYbXf8XI4jsVrt9+Iy4EPAgQOgl48HnHpQE2/Ek/3BI5WAg== +5.0.0-bab0e5e53 [Build: 1605109329],Windows,+XLUGbX5E5bx0V7yrsD1DuyYm4se96DEXF/5uL6uJNkW1lw6ddglRR19c7MvvbR3uFi09RzQVXEKUb0IvNP5Dg== +3.5.6 [Build: 1605182235],iOS,7hXO+2TSz+nHL30cI30zI5XlpZqjowOcsaaGWY0CkpAK/IdAheS1QW5EKUuvwLPQZ5SRoZirpM+EX25NgsnnAA== +5.0.0-cobra-testing-11 [Build: 1605194844],Windows,VzJPVfF+dN9/FshBgVmptx1nRSxXITOGH5KrTpjBSNn6IX+EMBx7Sczgz/8+fi4hqv39CwGvfeaYnI3cPCsuBw== +5.0.0-beta33-rc1 [Build: 1605268533],macOS,91JFloed7+rI+CgAwk9F85W0dsi3T0HfoF/nuEHrfsD34Rajyv4xNg3zDM1l/KEjEkg/2YCHnZ7Ht53X1pizAA== +5.0.0-beta33-rc1 [Build: 1605268533],Windows,RAQ5R5NtgheSxed32RtPvVGP+g7a3yqkrYWeDwrR3KthQMErlvdXy6tpOixlLtMH/lC6DrHrfLXz1+6esbe0DA== +5.0.0-test-icons [Build: 1605393546],macOS,1rnOEpGr6oT3yTCVAawE3dv5PUKSOk6Bq0lzcTwEin+OqX3BTklCgHG1MtLriqmo2WPCEGQj2CPa23zBdrxWBw== +3.5.0 [Build: 1605605389],Android,trH8DtnmPwjwv0jpx+tgryFK8RiVvyKswC8MH+HxIqgD68WooDxdn8R9xee5HkwV+Q38o2F444uqTMdAOk6SCQ== +5.0.0-beta33-rc2 [Build: 1605608215],macOS,1JEraSCVPRpNwd+gNLIlr/3C8Pkd1OvEt0IzrtzCVUXLzV8h687TDXNpbkgW6qBBGKrgvso9KTQcvA0wxaYlCA== +5.0.0-beta33-rc2 [Build: 1605675336],Windows,zNPcQJ4fFK2GiBIdWfOATig5IRi5lCCiT8yP/zsnZGJkk9uLkOrcc2Rfex0wA1HxyxRdNJ7qQfDJtTNs9LKnCA== +5.0.0-beta33 [Build: 1605693829],Linux,gYYNWFtZRyNugi6KEuE0t2zqPwOBQq9dAHsvsc1t2sJrm+L91I++gOnus6cmkP3fBdVs9AyMVHlKG/F1OlpgCA== +5.0.0-beta33 [Build: 1605693829],Windows,2s/ug5ZCiGXIOr25RPtEvtod1l/eb5IwpRZNLBDelBtuSvoiUlF/f7SyWx8m/VSmbihT4zMaSiCC7OyoO6koBA== +5.0.0-alpha414 [Build: 1605720501],Windows,n9V/ZCUORS6ffCe7+ctw8sV3sjw2/IhugPVPyu3d+Xlv0XGcFAVH1pLNiiARpUc5pcqETTE7/a7csaj2Y6PxCQ== +5.0.0-new_certificate_test-2 [Build: 1605794034],Windows,BPbfHIp2UT8AY6NiSTWixjRY1aSdag7CPBn9cVtzRRWzST1rOFXf3+47IgUYZjBCZarUXY4jotvgXV3N8XQNDw== +5.0.0-prev416 [Build: 1605888535],Windows,UBynqR4ifIHweVzma4KDs3OjY4iq72u+fmHIyHNRvp3jqjFFqK7jK9hS2UpL0aXl4F4iBub+5r0lPw2Ls7IACw== +3.5.6 [Build: 1606093423],Windows,pjDmXGaZrhbMk8bUoN4/RAJTYnmwLJeyMHm7uH9rXpg3nVlm73kM5BlZwh1ndd2WycxnM3Ubjmhh2cT1AxbgAA== +5.0.0-beta34-rc1 [Build: 1606209261],Windows,c+PIL8IDyRHJqEPSCuHXqB2F2b5US8RdbcTufggerigzxGcZ8jC8J+CAzakRco8UtvzfFYzQ0fJ8qPRfSRxlCw== +5.0.0-beta34-rc1 [Build: 1606232731],Windows,Ay6sAHt/gjkRPMixIOuIuSXEqU0b+xqIVbqYPkyL0Ty5y//RStK12WilFGynUgisjb9OI7+DcQX3CD7+DWA2CA== +5.0.0-beta34-rc2 [Build: 1606259476],Windows,7M3OtL+owcF8B4uWLRUdw5d+F5838V9HXx48u6yH/vX5jgZDuUz4nM3AGY/SGXNumxyY2cvV4Aca/+xR6O5JCQ== +5.0.0-beta34-rc2 [Build: 1606303040],Windows,CQI1dcjeQZ7bpqMuqvHanhfXE6O8kjxEQ7kyK3l8Nel0QgY95lMjR9fyH7QI0svRjTdyYTspLODFf1GPJLO2Cg== +5.0.0-beta34 [Build: 1606310756],Linux,D6XRdF0v40le6gVyYmhbPzgm3AB6FQaErQst3urdiHnDuV++K8TZuOQGvF93LElexj/0xr1lOvJH9EjERq8PAA== +5.0.0-beta34 [Build: 1606310756],macOS,orRhmHrTr7yWhhb9cEtHOSzKPrFYPz7de0SZ7oQ87hPoYoQ6EtMXqYVgdiySDmf0Sc91hTFfem4svMHICy59AA== +5.0.0-beta34 [Build: 1606310756],Windows,wVeg7QRNsmcZY/3Mu6iFNB3tlyzLLoECXy6oXU/f+ioCOdRTN0Vz6aJ2uv5LdBnpu8MnJZzvvI9vCEj6I8B/Ag== +3.5.6 [Build: 1606312422],Linux,qMOwz9/kR+NHyL6AcBW+EnA9rvoWCgnIXH8vIGYtDNPHUR8cxPqPoFKH5nq+7I0F2hrK6k+ynkffjYKmmQt3AQ== +3.5.6 [Build: 1606312422],OS X,AamXAvJnm3Wx/O+2LHgxesEZyF1GuVONvqmaCB+1hFdgWR8w1aot41Z4Cd2Q9wGBCNkMYzmD8tXus2sF44LXBg== +3.5.6 [Build: 1606312422],Windows,I5EAPoSvsZ7nic6nCFUw+WdFCNf1NYuOTzrR9A7x0S9J1NYp2zrzktmr2jkhVy6huytftxEOeOOVz+CO10tbAg== +5.0.0-qa-1 [Build: 1606395781],Windows,lOb+Byvfl5q4SWM7MpUELtoF99xsxSkukJv0HeuigRXcU7mAlZqVohvPqLnzfL6PARdAvuC+DNhWGJCZpjCTCg== +3.5.7 [Build: 1606519399],Windows,9pGLtJ0cZsQD9+6dF95Xo8b2aaOet+Iojt0etvdh+52cOA75R4YylSx/d8zxPDxTucQckxdXE/VWaDVl8m37Aw== +3.5.7 [Build: 1606578603],Windows,C79G/8lxs/UjWynS0oUfdy0x9uxSsQ5ZyJ/5PCTHDpW1slXYpYuyK6idx9Q3WVvGCqh4gwEVKWjK95GZh0BmBw== +5.0.0-beta35-rc1 [Build: 1606766504],Linux,Z4364TYcGtzQ1vdteQiRT7+/8rVFrxYGnOMKzx7Q3Hm7l06vg0c/e+cdmcQzOv58dNCfiJ13NfskL0NT89MTCQ== +5.0.0-beta35-rc1 [Build: 1606766504],Windows,StQamBy80FwOQExWnWkJlhh7Uj+VrWA1H4BEZI3HOJu085HhB0fEFGo4x2JDqB6/KvySmFGtJC/WvbGAZWSKAQ== +5.0.0-beta35-rc2 [Build: 1606832721],Windows,YeVsqKnNE01vrPDdqBhPyPrvwlShOxyzx5pZEK8EaXGgGGVNPMgJeNRasLIeuuPpg5fndnzMDatbrzI9UoCHCA== +5.0.0-beta35 [Build: 1606908024],Linux,U3+3R1uwwRHWYwCjuZXR/nYo9tKKTLsTeYW6Am8M94rHE0tOa4c+qHKka8KXx/6expxE7TOsegPO2V49mDzkBA== +5.0.0-beta35 [Build: 1606908024],macOS,ShAz+0gQkLMPJXkUAdt+WTiz6Av8XA++9VxEPsyKzyH1W5NW+riKeN8cutzlbXjR92/6YbxQSaLR6HpkmzT0Bw== +5.0.0-beta35 [Build: 1606908024],Windows,plojmhz1rW1PRgIv9/aYgM+TYTX/vS5Y0iAl3WdbOGQ+5mvZvFxdXAsf2fTGIXYfnRpuSuFkdqCKZPLgr9chBQ== +5.0.0-cobra-testing-12 [Build: 1607080844],Windows,OubSgh/L2aojRfR2VnloVTiqop7ZpL1aEXiXEcWrIXcPBoXCH75Gmgz+TSaNkLYdZXq9WM0AMovRs0zmMgCWCA== +5.0.0-beta36-rc1 [Build: 1607093951],macOS,05nGKBwK3J8Bs9clvybUT/9zwdD2TLWXP9UPuWhbV7+u/WKTdM2hn+7op5ySNXwycvhp2pSDHq19EThFVg9oDA== +5.0.0-beta36-rc1 [Build: 1607093951],Windows,Po++JwnBihgUIaS1dsExjMNm9Bj6N6CIIN9f8/l5fKuJm5KtQKefRaJ2M8xTVJvmVatAFgaukVFRStGs0lGfBw== +5.0.0-beta36-rc3 [Build: 1607430517],Linux,JFWNtdiuetTrzjkylKVCazY1jEkAZL8Hraoo+19Ab6ARHS2YuCJABjFqtajEVp0FQBNTpv0J5jJqLc7eIP/eDw== +5.0.0-beta36-rc3 [Build: 1607430517],Windows,P5AF2va7qMnlJNd5FzMNT5sbSVffXSa16i0nCHJSy2ZZ/lMdajkh8q+Pbo6ojWTjoDgAnjyWiCWpE1iBPWCbCg== +3.5.7 [Build: 1607443312],Linux,m57O4tD7r4fjDBMaspzMepMfRvzioE+m6D39a7ng+1b1PUSQ8avMvGnHTsKtWSbatV04NuJrugMPQn9nqUq9Dw== +3.5.7 [Build: 1607443312],Windows,OPT1d2hY3OQ2ttnvo49Z194xw/4Gga9z17XpjJewz1VOOnjccxyRZ825dCHOFr98uXPaqz2qrF8e34h5yV7gCw== +5.0.0-beta36-rc4 [Build: 1607500856],Windows,38FCIdIPrGjOnWK4KM/caY4o3m/39ERRArrXJKf7eV+wYgxPQAt+S8QX1vkO+BaesVDnS+W/iODefXopulm8DQ== +5.0.0-beta36 [Build: 1607523167],Linux,Pn8itVGKVYc0zhUm1KizpQSXOc+WlP0InmlqQOG8JSL0GxddSAlyIeXr5kS4aRLpUZQZbS6PUJp8jSOB6LdqAA== +5.0.0-beta36 [Build: 1607523167],macOS,1UCA/1K9xISm7O0AyS1TVoxY4nsm/McOOkUlT5wB+JSswUFarJIZ1e9haNhkSLyFSb6wThqLdkYXdk4k5vHKCg== +5.0.0-beta36 [Build: 1607523167],Windows,t7cctqp5xDsGv483zVlCTNWR9LcM1d5zuNzUlSTtDWyCF9ZelngfcemmRQkvnanf7TTk8Pf/S87nFiNQQAGVCA== +5.0.0-qa-4 [Build: 1607596631],Windows,P/zCNJDTm7PrpvywBjW8mkudAOqJy6YGIuN8lkSVleIlacUkcg3Pf2D6WNrI0ypzpDUjM49O9RT9Fpcso6joAA== +5.0.0-cobra-testing-14 [Build: 1607689476],Windows,OMylK9JqoSXD7lRUQCurbbbVSKQWGrgZLKUlaCbKoSgaFklkXg+W8nJa1VkZVK20F3XjUCuT8xr+NAZayPDXCA== +5.0.0-beta36.1-rc1 [Build: 1607948316],Windows,uAQOpxqBN443sY1/OWWS6FO/KAGZPZ80oKMD9KNnxJivR4OfSlNUJ0jEQ1RoUSCU9c1+bi3QJb81Hz9PnuFbAg== +5.0.0-beta36.1 [Build: 1608110690],Linux,7A5o7obP9A51a9lOr5WH0+0NHk7sTf16pGsWytcm6VZgmEvPNcLyGW5RELWw0nBjvz3IV1M6gvbsaLQT9S87Dw== +5.0.0-beta36.1 [Build: 1608110690],macOS,PjpkGLcBzWNTfAYM72zXim6DanVRtUQoJitqYswSjimqNQMzbqIhZ8UeWDQ33wRlhNyNkur0hXic+1+5iuFRCA== +5.0.0-beta36.1 [Build: 1608110690],Windows,STiDCl7Kj1EjmOp5+7NK6l0llqUi/s23HpSomIrHpsOR/2Ldt+oMlb71/P/t1UMzvZwsmVx6KL12K+145jxHBg== +5.0.0-qa-8 [Build: 1608135862],Windows,qYz1+vWdonG84Y3a+LE3Hs+DnNiNZtiiESsMNCKuYU5DkyD4QYIuiWT+uHTg+RYRSVWFNHFN0AuX5sNIAdleBA== +5.0.0-cobra-testing-15 [Build: 1608206477],Windows,svRhaBEAhUo98qG241fzuYIrWntfHcmJkN2GDVAbX3TOOxK3H/rjYnwVDzvFB7xYV0OWzB9i2bFwuZU4ygI/AA== +3.5.7 [Build: 1608224421],Linux,bC9tQa+Zp3Xd6tC6eQV6qBzlgktKps0EOD5UjQl2MK6yriAppcDZJmB9Dl9ov2RKe8XtzsGmplRGFUqQThnBAw== +3.5.7 [Build: 1608224421],OS X,62bxnpUQY/CcupgUFjVDKAjNxKFBS8WkqtLMBBRhekLhjMsuQFMhrhJjULWKUYQ50hJ60ECxYLZJF3UDUkvXAQ== +3.5.7 [Build: 1608224421],Windows,JNCW+UhoRIQdkVVw3scJ+8elQLRZDrUzdV467950yuIJmxD/egLBV9fFMHo3puP3xpxZtVH6Z1I4UzWViGs5Dg== +5.0.0-qa-12 [Build: 1608565516],Windows,5SbZhNARPlPnXG70s6MagMv/UVCcCILkHsma4WEgg97s+E1v+aimSf6p31ntJ/VvGjqUrOY5NqZzlwJaYQQuDA== +5.0.0-qa-13 [Build: 1608646134],Windows,8Nb+pKZMN7Vm2a0qRZ75qnBFA1vphunnXAGiyiPPXEI34K5CifVZS0Pyj3d8ToCJF5PjuiCCCBdV3PhWZeovBQ== +5.0.0-cobra-testing-16 [Build: 1608713116],Windows,51G/VI7TJMQ3RK7+x5X4/aRgR/UFkj9eozJGVrIWfwddm/9MALTMxX/FpyjE0WAenztutNb7swdV79G0J3eABw== +5.0.0-qa-16 [Build: 1610030909],Windows,5WWukoB3E68xz0323iWLmBUP+uZr6eHqnnoEyAhcvPr7BUTvKfg3zJ9Enq7lBTI7S+XzW6OuixdtL8ZjNgBXBg== +3.5.7 [Build: 1610311072],Linux,3IEt+rUBL8IiwS96zAZuG0ut3nBnb1aNZUUgz/NAi8fk/9ZFJeT6HVO4eEhP0WusLlOBSDHGMaTrpy/jY1kWCw== +3.5.7 [Build: 1610311072],Windows,n/vzqeISJJ5y9IqIkq54fKJbuUwBtzIwfKg6iAQfetTtrLgSCg/U6wI1oXkL1RmYb0x4M5C9Si6P+K4Mr9JzBw== +5.0.0-beta37-rc1 [Build: 1610378934],Windows,ZTrRD70O7gGT9rOMiIm3VJDsHAhv89ynoQu2NGRkCTog7wFlUFoH69217QuQh4VahLZnqxG0EGXAcQ4M7H5TCA== +5.0.0-beta37-rc2 [Build: 1610414299],Windows,qN94HkW71COjtJnjcOX5SCxoA0iHjJpIjK38lReA7AU9/9ML+ZRJgAcXnnQ67FvaaxcBX/AfhVK78ws+eGeHAw== +5.0.0-beta37 [Build: 1610450631],Linux,RLHIBAUIoJtUad236IQMd0vXMW4B4s0FFGlMECTDxIHzr46COc05cH7I3FEJnR7rYZP/SI/hKXHZHpkGhu2vDg== +5.0.0-beta37 [Build: 1610450631],macOS,j2yR9VA99by1kMMzXucsPOPeZK4lhOGtDgHtUyZwPFbpaMGhpEoD0fWRP0itYbN5/pVctEj65pHtmbOdn3uVDA== +5.0.0-beta37 [Build: 1610450631],Windows,BeV97Z10p287D+U+2VvwcNqsvct9+un7qWB0xtVDXliwkFD1QhUAiTYJJK4V7Q/f1CbuHrfJvR/UCdBnCR+eDg== +5.0.0-beta38-rc1 [Build: 1610453987],Windows,Fyp9Us6JCwqmi6gVMicMNwBf5OVeDJZCOML12WotGCUeA5o1LHm4Th9OaETekLrGBrXQ9ZW5qZP1Bj+6kXdqCA== +5.0.0-qa-18 [Build: 1610541782],Windows,rMko21JaGQNIPBoh4nHU7e+g+pZ4JS6PfZkPbzb+pBP/n3TgStBAYV7G5zASWyNTvQg+FTIq+DvpBqDdTRetBA== +5.0.0-cobra-testing-17 [Build: 1610555339],Windows,CPnazN0TB00PjwXdKs15Sg1k04Bf+k2PK1jlqRhoJA1m5JRY7S/hwVS9qax4/rbPiLSqoVjnVWQKDLgaYsLwAA== +5.0.0-cobra-testing-18 [Build: 1610623794],Windows,EDZ1yruwOZ6ierSDnmF4bqTDxH2Hlg/fOEBnvigxAt6Iw2+QVLJCT3h5inT1Z8dI/jRJ6uboQWGeA0ct44z5Bg== +5.0.0-cobra-testing-19 [Build: 1610706840],Windows,RohNZcSUAocMBlL7hIPXEf6dNkwJ4gPSKyu2rWoIqqahSwkUZMZJd7oOxo48pLi4FCK6Yios0765hTjB5a3bBg== +5.0.0-qa-19 [Build: 1610957172],Windows,PHke9RTp7JY4Z3M1v0W38XuiSfeIcVBRi/SFBZLomKeEvgImMLtFCIoXLctCg0jEYOaFZOaiLdBoaqB4khJjCA== +5.0.0-qa-20 [Build: 1610968143],Windows,kk6gWzbJON42PZ3H7C/OgLeUuBdimPk4w0shBmI8m/mMzwmdbZt5LID6runNtOxDDqgRgy1joSLH+Q0nluUxBw== +5.0.0-beta38-rc2 [Build: 1611137742],Windows,dCDRgusRRRn1dqKZ+ZsNS0+E/DhRyMrINX0kXz3RZ6dpcLqPxkz261aln5R2RhVr8+ZNGqJxUyx/aMyeeWotDQ== +5.0.0-cobra-testing-20 [Build: 1611147479],Windows,1f+kVrqWb2uEQskZ/68uyy/kfA4IgI+XAq0/qcA66N1Oj9/BmZ0J95PmsK1QI4K7lWF6x2MnMRcFfTIx3yOgBw== +5.0.0-beta38-rc3 [Build: 1611148781],Windows,2Kz0r4ytX3/aAowczPp4nLV8M4Pvq7f1NZdMRJXvqOWnF5rGkkylHYLdZO4v1PfR5dANVTSHEQCR5lhI1h6oCg== +5.0.0-beta38 [Build: 1611230438],Linux,J1FpevvYQURafe71i7Jz8yPz81k4l/4xjNFSSndRyH/ldJ7OekJNWDnoKtyZQpuYQJZw4yUI/6kTSMu8yeBrCA== +5.0.0-beta38 [Build: 1611230438],macOS,eSMRqqp8atJm+SmYTYqxYwYGn0lvX3TTda/yfUcdAQzZSSUY9gPp3cz/WksllScLqDVrmHSvUCsKjySyC2RZBQ== +5.0.0-beta38 [Build: 1611230438],Windows,fqO3H7ytHO7VPdyKmTc59j9/9o4ItdKyTrF+zGtkhlim2aUpILK8Qktho54xICnrpjW27PiPCOLiZppo0yZDDA== +5.0.0-qa-21 [Build: 1611242317],Windows,TjEBonIoo3jsUZ71EgJTaNdUu9Uv1IrRN31uEkD1hVOV5j53/Rkl8p5tBqLIqr9kwrZyDTUTnUc8BBZZi/WfAg== +5.0.0-qa-23 [Build: 1611337907],Windows,P6Pj1Wwenc6M2tEH6kMzu+NVmrONbCK1lR/v49VVxx/N4ZoKg7eGHuNr/drlFfpXT93ADZ84txx1nPiGRbeVAQ== +5.0.0-qa-24 [Build: 1611589480],Windows,CK1DKUzcEkbg8lnZI5vdR5hH4Otpcex6I5RnIgBaidMQHYETVA854WvFMt1TwDIsmMZUihSnoV8adoYSwLp5Aw== +5.0.0-qa-25 [Build: 1611659620],Windows,ZNi9tp2NHMe21jrutl7ZIBSA0ATNLxivdxiFwOCp+djwPi9rQZJkMk/Pv/tM1FJ38w3oyadodfsXnrbmK6mbCA== +5.0.0-beta39-rc1 [Build: 1611678252],Windows,AzvcyZhPgfBbzkbwxscmdX53szAoGUwy3iXSaksupa+zOBhk7B+mFo7e8VoTaf2dujaJc4nbIwUjDY9ftT83Aw== +5.0.0-beta39 [Build: 1611686251],Linux,wjuefnSTU0/bsIz9U+YxaIPeW9VB322MfAd0Uo0EMvwAODvtvCI/fJDThceQdSD7rGK7oPZgWv/aAOZV+chSAw== +5.0.0-beta39 [Build: 1611686251],macOS,CjwaeaX4sBFya5H4Xe6W0sWzVXVgHUqnwi0hXWe2CIIV33OQ/7BwUAL1cMDpkvHO+SatGBUVnHMV7rpjJye7DQ== +5.0.0-beta39 [Build: 1611686251],Windows,Mfng59TemCnyhg5QUeqL2FpynbknmDJw+EFo+lG9SzeFTLmOhFDCnBAFls4HihYuNNQpVMWCQfQjE1klB5wXAg== +5.0.0-qa-26 [Build: 1611743375],Windows,6eNLhzrKjbbDxu5fAq4E82L2d47JM9k2NyQdndKd+a3CjUoMniuabVYpiaAKQ9hvQI594wykfWBL/0IyfOtBAg== +5.0.0-beta40-rc1 [Build: 1611825049],macOS,Y4bdkXf1Q6a0g3TcLps4WBzbq9H9bpW5POWxypnk3mhnF7dG0F7fqCgnYjrM/M6ToUxzCoIGzvo8PkRMmWzMDA== +5.0.0-beta40-rc1 [Build: 1611825049],Windows,XCNVtUtw8x2yw9sdtunfwxnhAaH+rgJl0A6gK9o0Z3PVvUNqrxTkj63VAb6E/e/UpM7P3+UI2Dr92bF/ToUzDA== +5.0.0-cobra-testing-21 [Build: 1611838875],Windows,HmDuoodGmKHyS0UIGnxw0IiEX6MTAALiEsMglkNomIq+kCDedm4j3Cn0aMuWtreEZT4iKsMzHYXW/VgY1TxyAg== +5.0.0-special-build [Build: 1611839196],Windows,EP6Me3j4qAPcZFk5twKQu25wsMALNriG/npsD74eDyAsF0KDrwghNgr8dyKARKXz1OElq/dmVneXfX0aIS39DA== +5.0.0-pin-msg-redesign-8 [Build: 1611846460],Windows,EfGt6AcI1rDMATuhyuAzszC2W1FsmR14sIG9/ny5XeSMTCtj/ji4E/f7YKgjqLcJoQD4OjmfItZHCn4mV5AlCg== +5.0.0-beta40-rc2 [Build: 1611855045],Windows,3T71oJon1fHnUNo8ow/GFjv6EsWwN3oX9pfhlqpSDXV5q8jwP8sLt8I1PML64FY8nLvw3TqcnA3MhIodTI1tDA== +5.0.0-beta40-rc3 [Build: 1612189982],Windows,dZ/TGdsIrRjB30IXDftr84VKyrfjPmOJmWsUL1k+57tDea4MGYDxJX+JHr8rbBlFNXys04Ryha7XezgBm2ThAA== +5.0.0-ava-4 [Build: 1612264282],Windows,h7KjfWKWtI4n6PnNOGXf8CqjFPpiUE/AqNTtgPzx+JZQBcwk8D7fd+ZVULQ/5vF8IhMZ73jBzUgTVH8sA/fhCA== +5.0.0-beta40-rc5 [Build: 1612288104],Windows,lyGduWLlcO6DkaVAabs1oJKJLqNcb7AHbJJo5ZjKELkprjarxBZPERNaucHofSV25ctXZiV2O59dpykaGayVAA== +5.0.0-beta40 [Build: 1612346973],macOS,2opndwKGTKntwjcl7XsPFAyGgXd4V08lniVSiThWI4lyQ//G3hH6pIlDdtP2heJaeDPgYxaOTZN+n2YzgY90Bw== +5.0.0-beta40 [Build: 1612346973],Windows,GR+2Y3eTHeZHfwm/CS+BB09dzmbUH6CdU70wpxPXVJjYoJC8e9pXyq15uxSusnw/fSoFSmxBcppCGS1SoJeaCQ== +5.0.0-qa-29 [Build: 1612453131],Windows,wwOcA4QHPFSmDdo9q7Et2ulwCBDGpAJdUz7XDftEnacwXlOv8XJjXGhWJLd4iMkjFO9MLz7V8uvHYBRDZxw6CQ== +5.0.0-beta41-rc1 [Build: 1612527693],Windows,y+pLyCo6Jiolyth/huD5jLokYhugNgCX8gpxgz/tqdf8YbZln01Xp/ffqAv+O+wwcCb+g+3PtUT9RUIyqWjSBA== +5.0.0-beta41-rc2 [Build: 1612782198],Windows,QOCKhkXWxuOr0n7cLYAOWO3256NlMUe1qjHZI2wbpyulspGmc0AXxM5mJvlNCgvLCt2DhRlSXz/fVXcKzZgJBw== +3.5.7 [Build: 1612783432],Windows,IXYGZC3DW9nJgxfUL9bkxA1zPjoI4IEFNRXL+e2aWvjeHC0uHIgJBf7K03Wldj/NXxAcLPW7+LImlaV5MktiCQ== +5.0.0-beta41-rc3 [Build: 1612799472],Windows,Hitalp5DXJZmXEGFxurBAZWazJYuwj14/ydZJfYX17yLVMoOAqaJxnOgyPmGuSsLsENKWig2Vyfru/+CB0iyDw== +5.0.0-beta41-rc4 [Build: 1612811479],Windows,/bkW44XfGwbDEcVcnQl7ZZvco4Ed4RKHk1ZNnDlInWxrq117B+yYiqLi3AjJEZrhZetn2FFlWyr7bqQsVr1cCQ== +5.0.0-qa-33 [Build: 1612983552],Windows,8Kcg9pKMuM9DBQE6mn2H2Nc2ihBAN0XuF5GZZlFPFcEiknpe2C9uHQiLj50YIgupAIsSlpzdd5w8DTJj6QJPAQ== +5.0.0-beta41 [Build: 1613053158],Windows,arM5NK+6GukhOocniKYs4fzH5tSCZJf3Tag0fNeKRgezH4EkJzc1okAfY6DHcn2322Tlp7gp6MM1olz2QzZODw== +5.0.0-pin-msg-redesign-9 [Build: 1613057624],Windows,ucYWz+rDavEaGYCTjEn6roFlehswmEumokjKCx95Or8sSMuhkUbST5mA2lDnkhUs4awanSZrdyq8xhq0NaRzCA== +5.0.0-beta41.1-rc2 [Build: 1613065465],Windows,2Y2okcAvPB/bGunIziLC16gEBlm+JANHuI6MjoAy5XW8CF0SMIBI1ZyKQ6t8QhvoJ3ftfHjIATsMcDwppgRgDw== +3.5.7 [Build: 1613066709],OS X,HFQc4teHEP2poBhHpuT4Iin+oV7vuCHrtiQow3w3FAeFXT4EeRT23tKzgOZ0aoLEg2A5kuBC1991UDW/Y62sDw== +3.5.7 [Build: 1613066709],Windows,Md4ix51veF2pnYqgZLsLCDc+vyqkh7L/Zh+8FdnZLB1WwWZJSw0Esyq8IzMxLrIl/MjStvycGeYDvwDFRja2AQ== +5.0.0-beta41.1 [Build: 1613126021],Linux,PG91XlooLYpIMNMAU2k0HOUn074wy7XAEqqV+KpqPuqXjQxaDfAZKJSpW6yPDYnPAwTjqZeC9p/WsjdI1wSWDQ== +5.0.0-beta41.1 [Build: 1613126021],macOS,e+cvnmV/pxmReDcrxH5b0j4GsXERIeanr8AK6429elCl1oilJZ1J7y2/Hi1ar+AGVkeXq/TueNpKPaM1onTkCQ== +5.0.0-beta41.1 [Build: 1613126021],Windows,+8yU+kc5XZw2bmEgNDx8HrVLrUhJrNU3zyqeaUgNHGA+uALvkXAE0iJDpyc0GdKC/SXy/8RtQvUtuiuMvtQNBA== +5.0.0-qa-37 [Build: 1613394573],Windows,wuh38TmceFuGCLh4LOzCa123mtA4u5kURmpisOwx2ct2acevllTnEjO97DBLJ6mP/4pvhbj6UVUYRy6QfAOwCA== +5.0.0-qa-38 [Build: 1613482789],Windows,9q/muRilnIEL5gECvId5LtQpmrVUpeu4bP+NLLwgxYI2WV+oasj1V4eigh5WQaQjBhz9hVtVbX8G8WpbEHzZDA== +5.0.0-beta42-rc1 [Build: 1613498559],Windows,68ojO5AuFDoHKLouHafJveWK381IpwGKXMMGSkhrItnIROuw0RWxvOW9hLRWsUTLq6U88TlGuTPwGbVArJc4DA== +5.0.0-qa-50 [Build: 1613574228],Windows,8KhK5Ez3Ed5Y5wlKE+ZWF1jIU9Yasqb4QbTxtKfVMNWskBPtkUUPsxfuzrV6kfVYfkLmkGNN2HRiI6jpz7JrBg== +5.0.0-beta42-rc2 [Build: 1613574920],Windows,lvA/yy8fuZx3TW4qlIDzTVjxNR5p1ezB12XSLNFZ9fK+PLbUGkkWP7cvWaQCpI/6KXUL+XlEGbDTWAFYSIcPCQ== +5.0.0-beta42 [Build: 1613641112],Linux,nrUQ2ldbv3wXRmve1gcEM8WjZPGlwUYKBd1Lb3uE5H7pg0nNBqdI+ofu9CiOO84EHd7cRV4L0yjUw1snxaH1DA== +5.0.0-beta42 [Build: 1613641112],macOS,fmtt+6+LYCHj/6KPUMGj6CyN2mFiiCg0mIFb4pWe0FtptIOpCRxc3u0SGdrw7UbG7ZOURc85WboHW0VTtupRAw== +5.0.0-beta42 [Build: 1613641112],Windows,qdkx8XgseysaZ1QER1Y0hv0LBYbhUSWWKJ5iVS+Lo9nj8d0jA3+WDXG+NeBR+mtUuEMDVstMEfV+sJlvRI8gAg== +5.0.0-whip-6 [Build: 1613731286],Windows,vOMV9Rxl7jpWU/7yYukL1dhyVljqa+j1vLwyj0ibLo6UFimew4pEGG8GYGR3zcbM53bjWlUkRaEkRl0VQD24DA== +5.0.0-beta43-rc1 [Build: 1613737602],Windows,FllNVg/BjC3xRSwsDDhNV+DLxApIY/qxq0ZXJlHQ0caWTmz+VdpBoq6PrQQqC86mx50mp9jT1XAkupuf34rOAA== +5.0.0-beta43-rc2 [Build: 1614094754],Windows,aElzPFeKnlfr7bIz81EFEP4uyox78XAiwQdlbL3Dhlq3HpF69PoS2qBwhxAH57Qc7Ja4fltLO6Uqg3jvQzd4AQ== +5.0.0-beta43 [Build: 1614165699],Windows,H7/zMsrN3Bo/jBXEO/b24XWZDquhQIFP7HctK/PV16UXY1eGqma13mvjOdZaZVB8uh3bIdQ6TzV6doJyoE0FDA== +5.0.0-beta43 [Build: 1614246086],Linux,NtXpupFRBip1oD3QVwIhhJv+lrGro8Z/bL2FgUbgF121zZNRtf6Om9HW7R1ggqBkHz4UQuyppEUymnrj3BDaCw== +5.0.0-beta43 [Build: 1614246086],macOS,xXnqateFI77kyYSzIhJdHoqBIR+d+4OCen4tVVs4dRtIyjN1h1/ZjGvx4yljC99/KChI7bPe9VQUJ6wG0DjeCA== +5.0.0-beta43 [Build: 1614246086],Windows,9XWWaH3/QaDOtWIzjQDX5/9X4YQ91ITBIbYidq1+Ym37f2wfV75OQQu0q1ivCJ6OEJ4z1Z/vCPbqXVSxMYNMCw== +5.0.0-beta44-rc1 [Build: 1614332025],Windows,ixE9oYlD4lGWR5F2Hg6PISJqZM+FxP/3lPyiTUCrM1oFEpHkUxVvAwZLXY+z2Csp1jlA7qGxTs6pmzuKa8mUDA== +5.0.0-beta44-rc2 [Build: 1614595863],Linux,gI0yE2iiF3KOVzBXYhdSFHwQFuPzxK0AYojbuF3W/TuysDOFWRrxESpuVBD2LJu0din44O6X5XXsqHAFG2KfDg== +5.0.0-beta44-rc2 [Build: 1614595863],Windows,sAGJ2R9KI9W24RpR8FEswZrvuC5YqSXOyMbn6sJrSeUdjcEYzxnKWd0VbH+W5dnUqZxo0wJN8d3kQCpaQZv6BQ== +5.0.0-beta44-rc3 [Build: 1614674773],Windows,3c0qKcQsJAN5qWbSC/ASSh1A/p3hcYPz2z+OLTsTe3PRM5zdJHmC+2PVeiIX230pYHSgvXFYJpD1wnL5La6KAg== +5.0.0-whip-7 [Build: 1614690487],Windows,f5lUGaB2clMJ+gOVozjC1UsXOiYLLZEWCBeSxfoN+L9ynh/eFaffzqgG7qG1Org0BOaOBrnrbzRh0J3LREiVCA== +5.0.0-beta44-rc7 [Build: 1614789085],Windows,RGjZDlrzl6nElqfjkq30CTQS+m2ouJgvtg01jU8Vp/sgCvL49IeT6+urGfWy9iGZ4pXiRPV/mbj7yJREGIxpAA== +5.0.0-beta44 [Build: 1614848974],Linux,woqXRoIuWTRM45KqrrOJ7EXtWWvyK16Vv7TSrByq5ikJGRARRVhsUZY1MKr9VISdyptODiCLfe4j7oUaorZKDA== +5.0.0-beta44 [Build: 1614848974],macOS,RO/GrBFbLE9ikZ/rXUI2zFjqigoZZ48DqPqjiMjinZqRAzMBuEvGLcP/R0HM8Eu6s1AE07Sym/a0ordbBjtKDg== +5.0.0-beta44 [Build: 1614848974],Windows,Iyu/4a0EaN/5hn8ElIOflqN7MsjMEJy5aI5Yphy2zRioZSpUdK5dvnrWT6tYBxRhQoXoLvwfQv+8es5DJndnBA== +5.0.0-whip-9 [Build: 1614852852],Windows,oUtso4eas4mA0QOFZAX9ec7SDjvwyY2xjaxIeK/j+wn8JTOpPyA+tBQOsig2Cc4Rj0zAGLvc+vNy+OSY0ly7Cg== +5.0.0-whip-10 [Build: 1614865959],Windows,u9D6EaeOzNu4t8jISUIAHoG8Nl22T3KjFr3EdyUYTvZTtqnxegCQU3KzvPKag/kb3zBQa7qOjqDw8rMUHENfAQ== +5.0.0-beta45-rc1 [Build: 1614934599],Windows,K6Zv9Ei7tMnFaIDPYEbtEfjpREEbV9caIlNFS5B8e7yTYxMBbiVFJIayw/Qz3ol1AknD+PjTz+AJcz3sC0CQAw== +3.5.7 [Build: 1614951001],OS X,dLLLDFIfyHq3IPQf1a3TNPQulXo7fdEzIvSXLO2hyaam8nUUBCLx7T/jCTJTx4D9quZ50sVcSacwNRX7n2CsCQ== +5.0.0-beta45-rc2 [Build: 1614959212],Windows,J8GhEHSiJdoijyP/yYuoqbeXjaQTSLWTIPaxuZnoA0OJauLShdmzjI2OvKJlUKCZyv/OW5n805PajYyuR1aCDg== +5.0.0-beta45-rc3 [Build: 1615238124],Windows,3KFwVs4/I//ENFqs6rlGjF9vaWbAKXgKDUeS/1gXwx9J2a7WmBJvc0anisRTBhE+dobtZgZFd0o1Z7IJAq73BQ== +5.0.0-beta45 [Build: 1615368890],Linux,sAzpkX9kjAM5ur710j0mQzI9srFtslieQuyP/QPVdOFhwwxt30RaagY8DT3+vBbiWFCULMvO76Jj4zdwgCutDQ== +5.0.0-beta45 [Build: 1615368890],Windows,jym8S5RDNXOdHTLaxwPuGuMt/Ceg+tkCoW7eYEmmuLfe/bP9MiUv0Z1NnxOwcUEr4tLaG4dFk/MwSGq4edToCA== +5.0.0-beta45.1 [Build: 1615384896],macOS,BMAV0hDzcjK9qGKlVNVf24TPt870h1ekUmVs+avbWSuWuJf4vNrJh4dnwFoDbqHi9FOcXVtV74t7ndQF7qpPAw== +5.0.0-beta45.1 [Build: 1615384896],Windows,eyjTSk2QIfp5l3bvJPG7Iqxj6SbV/53PrvwYRjyPMha4qu/avV6+4ZpjoFLyoIJ7yCsZBalitXuIYSdlYiFXDQ== +5.0.0-beta45.2 [Build: 1615454854],Linux,XYeUfntCzUZPNzBsTe8VT3tOzDG/ixJ7erjR6nEXkvXK1wip6vKD1omVfIphIHb3RnqJ15VvndpdwYBOKDToDQ== +5.0.0-beta45.2 [Build: 1615454854],macOS,w4rCfN66Hw0BGSV+aAzPhouaA8+i0UDA8cPhGqzpRYP+mM2MJbUdGOIXRPRV89/0q3C+ksj8nN6h/Spwj5I2Bw== +5.0.0-beta45.2 [Build: 1615454854],Windows,6ttI8HoOkFLukISvSd6FlXfFGdVAHfmNFZkYpzdvwJahKJnJHd3CZ28Wr/mAYOqJUcmSI/LOF4Iek3yuhK8wAg== +5.0.0-beta46-rc1 [Build: 1615454969],Windows,E3B4dHkeuNQJ0xMQ4ELVKVNY6fKm9fWe0aqH/kH7Fb8ptozWG8DffUGVZhKdHDN/GaK+xI9hzHtAKp/wFaJ6Dw== +5.0.0-beta46-rc2 [Build: 1615547095],Windows,vHL67ZSWhPQDMQQPhUAjB7J5+cpz6RpYYjY7B5t6PG4J7M4pWgqn4MRA7vZycA53LLds8lyGjqdv1QJ676iADw== +5.0.0-beta46-rc3 [Build: 1615974917],Windows,HnlUN4wDtU4+yRVWi/EN6P+SBBKg4ni3iDcLZU5tqJnTOsc3N5RUbo/kReNOPl3B4goPaDXztIGBWlgUCodPCg== +5.0.0-cobra-testing-30 [Build: 1615991576],Windows,bQf9i6oQe72eYT806ilmadztpSX9PkW6/Vzqmf8xtw0pfsjYK+oVPZGrWNKlWtLLQFrKlsD77YHNn0kk1C92BA== +5.0.0-beta46 [Build: 1616059671],Linux,fdo0xRlkgr9pXnx7pwm93fbrB6v77tKjs4amTHIc42mD/bX5b9RoKUH9jpjSoWrz7vJbP2eKq/Noiu9wCaQHDQ== +5.0.0-beta46 [Build: 1616059671],macOS,tvxeVCyEmqifQUW7Q/J1CD0wk9DF5pMNXcc3Go2MwpmboOaBKBE47vLNjFpzNhbK/9L7vbC/MFTiXsXPT48xAA== +5.0.0-beta46 [Build: 1616059671],Windows,v1Or1Lajx76cAcCLKXELMiDxYW+akC09u0ZnCmoBK1uB2/Rp1GRLF3LGCMYtsxphGuHQRZKtLKYKx3kjoqYnBg== +5.0.0-beta47-rc1 [Build: 1616085242],Windows,q4NCcjigcATvxgLdvXHg2Uyrs2hmbA6gG4YQqnz/FRLseGWfqi2YXAwC8oHQyu4i2uhDtRZk/fwn4HXQFJLRAQ== +5.0.0-beta47-rc2 [Build: 1616094254],Windows,h1t7AYO2K/vEuFTFykiZzTVrgV1f1wt+fKYOAzkKFgW3G5r1EhEjgSsi+eDK3dAY7RfdIir2w614axyo3dAECw== +5.0.0-co-1 [Build: 1616188878],Windows,hEUOcdrheJeNr6Iwbyv5k8ct9vUckqGXgAXCyuq59pLQwzlNvOR0kPzkYuCGomhHF83FtpzqWennSrxRRNJTDg== +5.0.0-beta47-rc3 [Build: 1616533310],Windows,7DDJzx/BUON+0MrgBXu3tTbFIRM9ldVZ0DF+KF/q+ra5VRGG2o4FP29yHL2lO50SSXamDl9VhHJzGtDRa2eBBA== +5.0.0-beta47-rc4 [Build: 1616586931],Windows,8/FtnNJyBa7aAHjO207Ri1HDryFjg0lxunZb57N5PfOXbxRg+02lVrPusnQ/2fyW4jJiB5umSBNoZzQQpZTHBg== +5.0.0-beta47 [Build: 1616598274],Linux,y6b4+TK9FF5TrEuHm/YRxk0y0O4PKJeuRd5RX6kun3mOdej/qT0mfEUiAd+kLrR9kaXZbDi3eecHz7tmr1QRAw== +5.0.0-beta47 [Build: 1616598274],macOS,OSyCUJbA2yHbXcRRmXKHNzTBbEaNKCc4b02vvwJlDcncj2ytkxGfClnj8AROlEK/fcVQPnB70WrTCnIzk4e9BA== +5.0.0-beta47 [Build: 1616598274],Windows,pLqGHf0jAp8bD5faDZR+3tM0+1f11spbb9LPtp6Ai3BljnhUj1xTuP5gldLYE7DXOHbi0mO4vmfPOfLQg4jOAA== +5.0.0-qa-48-1 [Build: 1616670396],Windows,TvzMODwIax0PwvbZp0iRRMMpiYIT+Xn85i/o3Z6qURz6mxcWS9x43IpQLVYWaYlLvmMz/0CSjX6R4FMKHDZiDw== +5.0.0-beta48-rc1 [Build: 1617015983],Windows,QC4hPp3j8hAEseYwLLGw14ED4IhJtWJiJ7lQ9M8GC8eiXo0VFhNzj85yEd+q4f5WKB2vsk5oA1Ze5wFHcvfDCQ== +5.0.0-beta48 [Build: 1617183427],Linux,y+dx7mr6oUkKQ36Q1I/7EqiiZGjd+bAQBkN34JYkQMUZ2GjK2WnDhlLUA8MIQlHgiGh9USpL3wC/m16/t/QpBg== +5.0.0-beta48 [Build: 1617183427],macOS,c9+re8CmXHQ935zGNTsowtaYVaZMXUqPfUomZyuK0vm4Um4TG5IkviDdCdWHXKf9I7EZpUkeruQKGoXyrMFBAw== +5.0.0-beta48 [Build: 1617183427],Windows,2MYWzoZBjDBhGCmD8y4RsBybuSRtu9fkHyOV8lbgOAKLaYMDPe9ST171hXruA1JltG/ZFlLdJ8eXAiK+aIVCBw== +5.0.0-beta49-rc1 [Build: 1617889801],Windows,lPA6Ofr9yDHjXSBqn6SdlR0UZk/iAE3AXDwtxzixJ6t4ZIuIwD8GS190yMFcxeef0G1DpNL8gRt9+hTtTidLAw== +5.0.0-ticket2000-2 [Build: 1617892719],Windows,3qxvr9U4RlqErjpv7y/3RMRhXzT2ITHDAVA4kJEyuNN4nBviBIFSfcMpj72+l3xRroql5l8hWY1JQw+QLBarDg== +5.0.0-beta49-rc2 [Build: 1618219716],Windows,IJQ3Cwo8HcL+rOGHx8sPU1g2pS+2X7OcVgnhkcV8uahLWtDrPf3t6nxbifP6SqRpz6AFV3Uoff9TBLJ9iswIAQ== +5.0.0-ticket2000-3 [Build: 1618230451],Windows,TQYGy9qe7jgJDUPizDnXHhmrpqtr1mHqrok9amqzpVh0BtmztH/6oJfrEIwUy6e10jak6AzlVE6uPeWxvo7fDA== +5.0.0-t2000-4 [Build: 1618303999],Windows,IrwaQDZ5MGRvSund7xNRBS15/I3kZ9tgpnb5wObTMG6P2HT8Q09Vy6OLKMd7QPnod65yi0xgthMz9XlO+K46DA== +5.0.0-beta49-rc3 [Build: 1618310180],Windows,UO+41jnHZ1PdAw6yrs0Oko7Ve/b8AWObnjCAgN+sm2t6/gvhoev5MnNQWIEP5HCRixApCsupHUSZxNRqC7MzAw== +5.0.0-qa-49-7 [Build: 1618321773],Windows,GMmmiusTijlAUSVDpeEv9YExpEFWdN7aOXztp6uspvgbDF0XfGSbTxDph0OX81AUH0G5C6LOIpde/1Yr6WnJBQ== +5.0.0-beta49 [Build: 1618401668],Linux,1fnGYinBukr6lBQcjRAkdqqr4M6hBm4e6e3ncZyYdNObK20gNfBGZ58qBUBbnfDKi1BuOkUj+/qsDWb+CdkXAQ== +5.0.0-beta49 [Build: 1618401668],macOS,V0edFhIRDAK66rJ+8e6hDdXdkA5rf3cOjUS1RD3vwO7yXNuJnx/BT2LXORl6zPLrmtpCxMeR4x6Q8JPXhK23AQ== +5.0.0-beta49 [Build: 1618401668],Windows,FnrKgsYT2TlyqBDnBO6RpjrobB5adNC+gsCAOHOWROMDMNeCfGlSDqErldRkkJHbSOA4CZqtDevGI6S53uSkBw== +5.0.0-shorturls-2 [Build: 1618486773],Windows,866uLGWsRihCOSp7NcxQB+EYqdA0WF7UONcbU+Y32Yp0VmdKo48X3gKoE+GUS55Rn/PUuVEsn/MmMZuzhRs8Cw== +5.0.0-beta50-rc2 [Build: 1618505526],Windows,qlPx8pbXRFZ0fLHRMTk5FzTHsYrssAUg+2Hvnc5gehJu88qtlY/kI27Z+4H/pXps5oxPMAzNUQA0TnLqP+H0DQ== +5.0.0-beta50-rc3 [Build: 1618776916],macOS,NxxwMZETqUi3jYVyV6kJmv9IBuxohfkrqFSiAXjUESF0b0s7kAztHkv52RC4XzhAqW1Gdk2RruSzStun7MXRDw== +5.0.0-beta50 [Build: 1619006474],Linux,TqKfFh0zIEADZgnU5FJhOR8vps03joP9lXV00UgTVHcYSiPHrOqZeYmwHfSVA2ekR/f1x/mPQ1i46NIQmigMAA== +5.0.0-beta50 [Build: 1619006474],macOS,7svnOYiCRugAZ5EeVZp84uva7fDjMzRMWZf3M9nEkrnJ/jcs36en0WeFAyieKg+OMzt387C91cze56Qq1y0SDQ== +5.0.0-beta50 [Build: 1619006474],Windows,6C2xLq1VsibrY2G3DFfx70WWQ3SLbS+frhAMkt6+d5f/actmMj+gHRt6KOazAhnotW5Ei9UPvP48WWZu0QOSAA== +5.0.0-qa-51-1 [Build: 1619041054],Windows,IhCj67HuwJytBnMDjAw14WZw8WWUv8eoUwLikLyghipDOpx0edYKY/4c/OmbN77PsNP/2ASm+YFdvHDkfLsGAg== +5.0.0-beta51-rc1 [Build: 1619190183],Windows,3f81wSWrc6ozo6Me4FaMfefSwov3O+ypfPEgEWvqL/MA5EUB50nn+5poamylF6C3RM6HnQ5T5myuiHEZmzjEDg== +5.0.0-beta51-rc2 [Build: 1619364080],Windows,m5VL90gBU8XAETjrBEl3mL2+FpTunI6V7SA98v6wk/Xxedci+VfrVF0yT7nblfiXbcP/aoY2TonC53c4COuqDA== +5.0.0-beta51-rc4 [Build: 1619371671],Windows,dCJndDHM9dFMXKbErOL/illlMSLCWWMA+zw+CSmDzIW18l3lJPVsSOCXjfcUJfL1/UGV8SgcKIk2e7yHwW96CQ== +5.0.0-beta51-rc4 [Build: 1619462790],Windows,ZyYVsQbax1a0qqCBplYXVEOS7+t5dTr2M1NaHChO5ZrA1AwqJ4IaEwcvJ7AAFRN/eAsp1wu5mYx0VWVFoixTBA== +5.0.0-beta51-rc5 [Build: 1619624829],Windows,/QgpIU1qA8KRBBJ8XuiuNhxvd8wslV8rzjS5HJ38lrpowE9kng7L6ZfD+LSpm6lDy2bbsIdmXIcWEIuPwLBLBQ== +5.0.0-beta51 [Build: 1619681979],Linux,3jQfwAlAsCcdiPYohGKJMKXzzgKZEH9RJJUdN0P5GMyKFrXQTqo9c8Q/oDr+ZDaNaXTbcgZ89g6HP5y7eN8lBw== +5.0.0-beta51 [Build: 1619681979],macOS,chXOmkLwweeaCamsCbNGoWSWqMCHITNYTLoGWIRO/CbIydEXBXadY3JwWjMuLcf1VtcMpWVbYKZG7pNOYunPBw== +5.0.0-beta51 [Build: 1619681979],Windows,cBBnWIxmjY2sv1/CR1XZx8qCWTuRE6r85tKom9M3nHtGQwvO/IM0Z3V6CPZvTwt5FrFoxPQKo413pGFgWh8KBw== +5.0.0-qa-52-2 [Build: 1619773339],Windows,gbfc3mE+7/pgfh16Yfivq29Wm+JnCAtWzfkJcwQ5AwKJUq6vi7fy6mXOoE5T6GDjW3PsGTbf9jphdvQcYv/FCA== +5.0.0-qa-52-4 [Build: 1619890509],Windows,P3TAWnIRWhRs1ngJi6O9bfX/ea616AfhLRRgZ4rt82WxtHsym/+01U7JRNCGIOwvN22XqjnbwlGQ/0cz32MKAg== +5.0.0-beta52-rc1 [Build: 1620060486],Windows,1NOx+woysTMhas7SF3CHpG62/9aC3yP8TUEUabTPY56Z8397kAppX7XrSvFdcXffse01DCgJtwal/5Rkq1JgBQ== +5.0.0-qa-52-6 [Build: 1620142606],Windows,aT/Y8d1/H0y1+aFqZwlJDGUhdY+Y+jVJNPNOxxmv1Y8da+ODp0wCda/WDn6/b2EKNiMDx0levRpfWvRPkE+oAA== +5.0.0-beta52-rc2 [Build: 1620215337],Windows,hW6LrgfZbN8e+8a8A61FfoWRvZzNzhXar5edvn8vu9SJ1jMF79/k6jF78LMReS4EybixEj/IADwD0hm0N7FkBA== +5.0.0-beta52 [Build: 1620308356],Linux,M0Pu4YVZ23UMLdXaAMyXdMGnmSsBUGvXRmz0VN1o6xpL0dj+cN6CRWPMnvO+oGfOgA0EE9wIDPICba+PAYKzDg== +5.0.0-beta52 [Build: 1620308356],macOS,fbY56gISJ/pccZJtcXbEidpbzqlCyKvi4lqoQMAex/L7rEm3jfn2Eil9AYD1VhDP44NkiHqug40DNttOKB5OCw== +5.0.0-beta52 [Build: 1620308356],Windows,IdwOkU/80PcmgWroJQoDxlHjFVnsqO+znSf0ZJ5jYIky98t7seFEsl0ln55E5t+z1twPgdjWqU8InnluFDIpDw== +5.0.0-beta52.1 [Build: 1620389196],Linux,J5D3tI8h5q4322hALB0Ok9heqVSNWKDdDvUr+Fq8dkrdI4LtT7lmYq19GOCxSRHAXPSfy8UxjqFJ9IjGW7LWDQ== +5.0.0-beta52.1 [Build: 1620389196],macOS,aYyUiF51mtkNR0ufTSaufl8fYbWSxn+mxqNi6YMsDK3pDIvJDa6fMKehrHpXaJdY8v1Z7MxP0MHbUQ1m00ESDg== +5.0.0-beta52.1 [Build: 1620389196],Windows,QGIR1wmxFFFk/Rg/+AZlQ11FgtEtIqrD4Z3Rn+VPbwZF0XINSHEt2ouq/KVs38ndVDQONt5HBMZbtw9nRVLCCA== +5.0.0-beta53-rc1 [Build: 1620391678],Windows,sMAID1GuMgzVAIWci9+i2MXMqrKD/yt2LtHcaQk3JD/MgGxafAKShIOjHM7c7dTnWDrk2xJbo+pUPsWvOmzyBA== +5.0.0-qa-53-2 [Build: 1620406854],Windows,2Fsfz4ks8JQL05v1bNN17YfsyW0Oh9J3D24g/u/C0RMm5O0afpmNTkWVbIVYnBxrAbBpWE7gKVM67/X1AoLWBQ== +5.0.0-qa-53-3 [Build: 1620466424],Windows,1XLrY2RFM466+Y5Tb966Fbx+mNgr8MkyMIXJkxa+43MqFcFHIhJVTh7jlzVLmMXhZWgBqfYhpECkBe1PX+0FDg== +5.0.0-beta53-rc3 [Build: 1620751751],Windows,9PzIuMOVKatQJ06ih4P7KLSp9526xYXgJqVZiI3OL0SJJ098q5QQUCM3281maVL8nJUzCzyjAUjQm1VITAsEAQ== +5.0.0-beta53 [Build: 1620812712],Linux,FIJQMQnZ5PtFc4qVuw2DTpOOtJW1bisXq+m6mNRwQ18kpsFfi2+Bewyf0RZUbvWk5gJCwAFavsCKUn+Dcf2VAg== +5.0.0-beta53 [Build: 1620812712],macOS,WGo/nY+Lgdto74deJ1aOxXK0PBT5+ECe7Wu6c4AxdrUMM53w8Tbd4AXkvPjTll+xuYkT1m1b9b/AILP//8IXDw== +5.0.0-beta53 [Build: 1620812712],Windows,I/3f7dKsxA+4Tc+84dCEQmj44t6x0IcCDlum4OHpSB9dg7Pz4OjJEOsLf3WW6iPtG9EF/XrRj0KGee1lrguzBA== +5.0.0-qa-th-7 [Build: 1620837606],Windows,oXkTeSdu+Rp0bQsJX4r+0WkVHJcZZP9nno+9Ch7U7js7wDjRmoN55CxxGYWuV6G3qJef+5NwdUAC/X68BrhsBw== +5.0.0-beta54-rc1 [Build: 1620990757],Windows,EILW7wizaSkBoFcvS3n+In64H7jZ6GiNaIoA02iO1+R1z0ty+qarBRlLbGCv2rI6hNnTmfm1fz0UXieaDw2TDw== +5.0.0-qa-sea-3 [Build: 1621467933],Windows,TkF2YHH7RfJm26M1AW5gmLjxE5Gh2MY2APnr2BPsYsnQcdwmO0/68Tt9/OI/bYoa+fRbIeOCnu3yxuQfcf0fDQ== +5.0.0-beta54-rc2 [Build: 1621608154],Windows,urRSFRAlyTZTf/0Xa8sETDs1m4xjU2k5GAZzTr+sktNMAaaSkBqgM6tuCeYmrQvSTuidxxHMvYi4fUn8mfXBDg== +5.0.0-qa-ex-1 [Build: 1621780734],Windows,J0OeeXYoRwc81sSDvfeK0CFcBqwHH0pnmE2HDLyH4FGxv6QQUGSynDc5sOGmu6JhmBwRQw4dJ7L9+CFi4+K7Dw== +5.0.0-beta54-rc3 [Build: 1621966258],macOS,77zX5UWHKZb7aztyIM8SXTzzHeohDuv9cEZClv7bRIHXJ3ULog3gpm0NlhIuFW0NtuhnvCBb+y0bsk5Z00sfBA== +5.0.0-beta54-rc3 [Build: 1621966258],Windows,d0KY0/Lr6abJaMm88UyRaWHc2hmQBjDWz3XGPbbGO0Y861aOZFH8Q5h2ker+aGph+XgqL1nNOvsuxkX7tEzqCQ== +5.0.0-beta54 [Build: 1622118640],Linux,HCR8uUkq0kVQAW8wckYN+MQWUjKFnSWijRpYHLL6PkY4wQNByKCXYC+ojcFO3DpBt0sh/TvX4y5/s91wu/rMAQ== +5.0.0-beta54 [Build: 1622118640],macOS,/tnQ4PpOkREsO7cLHAWWA9AUHRNpZmtgRUtp9ggd2S8kXAUHNdbccerHTeMcsAgQ23Xnd7KDhWy2y4NJ8oI9DA== +5.0.0-beta54 [Build: 1622118640],Windows,PWa8uSFhmI0+PkOqtGz4RyRy2MAHXJyEIKp/2iJEcT8yesOBuvstu4NS3t3mbSh0wxIbEAqLxz8Sml7qAZYtDA== +5.0.0-qa-55-1 [Build: 1622144487],Windows,P4wWKbQLZt1n/O58icE9zu+QEubXmMqOg+Ge8oCmF9z8qIowtgXLPTJ8n/Qs2jnnE+kIKld+VYIE85k4CtG5DA== +5.0.0-beta54.1 [Build: 1622193586],Linux,JVanVTTtN1HE4HMpeAGku/vjoXKrBTPokMTei686c4u11hOWB59mtHTtFUkCoyAq70ESFmAt73B5mIRqoN2VBg== +5.0.0-beta54.1 [Build: 1622193586],macOS,erjNFR3QtPTD533YwkguumPja+LiuqvqqwgPPqLkirRejBQEfkL9LE2kuh4V1TQRILTXHpxSbrFxictQ7S+/CA== +5.0.0-beta54.1 [Build: 1622193586],Windows,4NT+15Tj04x37T782oDzIenlmu8B/agc2zuRLKH5L4myzbrJFiUFRSjgV4qIqwOjeGRAea82DSrFEO/RcvXkBw== +5.0.0-beta55-rc1 [Build: 1622211570],Windows,1tSlxxY6iaptmif4rlkotuA0Lg8oXAcjYb07GThuC9CahBVR0qztUvmT3R9HxT5cPMLtIq290O4laleZN1ZaBg== +5.0.0-beta55-rc3 [Build: 1622558414],Windows,FVu+gEIcFPAWnGwtB+egdQ7nJ6Wy0cF2ZDu/QdyyB0A/HiAh9vZc0nR+1V5VGGF8pmA4LeJ6gU0+EUTccHrOAw== +5.0.0-beta55 [Build: 1622638893],Linux,srcT6h46YGQHSHpRYHtkB3IypX+bK0Ej1/3OjBZmbcI5PMLGlmsog/Yc+nKh7A98Ri+lniDLXSs9Zr9b24yaDA== +5.0.0-beta55 [Build: 1622638893],macOS,2gSuGZAel3Q20QvrQblEYo9EzPs8eNcizIqsn1eKi0E5Flmz3nMYOSoB2dtSYoJscfXrZDY9u3qhG4D0dCU1Bg== +5.0.0-beta55 [Build: 1622638893],Windows,3J+O2VQDxn3Uv1Rap/iEEY13j0nrzNTNQ51qXdyaMk1QeHrE1q0KQnRyi0hHnhkD4M3EfX6kKNBlJE4xN4AOCQ== +5.0.0-qa-56-1 [Build: 1623069200],Windows,HCnoX2J8AXpbhroYOGJB5tHVWfYUe2JHXonRuB6X411RBMnaVM9c5BU/rUjYjx1D+cISBiB3ks/Hq62efPFmDw== +5.0.0-beta56 [Build: 1623148575],Linux,d9h/sV9KB4sJS3POH0MLBiugngBRNhLvWMD20btZ6eEV4d2UHgKd2dxmd6MQ8arQOk93RXMmRM7x2pUjShV7Aw== +5.0.0-beta56 [Build: 1623148575],macOS,TAXyB1fdhYHwkKyN0cSGqYebYCHJop34rLRcBZRkWWMhif3qzL2ifdQKLlujnUbS86cOLOKmkzYut1Rj7s5xCg== +5.0.0-beta56 [Build: 1623148575],Windows,+42FcuaeKG6BKSMW6IHyu+AxuGcFTV8fPfbBr85Zb6U7RRJQmV5eY/q7KJag0JNgYdaH4cjxK8A73p+lFxUFBQ== +5.0.0-beta57-rc1 [Build: 1623161118],Linux,hz+mPLe9T7wtKNdiY0fuGBEpyqXNpBwZ8Rg3Z5+C9M26J365jnyT06YBEEm1rn/IPAoYlhjLyFstDByTPxSYBg== +5.0.0-beta57-rc1 [Build: 1623161118],Windows,XXrsCn5LVz88fH6MHwb8UINFHHOFz+FjeACUfcryMydYk1t5wsweBuQKlhw1cyFyIrpcujzacKaX2NsurX6gDQ== +5.0.0-beta57-rc2 [Build: 1623419125],Linux,HUpyxKD7u8KNS2DJSA0aKqyQqQRGLNpIHLjXtqzOj4xlkvGyAFE5bsWPrZ9Hf6noRXPwLtwiaw5rlG/K3+aPDA== +5.0.0-beta57-rc2 [Build: 1623419125],macOS,i/v9mxtaL7CDRCV9iZl0X2koxaPh9n/I+yJJFPCYK0HdMMLl//ycPwTrDhuoap2kBpAxKmv7vUxGo/TkKZ4pBw== +5.0.0-beta57-rc2 [Build: 1623419125],Windows,kn4sz9UrXAM07VKrgUDtdmhzf2ovkS3GCvGjYDnMGqLG9Y7vfCC+vbVY835ywmhuRAU66OD5PjeaOqQpfdDEDQ== +5.0.0-qa-57-2 [Build: 1623680173],Windows,1CS4vp7navBSNTNntt89PBiPS23UvF2xZtxcYuV5NO/t3D66rr8VE8H5QAwLJohb4cpA4fg1fthRUNRW7Zr4Ag== +5.0.0-qa-57-3-1 [Build: 1623703105],Windows,RpsilUqhdtlAuG7+DxhoyWm6M3qNE/T1+0rqHY/KTFXPRpHHCbst0ptk0c8io5oiCczUgHGCEGqNyuIsTZKRAA== +5.0.0-beta57 [Build: 1623800045],Linux,4mlATVye7twoeQt/01a3jekU84Cgqrvq3S2BESJqn7z6GlKWioikxhqAf9Uixp68jngoYRbxczFWZygnOEr5DQ== +5.0.0-beta57 [Build: 1623800045],macOS,jB9zs897RiF+FPLKIOyzMc6PsVck1ao0T1bc3QIqxlQiu4mlOtqqQKblbLwKxsHaPRfi26rddW4kZv+uy3hHBA== +5.0.0-beta57 [Build: 1623800045],Windows,f6P6tAWc0csS3J6z4ZoNI2wF+czRe3Ncnx3R/+hnExxBK+7DBAFyHE9MwVYeSSN4xsOA4vtaCUtwCLFrvjg/DA== +5.0.0-beta58-rc1 [Build: 1623801564],macOS,6xcgBUtFJYVhcexJEj5M+ittBqiUqyE6dN7NOUVNUKFlPSW6WOItyfhMThfaKvWSx269JXGhstDNLDlMfyHGDQ== +5.0.0-qa-ex-3 [Build: 1623837149],Windows,HmWWH9D3rROfkK/IzLSueEh/tlDmhMGnuoimwUp0CvWiR9p5KVMVtfqUtcgbs1+yMH47pICya0OsFBtAXSxLAg== +5.0.0-beta58-rc2 [Build: 1623852877],Linux,OZzSs8Ewad603y5RVcKgDrBxvsLlae2IyAHqrXDKydOHaLgWqUrpgXMdFNfdc4AzKlCoPB4FMxjaEZ01tGP+Bw== +5.0.0-beta58-rc2 [Build: 1623852877],macOS,gajkW7AbAOCohBsnBLMcT8S1Y94ZFvcok6kL+qYcHBED9nFu5K3P+8EpEhlkE1VZcn9Z94+Tgk189DBoKVNOAg== +5.0.0-beta58-rc2 [Build: 1623852877],Windows,D+/TAor1uNx+HQMRnNlUt8CMMe07ZNOrWCR/0boroIZI5CoT0A6sxNSG7y3KrqkiA6AIPaW4qm1BKMvk2yDUAQ== +5.0.0-beta58-rc3 [Build: 1624026633],Linux,P+rPi0kjdb4ulRX2laTuc76kV4212iqpNiD8qX6DTFfArKWpieuWJN50vMTKC+nuLZzH1A5qLzkvPxMyewaHBA== +5.0.0-beta58-rc3 [Build: 1624026633],Windows,WMq45OVM7rnpUwuTfh9y9WG3fwXJ43Dk0qbSuBFC7f3AzRbg1EUds5I5S34rGgGIQ9SdkcmQRNRkIMwfchm0Bg== +5.0.0-beta58-rc4 [Build: 1624036539],Linux,AkxU9a8nfSze9gL4gi+QyWM5DlLXr8dGgRDE/IuRY9ZlhmD3o+z0X1qbPDILrRQPczehB/XpXr//2+LciNVBAA== +5.0.0-beta58-rc4 [Build: 1624036539],Windows,heTHLhy1J59lfdBAHM+ecgx2v5xe3t+Xx8yq6+98n7Lij0HC0q2zdiU8IUHTsOwe85hp/OPAmmCdnPEzZAKKAg== +5.0.0-beta58-rc5 [Build: 1624277263],Linux,bWckVdW+pjHN+C/aUtNxwGC0l5j7UsxFQwdYXK6Q84KfT5Obnouw5wV5OHIGsZLQZOTzIQuldnS/H8eLAjhsCA== +5.0.0-beta58-rc5 [Build: 1624277263],Windows,OQheemlgDUJl30ASzoE7udK5TLjrMXtwsr0s/xNN6RvAdJThDgXHrc7eJlX1onOh55QYJ7D5i14L2y8wzAEnBw== +5.0.0-beta58-rc6 [Build: 1624358903],Linux,BC3qch2uaVLbdJTcah5Q9QPwF4EuZvoW2/pX1sr77zYTWbCKI42+numvUHLzw1lHUdDetcWuX8CrAE85/aIsDA== +5.0.0-beta58-rc6 [Build: 1624358903],Windows,TqxAa0e7Udtw41Zxiq+FsDeAZd6a6yGzgoEChUTmAWAMxVOZyjguex+CDRqD2uT6Y4zFXpZAZK6RTLr9XEeJCw== +5.0.0-beta58-rc7 [Build: 1624443135],Linux,y/vxPOYzgYE1ENvSMRLNOG6L0VZnDGVSCicVBp1XYh+eLRN3c3E7A2YrY2ieR0CWlsSnaxlZV8sjwFvA14OGBg== +5.0.0-beta58-rc7 [Build: 1624443135],Windows,AGBGNWmorqdMMS+1fB96g4nkGKNTc6247kL0qI+mwKZTfwr1+TzujBuMYmIj+J1PfKbIC59PgJqX6CKr3ExrBg== +5.0.0-beta58 [Build: 1624455116],Linux,jfouQH+p0WODpGqWgGhC2a058Fw2R23aAeqzXGF3bcurwPteQC+ry9qxzxDNgEgLlNfR2oKI9KtgA9rQSzQrAg== +5.0.0-beta58 [Build: 1624455116],macOS,nhsrLH/r0PgQ7DFotJyUHlNeV9ODPRJ9S08XmIt1Kv8f6IZ4RrC6FGZK8FUSsjo9ZKS/G1cjzkmoq79Mhm8ABA== +5.0.0-beta58 [Build: 1624455116],Windows,QFUj7EwAWIFHDDwtUZVgxwc0O1yAvT7EISiq1djSXuackwNNwz8oF6HbGp41oYGYHIrDdmsEt1ElSD3kNRVeCA== +5.0.0-beta58.1 [Build: 1625041456],Linux,dev3UTiE5hsVr0VRElPtXNiipt4WpbeEElWiYq9RZSrJAXZd1qsg6B6uCDkkyuvK0AoerVyU/c6DzRp0kNJPDw== +5.0.0-beta58.1 [Build: 1625041456],macOS,7nnuj2cd193D377ldCy3Wc07DYBLjfgNoYrEAyOUeh8hZ9Vrw0RxKuTrMO3T0E8t6/uadGd1vjb3dLlnQctvDA== +5.0.0-beta58.1 [Build: 1625041456],Windows,JiV6OaRnC+Mhp4JHWXL4cMlOuSYDMmco9gJxccSRLxc2bWg7LvrlEtp/BT0UTge0r5bTPgGLYmdbZHtvjSZcDw== +5.0.0-beta59-rc3 [Build: 1625125975],Linux,m0ySGjCY+/24C4E4iBhJtUB8Ih9xCK9puPDfFOXz4SJ6ujL6Zrd0YKi3NcOzuZfEX4Py+mPUNv31bCGNtDhtAg== +5.0.0-beta59-rc3 [Build: 1625125975],Windows,8sGyQ/Q8N6v/4faHlpUEDqxBRqRIFhjvtRKWy4k2LakQJxEyKt7xnCYCAeB+3B8U6TVUpMxtOhqD/c8Ut3jqBA== +5.0.0-beta59-rc5 [Build: 1625222996],Linux,jmH2WNbLL1N4Ksd2fnv8f67EbIkUpBbSP90vJ2z1fqd897qgFk9GyeaB6oNiEOrRMCCljAoSiA4d3RqSlTxYBw== +5.0.0-beta59-rc5 [Build: 1625222996],Windows,fqd6gm3Jm+Ve4JblcOltdDF3HJlJbzib8+M5spAb8xLVX/VqcAizl4l7Mwtx8zfn/UIFS2NKJPwh6Ms29vXoBA== +5.0.0-beta59-rc6 [Build: 1625281448],Linux,BHdeMnjdTGSufoVpfsItgWhVYPpmpa7/GPxgG2uZ7AWbc2aGJXalQDuseQNS4sTuFl6Q7tvu2VGpDNH3loZaAA== +5.0.0-beta59-rc6 [Build: 1625281448],Windows,pyIvf+Wz+aG94jRRIjf68suzIDZgpmPF3lYNiI2LnPqbBYPlQVI55Y7eEIOKauS+B7YTPFyNZ5tD4xpc5huZAQ== +5.0.0-beta59 [Build: 1625645480],Linux,LApcwrOY7fJC+Wz9PjIbi5nC+IUueI2dfjWVgTgzBUcP2VJeKgGguxe9JOiEZlPLJ/si6373CnQRFkqqVZTICA== +5.0.0-beta59 [Build: 1625645480],macOS,Xp1bEbN3q24cAGtudGE4QSCDjCBJRe7r7LQsRc3HMaL2TuskcgvkYZpxvDcScyiP+pIpTGVEajet8mcB8i5cDw== +5.0.0-beta59 [Build: 1625645480],Windows,xPJZ36s3ym/JpRqX1SKdjmrTEsdvWhBg0PZhSKxeShCa4xN6QfZCaTI74DYHKRlkVk1mCg/48RAqXSqFK+SRDQ== +5.0.0-qa-60-0 [Build: 1626366283],Windows,uUVj3p8rTKE28iUmqvdUKHe2YL06jiYiq9EFuUhlWFf9L8dYeF2UyZPKWCZxuFND+5AZjStqrRhTAhD8VUMXCA== +5.0.0-qa-60-5 [Build: 1626875020],Windows,7RDryAgGn574+k74H/9SQ62KB2Xk8ETUR8r1A00I28PjKwSz2sW6QPvDtpy0iFxwFkamMLv7InNjJMCG/KExBA== +5.0.0-beta60-rc1 [Build: 1627029564],Linux,rQc/sgqxYPz3LEEk9sooKNV6D8sy9pyi9i6gK+M+8tT7atD14NfBkwaZRGVriuAZFbJsYok1u7AosWMm9CYtBw== +5.0.0-beta60-rc1 [Build: 1627029564],Windows,UKVg25AJjOyGTyqg5VZkjhLQtUGtuhUJMxtRFH/cYnJbBWxiHNPB/lU/Z373d8PbbPe7lQg3qItRu8eW4NG/Bg== +5.0.0-beta60-rc2 [Build: 1627281941],Windows,MF6QJ9AALuRoZXX6nuNH9P/nHzlUekyTm5s5AxwxCKauWlXZGlFSDC/0BZvaqJ+3OKLJP0O3IVqsl4FKBAH8BQ== +5.0.0-beta60-rc3 [Build: 1627315911],Windows,5PlNPQFVeRwyN6l1h72/aNs5MiLkhLdZZC3tyLeUdxBwsNaiBwi0YYn2sZAMvOMjDY1qfoYla32XYmvwsNXYBA== +5.0.0-beta60-rc4 [Build: 1627382772],Windows,s1S2p4xxCZrGMlTyBfvEVxkBHaOM5cgxg7BFvRMvj95KbH0oD7QHnmvSMM9GegJMJkXwOr3pDUa0Edo1rCScCA== +5.0.0-beta60 [Build: 1627453078],Linux,pFd5WxdwkUwPqNk4gz/OPDDKDqH7rtS0mRTYUzzQ3k+bYTrphkDGEs3Py85G0Yww56axzZU4d5TeZXJMt4+IDw== +5.0.0-beta60 [Build: 1627453078],macOS,qZCDpzLg+j2asXImiwE0JR3mkHQZOmuvm5TFQCP6kPxE057A+dP6Vh+BhG5SDo34ost/2FaDb101zqw59g3/AQ== +5.0.0-beta60 [Build: 1627453078],Windows,jSI9eORmJ0xiFCBTvwJk3O5Iz3T4USd0ccgX1cTaQna9ZjL1e0nEandMq9hlTsd8NmBsh3wuVboK2KpvBRuQBQ== +5.0.0-beta60.2 [Build: 1627557732],Linux,RNOFeDyPTNnxH1XloujSn0RqYlxDDShp64JJqM4TEQqQjmUcmNlWc+zqMMRx3cwiiLZJi+Q8jBwHYu2xvjCuBA== +5.0.0-beta60.2 [Build: 1627557732],macOS,AjgLY0OCGCcXB80BDoVyf7Es75R3zW5Dk0wrf2UZDiFrQoVq9KNT+LOuW+vLmsxiLn9h9q5tysEgcNNS50E3AQ== +5.0.0-beta60.1 [Build: 1627557732],Windows,q897lxfc2eM+/G2Eho7YZYIwNyiGS4OemqqDQUW5kjji/117n485HjeO33G0rmevcMZtvd+SK5RwpAskgrMVAQ== +5.0.0-beta60.2 [Build: 1627637709],Linux,Y0yeGGgL8MqP/TbvPioyN49sZRTF9mfA3f81FLXcfVFUBI+2wmtv7HFO8sjdV8E/eCCHGF/aSnfgycLEqG1xAA== +5.0.0-beta60.2 [Build: 1627637709],macOS,2vQ+zKtyWmOJta0Pp5nLB4zJhJqsbe2FaJhWGDkm6o2Z7CLxnOWJtGr+EFx0Hwc2LxGSTB/80E7iMpVezw5bCw== +5.0.0-beta60.2 [Build: 1627637709],Windows,H6zjHdy2vQfbtwqMFDKzvGF+NuCi9hfbd2FnPwHKs6G+I+rEAkzcwlq/Zy0SiQbGiXstqzJIitv0GQnlXcFPBw== +5.0.0-beta61-rc1 [Build: 1627995830],Linux,GYGothXGxbeONpib8ugLs4EvX3KiVO15n+2tlIccbahX2onTAnp8KkierFhw3er3yOlixNsbS7fkUjxrb5V5Aw== +5.0.0-beta61-rc1 [Build: 1627995830],Windows,AvO7IWx1bq6c5xrbu4xIJheY87QCjeNwp2D/SZaFvwb+/h0RaBPC3aqGYdzZQCW3OLx3xPyJpY21hvV6aWsaDg== +5.0.0-beta61-rc2 [Build: 1628243130],Linux,vISDWJ16G4kopHt4RA+EF2yo39pio1+zUfN5RuLwV9YLk8d04MOnZbX4Xxtake1xO10BbYmdKd6ChRvwrgXxBA== +5.0.0-beta61-rc2 [Build: 1628243130],Windows,KbUmvVj/ZkoJxZoWQkKGzShkQgG5pzvWtqyfOLIH6Fh4hAgifCiEEoDDjR49rur9suBEJXqTq3MEvAX/D0ZWBw== +5.0.0-beta61-rc3 [Build: 1628513934],Linux,cVnjrAppfEj6S+GWGCROE10p28si3SPmdDpoOREP7i4PFatQsiBHe4mtqSUZRwJCB3pmcfCMnFOm/rznmVOyAg== +5.0.0-beta61-rc3 [Build: 1628513934],macOS,W7mtneojI+IR88Jfrj+uAeidF1ABdB4nAPju/zmfyzh47+1rtD5ZbH3NpVsPb7+XkgQlAX/COCqMCMNvH9LpCg== +5.0.0-beta61 [Build: 1628671407],Linux,UXVnT6nMts902bTVvyz6lElUpJMs1Mfu9KmQ1JqNvipmGo7UBOIYk895ar5LvCv2NubiqhHcfzthK5r7Rs1CDg== +5.0.0-beta61 [Build: 1628671407],macOS,SWaizGVBbnu76+sk+Ci9it9zM/zNd1yvHexIdsGFD9mTqJFESy4Mp3o2rhu3WUmuQ2IS9O2+5am4og7j5HOXCw== +5.0.0-beta61 [Build: 1628671407],Windows,nNxZolc7hbuY/VqOT4yPyss6yyV/P4WtwARdxk6pMSKu2bjqcoruLS4q326dMn2LURoUosTDzSNkG9si+h1wAQ== +5.0.0-beta62-rc1 [Build: 1628769114],Linux,D7VUKGHrIS5j9woksZrVrm0TZ572X57RJU+GXw83iZH0emr7wmTk7X5uRkkwbCtYJyPnE+8Nq9L37v49d3rTBQ== +5.0.0-qa-1925-8 [Build: 1628773544],Windows,srPGPy3iqROXxBlFWRlQzT2d2suarS3tSYyp0sxhxYKOAauiLC5JpduVuihpYCal/UNbnzyxs4y1RkyzYLEFCQ== +5.0.0-beta62-rc2 [Build: 1628783944],Linux,hJ+87Z+9l4RbtW6IUSd0glOld6vJCQESdH3SFQ2aKnPlz79ucpxecsvnnoPHElLyP+UrlfbFTQDCs0N1ts1sCA== +5.0.0-beta62-rc2 [Build: 1628783944],Windows,M7bVp7Q3P56amidg44+Dxx2a+Sned/Sv7e99aVW9Og2cCoF/pjjJ1AAij8tkdFcIgi7aehNVw5etU9S0rqkaBg== +5.0.0-beta61.1 [Build: 1628848434],macOS,xsGyh80SYE8zarooLP+9ascC2V8ilxEa99gDe4umCJJyVSVIw5wDPCTjur88aqNJnfO57qUZKgEJ+UCIaP91CA== +5.0.0-beta61.1 [Build: 1628848434],Windows,dHRBtVTXv1vR4stDUyubTFTl0GpttNMOewqOFe2hUbzqCWtLflzNCf4rqTMA7OqH6pjYOkM41Z31QhRPoPZ7CA== +5.0.0-beta62-rc4 [Build: 1629103760],Linux,SzRKkIeq/Vte/p8GrqQIUn9AhNEBU2SXZSt5NP30giQYJvMjhWI/eHqOjQA3twPJP4kaWIlCn6pIXDJjWOgoBA== +5.0.0-beta62-rc4 [Build: 1629103760],Windows,2zOqY8mu2gVTRMo4+fG81TQ+/GazCBqYue4It7tr6ghP5X0CgBdZnG7oEuSj3L1pNSqlMbT+lMrDwC01cigyAg== +5.0.0-beta62-rc5 [Build: 1629121366],Windows,oOUGiICrDiHuDcferglab4Un/d6n5/Grh5Kbp66csJJarwjsG6h5B2YA9GBfBaSWXzwP3jfkow/FTQ4DnPNADg== +5.0.0-qa-1925-10 [Build: 1629205202],Windows,Vf2gq3er4aXUpejhr4qIF6zbXRdObg/IqU2srtwih6IMH3dkzs4b2mH6qgmjw90T8c3MAxF5WrU5i/PjRkEtAg== +5.0.0-beta62 [Build: 1629207214],Linux,EMgW07cDBM3c/WPPTJwGc3aDWHvoG+aqo3dtE5YAd1Bmia8wpD9YOERxetdp+zhmj7Mhi3JHyBl3VMQlCP2mDA== +5.0.0-beta62 [Build: 1629207214],macOS,Rn/wdm6PcpPv75tAhlFJe1qf8fmettbn8aWSgSBNe8rxcn3Gnoo2RIJ0E05Nt9TQ85A44OC5WenuceMGb/IABQ== +5.0.0-beta62 [Build: 1629207214],Windows,B8zwVN7MrzTaAE3FOmwuAqbI3UO5bU0aFEWBcBVBXU6qRArFhjfzCazSW0qClZcTgjCtzGVRZ1KgYv+yEzCECA== +5.0.0-beta63-rc1 [Build: 1629878569],Linux,ptpUHmBo1Oft9FH6IsFCSWG4UzfoZy/HvP1hilSE5G9WKK79auBC4OHroaryAXhTiv48fyRo2J9Tjz/1pMszCg== +5.0.0-beta63-rc1 [Build: 1629878569],Windows,hWjdfWfqXVT4y29UUpEs1VTQs92SHMyYmZpZkLFXA67zerpQVj6IcNqxKraUz1LPr+gGN9+JuvnpB+gcQRTdAg== +5.0.0-beta63-rc2 [Build: 1629993565],Linux,VOq4OeSuOfB8LQ9+m08sWq3m1uclLoV+nRIUVxTtnwnw/TsfNzRdTkUYBfwPB4SS0pat/WCzmJPVsPcl2pXsBA== +5.0.0-beta63-rc2 [Build: 1629993565],Windows,4cFmNGL9tn/MfJa3OxUbC9qZfZbxU/UXRrKnIufEOuQf8LbFOLS2fV22afjtgvkHTU6wioGFzAsFBMD408raDg== +5.0.0-beta63-rc3 [Build: 1630066856],Windows,DkoURrQZ/arH2s4IzoEFQW/y8z1T2THdNCS1c1BGrpcv0H52soLTAD01APwmdATxcVeBNaxbzq9vSd5pkGSXCA== +5.0.0-beta63-rc4 [Build: 1630324970],Windows,FObv14Ezz0Ul6g6fxHRNE6SBsgf/2fTtmfNheSYFJ7SBPJheJ95XR4vZkMz3z5rMDPacz5U9483bXkrVea90BQ== +5.0.0-beta63-rc5 [Build: 1630417664],Linux,Yit88zeNlcO7/jJUbGOXLRlYvx41XlaembvpwFd7ijb6jF41+zU1EGsISgctd+u0GySlrUtpdAmeQm58tfOhBA== +5.0.0-beta63-rc5 [Build: 1630417664],Windows,Nh9rSb82sfovpCjNlviF9ekL4y6kinMhVlRr8hNqXSJUKRpdg3SCoxhSFrQ0MJ5MFtMSf80Ey//sYPPR8F+xAQ== +5.0.0-beta63-rc6 [Build: 1630672687],Linux,NLw9AYJtn2ui46lAZIVtCeabaJiYIswd7y70iGhxytNNyVjt50/A08PYMYpolwyFo3qVwmjYillg5qBQ6cZ6Bg== +5.0.0-beta63-rc6 [Build: 1630672687],Windows,5wPn6pom99AbhEeBdmhwvamGiX3oJfdsfAN/cAqojiYFQ3NL8AxEm2qyPmCyuPrGm5O95iwSYXgsfuMw0VVmCg== +5.0.0-beta63-rc8 [Build: 1630944479],Windows,TEVmPlLUW0JeIJFSsDjnkFiYI2rsqs6BtLWsxBn7iIeF219KL6SIX1eZHhvdwZk16OLOCOH56UX/0X/RtWY0Aw== +5.0.0-beta63-rc9 [Build: 1631005853],Linux,V6Re2QIXf87/eWjxz9rJEo2mqK+4jrrY94FkdLeK9Ouprp1daynqQqm2Al9I2ac1QBnnxCZe1LWgcPefh/e9AQ== +5.0.0-beta63-rc9 [Build: 1631005853],Windows,btkblgqZvb66caWCIE85HOQu9ULbfSjAfixSVSy6YMBMWfxP9AQWt1lzezjuclA4lNVilWFSm5Uhcl+R3/kvCQ== +5.0.0-beta63 [Build: 1631042126],Linux,aEfO8lGf8WVEg7+z4EuuNWkzlukz89ke7eIGs1rVY7cmUcSti+Wfds1pf16MesYno/E6xfsyIGrWB9lFl0E+BQ== +5.0.0-beta63 [Build: 1631042126],macOS,F5ZFNd6RE6zzBR7rjfw4IJFcAEPfa2ECcaHgSD5QORBvsvQxHZcEnEXXcLmdddZW2ppiqrdzEKtB/NaVdjRIBw== +5.0.0-beta63 [Build: 1631042126],Windows,MMX4vnmOgjnSdSBidViX7KO7dd73INKb9rw8dHVCPxqKNeMcLgLst1nFedIqxsr53n97rkmfFcRtBANghSBrDw== +5.0.0-away-test8 [Build: 1631200786],Windows,Irhvv+WQjL5450UmlAOVY/0UdYBSwUl+UE9kCYpaL0S6IjnJ3LRhgO50mAsJQchcdwJGjdATDsY9TMcO/BUPDA== +5.0.0-beta63.1 [Build: 1631268231],Linux,KgpMkgrD4QZcSd1mYi9qVMgUfAjf3VVbKYReVU/nwR2xKAXOiFVAgqZ5DZF16Aq91e5xQvZxQhl8i7umPROZAQ== +5.0.0-beta63.1 [Build: 1631268231],macOS,kEEqTmZ24fKwAohaUYEvWz97fI2yp2MC9RJgN34F3Y9gUNzc1t/DOyD6xHL4wQF4hWfY3WjIA7lM69Rwt153Aw== +5.0.0-beta63.1 [Build: 1631268231],Windows,HSr40GiVRivm/l6YjTKCNP+njvR7EhpTlkxByOiieI3jedQRyzdS/uxbcIupS6TDWdDsSS0URBTgH1n0FqUKDQ== +5.0.0-beta64-rc1 [Build: 1631271008],Windows,UMxEnfB38gV2FUYiokuJ9hYK1u7ObwA5zoRXa+oAtC5OxEf+PEpsMxBspdKqPllFVS3k+xX0XWx2Q5Gi+ANmBw== +5.0.0-beta64-rc2 [Build: 1631535074],Windows,6zYgWnTOR1wRFV+hrAf4muv3pplVUBcrRBnKN97kRv/aEuy1Mgn5ez11EnXFR57dbU9AQjDGPBQRUpJFNj7JBQ== +5.0.0-beta64-rc3 [Build: 1631614018],Linux,rtoVgZuDu9uXrV7xB8aSn5O+El99KxSvz6xwWzpN3mBG48dlLqbmmNGp61lkezyjXq+hgWhT28du6q9WDfduAQ== +5.0.0-beta64-rc3 [Build: 1631614018],Windows,kGx0a1FrSsYrWJ8BcIWoQo1nw9F4yrO1EuO65uKYO9ZRrrINJrgwaHUZwx5MRc9ajsJFaQdUsXhumCKZKU9hDA== +5.0.0-beta64 [Build: 1631702252],macOS,6JEBPkYHc1bs1KhrZaRzCHo4u871reAODdt1XVu/uGgMnj+tNLmL6dGJ6YaAuGG2leyFQ436PqRqRQVu7ZeCAw== +5.0.0-beta64 [Build: 1631702252],Windows,SsYcBVnP67XI5dKDbSOlWRns8968Y+V2DXeQUNhwKI69eyyB76eBrMgRTZ91rdgyQqaZCJKNiU1AIaPbV/XbAA== +5.0.0-qa-66-1 [Build: 1631885355],Windows,s+Lg/dUq3gTn1KbVtO3jC9KNhjVPKR5htkO+SIrGyaR/ToW7nr3KRE3PnF7P3tb/0wGIZ8JEz2Mta2hjSdIpCQ== +5.0.0-beta65 [Build: 1632210487],Linux,ChmllHZUolNrHhaBK+FHMfOBF4X56zaGeDMJ0qLzUZJz54UCuBiIEYiUhn02F6RKrBCM6fQ9I/MMzYOv0PdWAw== +5.0.0-beta65 [Build: 1632210487],Windows,CkKf8FYi9nWa5jRxOUQfvAy/2MYnSVE2Oaa2cOrOKYqRahpzUmsy14wwd0+ZSMLVqfG08EOpaVzeHr+7ySpqDQ== +5.0.0-beta65.1-rc1 [Build: 1632234637],Windows,QYXj/5id/Kzjb+dbkRltV/ki7JpIRoJ2/nx7SNbXzC47XBT/iiQ5EiLI0F9G0g5V3UuGuepBnLyN7CeGrX0eBQ== +5.0.0-beta65.1 [Build: 1632399768],Linux,+wjy0tnkSfyxh/vRP7WqudF88ZPMjdcRC6MJWrtGbAJMBxbok1FP+3mUNyexlzcG1ZVCIv05LZ8CGAYzunNRCw== +5.0.0-beta65.1 [Build: 1632399768],macOS,GsPT87agljBvFnlOSNWoNV6kLegxdYeKp/o0eeGLNV2e+4E0S+YE/eEAAS8kZK3F8b5rDR3MdvVx3W8QYxbwBA== +5.0.0-beta65.1 [Build: 1632399768],Windows,pSqFVqZhNQVc1GcMzMV9MyynGj8wLNf/xW/QcymXtsGJO11dIqdgqhEIYrdadMyqnUhhMjNAMJeqcxop+pI9CQ== +5.0.0-qa-66-4 [Build: 1632410203],Windows,k+dlfbWu3GtyDXonTUkRK/qxEbl/Uuwo5ZWXDnIvKud3mSm2VX0VUyFzf5PGYoXpxkgJ1HtyOP/UhMqQ8uX5BQ== +5.0.0-ms-2 [Build: 1632754860],Windows,/3SnS+0+R6/HruDLsfIs7d8IpfVMM9u013uTY9ImYpIXOFOINGMUUjTRhwA+oZPRaqEQf18uAZ93EzXOJbQ1BA== +5.0.0-qa-66-6 [Build: 1633006583],Windows,p+DpdQ4Fi8tdnMvVP8jCS7IO33hVftvHZZD6v+szW3HzUJFA4Ueg5gz+lCaMcb5yZsPxDdIzS4QWV47KB3qcAg== +5.0.0-beta66-internal [Build: 1633604766],Windows,PGkf4H8G/y5n19h1JmwUZpDt07U+BjdXurYzaUyGqW5J0bdZSVJlR5teIb690XAFGdyFX6R15e3bH1XqXQXRDA== +5.0.0-beta66-rc1 [Build: 1634917358],Linux,rVTAulwEQD1FGNG753/mCrbMxZyG0ZBYBt8vkJiJYcGO+y6Q09/y059jMxqXAARspIDUNhEgoIUt/jnYNZFXBw== +5.0.0-beta66-rc1 [Build: 1634917358],Windows,f0+4Ff3AmbkzP1J2fQmgdp3WwaYJ0A5UcMGKG+ze+PxhNMEWAdM0XzixD9wj6lDR2XiOzVR1i2Q/tFVv8Nj8AQ== +5.0.0-beta66 [Build: 1635340287],Linux,KIEvK+JNGlzOIN4wzetVEEpr1/Gsy035+kRP4uUANv6efNYe06yTDHqwk13GDCu2Z03dO8XBs/ZVMhDIEdWQCA== +5.0.0-beta66 [Build: 1635340287],macOS,FNlzmJhKg0RKPI5GpYR0ZVZlxcFtYpAd20mCBVv1XKzGyR+kaccsaQhecq3aclEgKHziHMDolS892C2hOcYyDw== +5.0.0-beta66 [Build: 1635340287],Windows,81WF3pCS63ISYJOQX+OXXxITSQjd0pu/Ofpp1cZu3E9VWoMimP1YUCaSBq7kAeZwcNrbVJJ4C6sUJEIDx3Y0Dg== +5.0.0-beta67-rc1 [Build: 1635512518],Linux,Lz6odZRsICbIOwjBalAYBU2fwc+raJDgPi7XM620u7C1A/+OoGKuxMthkOWZ/JW9dlnYs7d7Z8QyLop3Qa2uCA== +5.0.0-beta67-rc1 [Build: 1635512518],Windows,e6F3H0g2IlMkeMCJyNZYgMFW1OSRRC1SF5uWN+gx1zghfUWUtp08zux9tH2ySBl1e5YyWIP8mOBXgxwFJgvdDA== +5.0.0-beta67-rc2 [Build: 1636124060],Linux,4ERq1ihEy1ArHecbrYZfnQMvHFrInBYYsZnmMupkdpoDaRiviSbVlTXY5U1q9njYrzsj8s4EI8c2A6x0PV46Cg== +5.0.0-beta67-rc2 [Build: 1636124060],macOS,P0Iy6rBbnsYHOVt7y7/nbepH0eoopP8PzLc6JMvqOUE+uoInlQmRcy3mTfNyaQSBgZ2NTqw2NFbBP7Kv+h9QAA== +5.0.0-beta67-rc2 [Build: 1636124060],Windows,prboyJmD3J7qhFJ2/tnLxVk2Uf0moxggtCLZyEpUHhJiKiDKR6QdeTx5K4u2TwBuvK0tFtvj058Z85s219DMCA== +5.0.0-beta67-rc3 [Build: 1636470636],Linux,cS+PB8d4YtslCr9Z3jlNfNhuSdqbUfufnn9wbbDl2/h4Drb3okxvRS+2pDjZASYGkOC3Gf+VUkGmZsrDg5ftCw== +5.0.0-beta67-rc3 [Build: 1636470636],Windows,dXRBa//M5qWE64qfdGybN84JnOLbMrCJIReuv2c6eViWtjyE5AcLVE7X21DW5MtMGXeXZB/qwxbBzPHKErxrBQ== +5.0.0-beta67-rc4 [Build: 1636703696],Linux,sLNPLyXWN9w+p4qhmmWJeYy2qiD1GYpBUuJVY9BYuzM6Znm56zpseQqFCvS43of5B2zb5DsCgm87WWx/+3kOBg== +5.0.0-beta67-rc4 [Build: 1636703696],Windows,2wcKHWrzsPtLLv4QZTTfKZCc8narFgsSTlq7z9w8egpfx4jt4Y0ZLQV8usasdO4AaklKY/Y4072tJiTcP3XFCQ== +5.0.0-beta67-rc5 [Build: 1637773695],Linux,G9yoF9j+CgxEDcDpFJjxtokCXYQxxPuMwFKHuceK/p2xtae6CufhkZh5ebCYKHHqOzLJ8SshC8IlAn8QQgRmBA== +5.0.0-beta67-rc5 [Build: 1637773695],Windows,IRTxy8FOruwU0CtxGzE/ix3zE8IBztKfdcjy21C5kScKp1Ne/r8NpOF8r4H1PYX/FQw0PVkQY+/8kK4uVXS+CA== +5.0.0-olm-refactor-1 [Build: 1638283086],Windows,uUXlxNlsH6NampO9EAjYT1r0/yKZPyaGtP986lv1JMGsMq3sPz4OEqCjyG0p+eJT2sLx8N7pXoiFw6K0e4lRBw== +5.0.0-beta67 [Build: 1638359901],Linux,oywbpFbPkRymBLBhZM1a1LPY+6oAtqA807kBF0EyB5rpEsqulMXJzTlECjVf4eiWHLTGL/VkpyLy+3yjcTMfCA== +5.0.0-beta67 [Build: 1638359901],macOS,P8sgAyL2yCinMHqSJ3chgCRS4D5rN9TvAyuloSeildT9lEivLK+5mxvAWndFn8uOvf8bZTDi+TxSmfAzQ/NVDg== +5.0.0-beta67 [Build: 1638359901],Windows,nlVdu01SISGsf7cPVeYc+1kTHhEsnD1sZtaqeZaMKUpPFCAreuDsZ3ECqm+DbVg7C3ZbKcxszlVwVxwroBOADQ== +5.0.0-qa-68-2 [Build: 1638544382],macOS,G9sFGBu0WBzKRAlGGeVJM0bOzUSsHiEZb35cVTfcvt1xtsNtsRsnw9sMuweDGuB26gzE7ajuYEdBX2FbMRwyDg== +5.0.0-qa-store-update-dummy-fix-1 [Build: 1639400688],Windows,SlypMzSvf7FKTZceC2SgvNaZ9fOEZu2cV7mQr6Hf1CVSAKRXZkmlucUvKlqyU9Rj/2s8RZoLwiYrKjMLwILYDg== +5.0.0-qa-store-update-dummy-fix-2 [Build: 1639646105],Windows,wUm+ktQaSeaEYWwV20nSPC4ZPERsA57UeCJx8BJYTxiEGCKEYdBZrsAm+jIrwwtrO4KD/k3ICO0xS9jzQX1YAw== +5.0.0-qa-th-16 [Build: 1640003749],Windows,bjPYVLTJYZk2Ssn3yrNftHm9azsSAajfr9VLP+RAWueV4AN3gqIq3wg6htQu4AJkjY59cJZAOEdfrpF8C6k7CA== +3.6.0 [Build: 1640259570],iOS,4Bk+MYCta3b2SlKl7cVMrRgNTCOGv4qPOVpQ84c3ueaDrOzXcI0REIjLJ/Pcp9jhIJ+Jb1ODZBT8dZxbm2w4Ag== +5.0.0-qa-68-7 [Build: 1642008173],Windows,lBXxbwIGhA065UoLqw7or4St5qssnkFb4Nw0B01OLNdPxGvGiWgBd4G9Q7J1EnX86g7KqLYRY8PPbiP6jr1BAw== +5.0.0-qa-68-9 [Build: 1642074370],Windows,HaUTRwyKMGRUAK1SJcnCy8sPXh3bx8qi+LsKuN9bPVfV1R7eMymV2Zx5BUVbsLJxINxJZ23bWUH0eejtIgQgAg== +5.0.0-qa-68-10 [Build: 1642155836],Windows,Q68Iwg2vo/mfH078GGj2OzRIXiucddLud1txjNkH2ptxDvAfClENMBKjLpfoEtoiZm5XYwIxeyTskNc9C3YOBg== +5.0.0-qa-68-11 [Build: 1642428288],Windows,QyavWsP9ouGPX1I36sB3aWXbT2d8OwZRUDoHkY8OBNvJbGiTXfOrVrvR4LD+bgvsc+VuOVlSjx0II4pk8GljAQ== +5.0.0-beta68-rc1 [Build: 1642505026],Linux,qR7e88rbZLNH138DTrg91DtKoOCnsQ7yTgmVBXlc7WoIuJ2nd7Ucjn00AzM9GM6SZkfFvF3D0HynflxcxA4hCw== +5.0.0-beta68-rc1 [Build: 1642505026],Windows,EwORWPWSYjN1l3RGQFWFcJ+fBCcFj8yHW40nb9srtQZ1iLic1qfPiKF+7jzNLHJS1iS6Qx7UuBqONZLSz0X8CQ== +5.0.0-beta68-rc2 [Build: 1642605878],Linux,UfX2E2kPPWRGRrTzEbKJDwRVOh5HEFX8pg4vjxwA05hn7F5xEXb7+b0yucRD10pQBq3G/jHqVfJ1RlvKNNO+Dg== +5.0.0-beta68-rc2 [Build: 1642605878],Windows,4yPatak9NIsDMyCODgDOuaQNO08poDm9+qDgd58GC7wsvtxt99iT26gZ5YmNS8vYk5GdfQCZEy2QzfMRs0FDDg== +3.6.0 [Build: 1642760631],Windows,YtVPmw3A0aPfTqOU8OyQVoDuKtPBCtiFrJgA1oajXRLchnKBYSCiK2K6Q/mQs+cn7cmVp1ZV0+aYGvUJRQLNCA== +5.0.0-qa-68-20 [Build: 1642762634],Windows,Sx7RQEHiEnKpD/CGZ2V9StXKVWrsvgDePlkUvBhd1VcQnkQ8ShPauJGHic1MiAIv4+9VKCuF2dMuOUmzjJTZAw== +5.0.0-beta68-rc3 [Build: 1643385351],Linux,DHKCUoEm36bI1t7wBpq+ju0HyVXUp2eRgjV58n2C5a8kAHDz/jgiZzKSJeLPx0bZuAd10Gv2pNqEeb5UkVbIBA== +5.0.0-beta68-rc3 [Build: 1643385351],Windows,G5+2JSGlehLUwn5DzNDL9/8zDGmSdHAY7Cg930aOeufmUyJmXgpzS87hkhaMAByDArp+Td+WLTkJxn2wE1HrAg== +5.0.0-qa-68-26 [Build: 1643637044],Windows,WNcgfD6kvSXSzUeQaxVxIiX0e+xv/rKBdqSm/ORXeimArty2EoCA5sm65xpcy0FHOG5BciX9JJjvkSIdB76gDg== +5.0.0-qa-68-27 [Build: 1643641086],Windows,hTifgq7hQ1G9S/ULyEr2NHSteil5T9KC8w65e+UwWkJqhHSWgaA0ICUOSB5J9/yd0alFJU/6XpjoqSFW5WTwCA== +5.0.0-beta68 [Build: 1643723246],macOS,hnLrqXS21edeNiHiaU2V/Q8TGloQKp9dxh1Of+NiLEJB1koDfY1bW9H31oVLrSSH8U35kC3WnIdcb/J7h2/mDA== +5.0.0-beta68 [Build: 1643723246],Windows,CW57oWrfk7qPSrRifg+pNIUoFGl/7fjoCcEClJqRRNtAK0CjCnx99/auvO3BSB9rPRRWq41C6q9VuhVugKP9Ag== +5.0.0-beta68.1 [Build: 1643727795],Windows,jDTnopWRErSf1sO1vH6Yx1qxZPNv7hwZFQRvFdeqe9Z4hQHrY4Mgt7lhHDG7Q2H3ss7wZ0D8H12CnXC5RNB5DQ== +5.0.0-qa-69-5 [Build: 1643982067],Windows,UyXxYq75NUY2oTdYgKFBj/FrXjbVVgzO7ly0CBIswihoyUm5UiBiUMZ3TVIparJA9JOnuleiDkih3fhXQRiEBw== +5.0.0-qa-69-6 [Build: 1644241206],Windows,0P04q5dEPdCWHifYv7HSlrRWM08LeiQ09+1D8U6kU9gzf1cHJXw+5+FRG6dNb3dzzS6sQnTZtsVjbAF4h5uvCg== +5.0.0-beta68.1 [Build: 1644243684],Linux,cDEN9t3q4YMtjOQ6a4Yp+7YnsdxDE/1lfhqFjSBUrpoyEqKarLkqGLgNop3vJ59trCSzqJzXskIHFWXtggZtCg== +5.0.0-beta68.1 [Build: 1644243684],macOS,1EiWEK4KR4b4/odYwBhIy1b9dSj0ffNkN23RJUDem2JCFVSOExCkVx98HEH/OhO+OzThC43LX4++0eGvoDYkDQ== +5.0.0-beta68.1 [Build: 1644243684],Windows,vONV07+8AMY7TPSRMH0PB79b1b6jY30cMoS6X29yfSp0U/S8eNTyfXz9fHrUhqdzm2jcfYSrWNCjjMIfGPq1Aw== +5.0.0-beta69-rc1 [Build: 1644575557],Windows,mgxRbc8omXUpB2Zxs7oZfL7ocjuSlcUTH+lV0RY60rY2LLIdmLsitPDYQbMkzMSdIwCMGhmKWJPUN3LaSy4LCw== +5.0.0-beta69-rc2 [Build: 1644595314],Linux,TOhCAXR02A4yFiLwABZARKrnamhVM5mLhmL8aV6tzyFlfaHwUbuHYcIPkaewSyaOCEgD8i3spZ/+XqS+4n6pAA== +5.0.0-beta69-rc2 [Build: 1644595314],Windows,NaJjYxfhehKp7xp3cRHdFFL4fl4LKuvMEL55y+6SvBwfIsjVx6MFCUNgAqc39ZPsGQbCXNa7d8Ik/wmyrBQAAQ== +5.0.0-beta69-rc3 [Build: 1644660819],Linux,p/nRODqs/OFcPMhstqmAvft79CLf1Cgnn6NAslbf6NGPWZykMI98FLeblPR09k+PoeXi0hj78v41qRGVFPIABg== +5.0.0-beta69-rc3 [Build: 1644660819],Windows,GB3DbCn/JEGuDJ6jdafCkzIl6u4O5zDWsUdQUfGyPMRtjF/63foso4f49B0sqsaJUIXe5wpgQC5LGqVOsGOADw== +5.0.0-beta69-rc4 [Build: 1645087682],Linux,smuuiUwigzbiDd6+qu27VH9mm7PzuTmOlec4rsqND2Y9RDrZewkl15Svx7ZFApXZGYPdMOfRnnXX6Un1Tph/Cw== +5.0.0-beta69-rc4 [Build: 1645087682],Windows,NqR1eiD/HyG4Z6/OdTMdkKdA6SnjHkvx4ZPt/wVMdD0lTL3QMpkxkl3/iHvb4ZmZaUFnsZUiWgoG/tWorkDgBQ== +5.0.0 [Build: 1645113667],Android,z2LG+Ab8slNy0covF7NttNzwHPhF14hu+EMkDZwjIsdvU2BU4bTXjtkI2gjow/N/p/ba42SE9MLTiFglXuThBg== +5.0.0-beta69-rc5 [Build: 1645448271],Windows,9rCNmBrEhBaX2bzyrW9kx2S8umP6AELtt11uPclBC2DNaOW2aSUJSA3LkZ1m7Fu0TPeD908+XXDnWlsHvRUYCg== +5.0.0-beta69-rc6 [Build: 1645527496],Linux,4NIKPJar37y8+PnVe/mTc4xluPyi4gSXvK5ZWku0epo2XgQuJ0+AoMDmWVTyfNue/VupYBUdzEfiDifxYc6BBA== +5.0.0-beta69-rc6 [Build: 1645527496],Windows,/clk64cVjel/kF3YlDgiWAJkN7PkFrjHKyMCK9tfcxeV/+08Fot14sXLSaW1B36qo9qFF/kUUZGt/Ku+eZn3Cw== +5.0.0-qa-69-12 [Build: 1645630715],Windows,UnIsz7yDLr3lnzt2pYKAZNC1g8oLqv3ekuTqskM0ZGeso0Y7GhhDMZARCFrJMWVDccA+fzpMI25PoPD7KfCoDA== +5.0.0-qa-69-14 [Build: 1646064573],Windows,DHlU9hofr22th7vP0Kii0bnJpVf8yh56ctIPD8U4l1IKY+Yc2a1cw2Mw3q0fT0e73W4uskbgUkhUflSW4QHDBQ== +5.0.0-qa-69-15 [Build: 1646165194],Windows,Hev8vdybbsX2FIMW/aXpfbmYJGg0pgYi0nLHxeMk5i7su+dcVNKAXByM4+De8wcJEQ+nO5klrtA/B1HayyJABA== +5.0.0-qa-69-16 [Build: 1646319264],Windows,S7EflYS+8UCKLTYgWFM+pjDy61/4E04kqRevUmIEu1sKhbOVpAWlawVboUUybjoGOaCxauMFnjablj4Q5NpYBw== +5.0.0-qa-69-18 [Build: 1646666161],Windows,TjHJin1ghKvzLubbMJXy6ePCPcX2tnVlVzS2cZYcT/gx2uYSQVLhZxF1pHHC0ZgOcF+HIUgmY0UbU+oj4JikAA== +5.0.0-qa-69-20 [Build: 1646829751],Windows,NpmWEkUZ1rW5jSnCktzCnU/7A+uaUBQ0b9oyo8IRgOihNQL2i1CsEPgssj0auVU86lx/1SS15CI4uNjOhRMfAw== +5.0.0-qa-request-chat-7 [Build: 1646854452],Windows,0iRGPzh37MelxPeKE15K754jAi+yXJ2bu+pXV1ErOFbEF504WtUZaAIoFVHBNheIVdSCrxuWFF17xG1w2gSICQ== +5.0.0-qa-69-21 [Build: 1646935163],Windows,06E3t4+OxXNtYQMQO7p87FnjUFzsiRyBG41nbdoavLuAz9aPmMG1Hu865qRfAXIUioQgVlLY0nJj8vdZtntqCw== +5.0.0-t-2915-2 [Build: 1647254017],Windows,1mnBwJhwdrkWBtHRePQtlYRjFmGnQmyglqRrtsmTb9sj6guDUY4Aw/i98feAP7O1hZO461QvAgtNfXmMq015Cw== +3.6.0 [Build: 1647511767],Windows,S9Ow15joaTizvIJ4xTf1FYpkn9jHIzO+ShPU9Va/g9UsF70+LfEQBgneDx0llRzzbIglcXAQOvm3VKOPTVASDw== +3.6.0 [Build: 1647530723],Windows,cwRrfUAx3jpu2AC7UmX2z5PrjSEijHFVmwoh8W+6y8mmxHQMu6CJvrr2Mf/OCNmGor82fCjWqXwLSK2McVx3Cw== +3.6.0 [Build: 1647595742],Linux,jyIo8JaV2sSEeilGEIGEdjm7q5zA6GT6kZH0QcbtJNzuzgjQ8FwSbJnOY5crSys9zdQNIEaaUrZliJowClUnBw== +3.6.0 [Build: 1647595742],Windows,MVrkchf+oadHXHVZGRrY/WYg2QH45rdt2MRgZ+0UA6c15L2P+05u/5YiG+4Zp82XLsv2xZYSuM99xcOoLxaqDQ== +3.6.0 [Build: 1647855949],Linux,z1lAocn2kKnQ24Pt5pOzfRx6Tp+vKSxdb7BINN7zYaWceYi2cnugGMBGzqN6MkStI0ROHx7RCpBqRWKub+YaAg== +3.6.0 [Build: 1647855949],Windows,xPqml2CxNFCbEI+ZcyCcIP8CrK7S+IT4I2f8DyY41UIae6WX+wujSflbGXWrzssEmsYh5vLoSn1b2TmHyIdPAQ== +3.6.0 [Build: 1647921962],Windows,gx/meu4ewDSqByAxHDJ8ordqoUyqC/lQEeV0NzgWZvAtQScqDGCEOtNzDly0zKfRQ3HBidT4EUJcLZIxIho2Cw== +3.6.0 [Build: 1647928456],Windows,redEKXeLBo6GOtHjP5Rd/A8zadfkQe8kk6eM5EawvWHpShAB/xRWtNuZPuJzZQbhO+cytH/CM68huBUCgKN5DA== +3.6.0 [Build: 1647939487],Windows,dN1D99vIPuicNDyZfcy//Pm+IZpvRZtE7eaB2oPuj3UuMt4zSTlZY83gNwysucxzNLPTnFIWgGG1HXzaceyRCA== +3.6.0 [Build: 1647949292],macOS,0U/IWJ1DttzwFIzBp3R7xfNJZsaOFDx6iBLo/A5SevQLE6FsAIfY2OpQe+qi3fFjMF7pp56l+fdR8UB6wgSBDQ== +3.6.0 [Build: 1647949292],Windows,kQ/P5bPJ2ier+LCRZOmnNeD0WKmFrLT9g3gth/Jv+EE0cBliQB1t11uxV1nclPWVsVIVIxQlyvl7ryV/cMJDDA== +5.0.0-qa-69-26 [Build: 1648062270],Windows,Mgd0GL5Ui6UiGQN0nSTkDy8d5fxqRKtohpazQWJrycewP4D8/iOafBpaBn5tKacy0nc6Q7Zbx9+MSnwdilP/DQ== +3.6.0 [Build: 1648153885],Linux,cjqAPjXF/Nk3PVVcns8aKSJoVLkSe2Y+1gxMiUCsG8ZEOi2tixm7HDfLCrBwfxuwD6LOOPaaANnjeb5Q/GSPCA== +3.6.0 [Build: 1648153885],macOS,Gcb6nEkVgdA0jyqR1O5xYWNHL4LLJw8al++hABOFmO4gUbuTL4iVUD5tOsSLAVdpKKcjDlBoA8i+d2WFMWWMBw== +3.6.0 [Build: 1648153885],Windows,j3B9t27eIoSbAiLqV4YwLoPIeIp1Hq1lNKpArE1MI1LPtkLF9llUAERFtkhcQH7Ofxld2jPnVphYYcfkcPZyDg== +5.0.0-qa-69-27 [Build: 1648222308],Windows,aztxNBrsEXa2jMs1rQzl0RQjFsdZgfU9jBGXRKAwxm+gigqm2hsGkDZbwasCR1evWEekf4Oo/guXlCkbg4BQCA== +5.0.0-qa-69-28 [Build: 1648740980],Windows,yjCmepdVF4RRCBVDcq1dcLe4pmFAxAbIoZoqHWlAXZjy9OMUrW3dqqs5u4BsbJOAA9/WJ+5apc85umalkEmAAw== +5.0.0-qa-69-29 [Build: 1649081557],Windows,AbKy5mV7Xwtt7V7QWeXRPoTomTeK74zmx7XdQ1o+mnRDNig6Yi6HzYMRUoAj0kzRxLFke7ASg8mjWNLjP7CZCA== +5.0.0-qa-69-30 [Build: 1649229901],Windows,jsY5tIebotP8ZhB1ZCCd3GYhbP/P2RnhObM2VQEElO/5mMOgnvofcDkvhWbPDKbhvq0cIXBjix4PzR2nrO8WDg== +5.0.0-beta69-rc8 [Build: 1650464356],Windows,bBzPQVPQTxKvaRyAT05saGpau2J4yDZ+YD6fEaPSuwGllmGqXm6i9DM0WihlZsc1utRuTotgPyPE8wRXm9dkCQ== +5.0.0-beta69-rc8 [Build: 1650474918],Linux,NokeLRYpWfaOqddwSter/EQ7Q6rzByReNAOIeapvIxmQZvtqKUlA4NNLerGaN91hyX/X+zVhOX6Eai0aTRX+DA== +5.0.0-beta69-rc8 [Build: 1650474918],macOS,r4pznM4Mn9nHYbaNz0Ogmg0V868DmLr608lxehO16noWx+Xe/7yl7nAeAmVJ7NWr7si3B0nwSTofpCcW5cW5AQ== +5.0.0-beta69 [Build: 1651157621],Linux,Hte2iR5GHhNzFg/i7sZ6ERsYeJMy9wxO7AqDP9jb95XKTwEku3QJMkQHUH+2o7oV/wktCYrEmfIFZ0rEwxy0CQ== +5.0.0-beta69 [Build: 1651157621],Windows,Pwxtu+IgA90au8FGqOrRKWgACB/LZRaUrB5sLVHyG063GlJRlD4eHv9tJuojYqAppJJ7cMZW/br/FAXZNiNJDQ== +5.0.0-beta69 [Build: 1651486956],Linux,KlhsXgQKcjUalgrpqepGAjFdT95gjzPmV/SRDFn2qf/I/YcEw62GMNv/BxjkJ48gzIhgKxOtghWJKmzbuqMSCw== +5.0.0-beta69 [Build: 1651486956],macOS,Z4zx1kgCpeoOUM2OYW507UacXR2qU5dHjtJz3W/KZdB4B401MloZc3jKsU8Bc+L0NHkqxZBT3/3xWaleOZiODQ== +5.0.0-beta69 [Build: 1651486956],Windows,aPVvR6zqJNAuTtOa+t8OmUOljU9GwX2SovmNyzvbJV+tMbZP27mHoBSyl7ejRly9E+2QW68pBejlKYjZBMXRDQ== +5.0.0-qa-69-34 [Build: 1651687542],Windows,wxe9CeISam7/fSMQKO/zwzxXyGAvZ4tCTrZSY7rrkqJRjIclDrqFMjIFy6BQfRF7LxxMWstp+LLglMYOd3Y0BA== +5.0.0-beta70-rc2 [Build: 1651730595],Linux,ybhQnvk252kC2QPmGG8BqBfEU98t/nlyCIbN/HnAPbM4EpacsZLz3ouiwpBMa1/xfox8BMbFVW4XJQ83lQryAw== +5.0.0-t-2915-7 [Build: 1652106526],Windows,NuSMkmw5YsKd8CKKQkoXnc99UDgvZCWuSXNp/IE3+8tyrZ3t8wur4jqUfnBRx3x5gzuFDp9sGOfryJVrWTmDCg== +5.0.0-qa-70-1 [Build: 1652113760],Windows,tgaxJYO8MasDp8oq/vRZ3pMDEYMejSzpOA3nt/8+BViY5XyrcwPOppheuKFv5Me+3IHtWL1ssu9CZoufB0auDQ== +5.0.0-beta70-rc3 [Build: 1652281502],Linux,YRJLYVeUXVtz5bvcCALhEqRI4LZtk9+chwJLIhXhy5oojQiR1gqT8KaOVa5oN7ugJRBHPx73hh6hplwnLtEMDQ== +5.0.0-beta70-rc3 [Build: 1652281502],Windows,mI7gWzwqSXQ4RKQE/KxsnhYTBhCVVQ8r4c3ApE5naXa232IsFH5hPHAdQrekexULRQ4Qn3Dh0pxbXVheIb/7DQ== +5.0.0-beta70-rc4 [Build: 1652448464],Linux,8G4ARIsaABohBur+uvAXxA1WtuaiKE7kCF7Os946xAiGou99vykuzDx9lEAh/FHtD2QLTHj2BMbpATiLGXy0AA== +5.0.0-beta70-rc4 [Build: 1652448464],Windows,JSogOYppjLZmIzz4FRt2eBciuZaYdS/LdoUsq2KvF4D3sFByBC8QdHpuEqJPmTKwCgleWPY2fCkPrCLVCliVAA== +5.0.0-qa-70-2 [Build: 1652873884],Windows,nmWG+1gGxxoCku43Bzm5M0h7pcg9IlZNChTjq+mRVmdcQXAZ2+tKUSncP40qiGyKlJMWPUwDbB59AEdb6x3fDg== +5.0.0-beta70-rc5 [Build: 1653042652],Windows,hrPP8RAT3TtakXdRpu+OpvlJqxMg3O/xjeAC7f0aYvumQCQm3CztZ8fbAmTyxZob2TSKzbVZvPIcDlpc9GN1AA== +5.0.0-beta70-rc6 [Build: 1653467861],Linux,7qYi15DersnRo9GTgqVyhGhvHsGOkBuHYWlHIKJ5WBSHlwx2xve3GrKazde+ioJgSOv47RtxU5g6xQYfVqZOBw== +5.0.0-beta70-rc6 [Build: 1653467861],Windows,wk0OOY+kxOsgsTAbMUtcXU80quM3Zq2CyhTQqww0c9xzZx8jHr+8A93DRyDp/JVO+vhqpvvyaiIWAhsT9VJ6Cw== +3.6.0 [Build: 1654006450],Windows,t7q7tpbKMrsrP1iK+FWDRXAPozSTuKipEH9eRqzcAezF1aLTfh08YMhw8RHOZHaCCC3n7qxtEhzXP1cwS6UbAg== +5.0.0-beta70-rc7 [Build: 1654093906],Linux,3AIq0BeGphKoauDyphnBY3HkIa7Si02lf+dsTSFh1lGBiUxUoPcbmkDDFQ0ODyNc99YHwNkUZMhtpXr/g+WBCA== +5.0.0-beta70-rc7 [Build: 1654093906],Windows,ZP9eAW6S8zldlCaIO5EF89Efb91dUMVQs1VLfcOZkfMoifuCz4zCqNR9kEfEzTTniik2CapTK3klbgZCnJ9RDQ== +3.6.0 [Build: 1654160172],macOS,s/wew7fOQzeywZuGOlDfV81SZBV20Z5o/8MoHfYDyaA7d22NXxn1Nb5VMPbiJVxcJxNBuJaMP2BvZEed543cAg== +3.6.0 [Build: 1654160172],Windows,hWniX9AkswRWML0/YinmyDFFoSLc78sn85HTjgZQh8764NhKIc4lKTfsSpyVov9VSb9SE/Yjf9WA0N2Q5x/oAQ== +5.0.0-beta70 [Build: 1654676785],Linux,n43ssyQtR7el6jnlpNEazxzOyZ44M6RkCSehiTFUFh95ie/XXDFBEw7uDsyamktGqNFGdt1IGJ4sy5S++vMsBQ== +5.0.0-beta70 [Build: 1654676785],macOS,K0h0JufWHcKF8a6b725AyV1YXJIOqbvW5JSHaQdxxcgxEsNhQaVCnJiQCcp7TGDTvgIgV876z3dLIk8xfG0OCA== +5.0.0-beta70 [Build: 1654676785],Windows,/KFF7obhEgt2aJbZOCUiR824u81lUPlELT1CY32GJwwjap0RTu6LezXfejDdM8nJoUrDYQmXMu+dBVshNLulAQ== +5.0.0-qa-2913-2 [Build: 1655205340],Linux,N6AztmwqY4uAU72SYYo+AQKMktUPLNwzetFmBsgMbNu0K1yBc+XdKtGpPk2nM6NW42GY+Zf5UTl3e9JTTNqkCw== +5.0.0-qa-2913-2 [Build: 1655205340],Windows,sVMWX0mvYy53XOm3APlfxWE+wSDxBie3UeiurJo0SWUrPEV5gOn03d0ZD0OqNPcwIzCKOC2pxQ+rTQ91OCWrAA== +5.0.0-qa-2913-3 [Build: 1655733884],Windows,rLEgbE1A7AZAjdgoEkQSkEAcogHJnnz0TigqPPQ6mwAIHKpbJIIpaIKc0hyVn7ELl6B58W8XQ0/T00gt6lg3DQ== +5.0.0-beta71-rc1 [Build: 1655990880],Windows,+fye+X6BDMa3nOA90wBTAqZQFy0O1wIGu1/cpGM5+iyFhLS0JYUk9xu3RlXviShDVMazH2JZ0BJ0eDcobT5tCg== +5.0.0-beta71-rc2 [Build: 1656340141],Linux,gKBdAhcdB/S/cXy/oGXWdTvxjubFr+hadQ3ONE6XVp6dMzWNMLP4MgTOBIxGu5TbEMlSeUHHdZWHrpr2CUD0Bg== +5.0.0-beta71-rc2 [Build: 1656340141],Windows,C2Wq594czOp76S/4Pc4mtfEX8o862BJmMkmlSMe+Tco7xgykVcLyblHrE3kp4qeYC+71Hr2q3/Og5C9YdEBNBQ== +5.0.0-qa-71-1 [Build: 1656589081],Windows,mKtr9xGv8lQRCJFt8+TKF3sWtlN6uvkGYXepfiGfk5I9TZQsQqrmJ3Ji1xB/BSBVqJoRAQR7fN8uflwKPiLKDA== +5.0.0-qa-71-2 [Build: 1657105351],Windows,DxobPbJpTnYap0LcyOL3+XvYi0ji1715HukXtOn/OUSL4lIyYUh8bhNNrs1adxe12+B8gnb//YjHBNNMmOxeAg== +5.0.0-beta71-rc3 [Build: 1657116184],Windows,D2rmZyzrtXmDDFoMsmSMtLwZp5GjHKsr5E0DAmery/c6THt3qUgq+Ft25Yd3J5BchiHFXW0b/IjYqxPZn4vzDQ== +5.0.0-beta71-rc4 [Build: 1657196441],Linux,dJz/qSD5sUDoZRZhsAN9XeqVPIcnq8i6rM0wwfFFrMc48fN13j+sMptaFh2TonzDo/S9/2UAytN6UUDrF5nxAw== +5.0.0-beta71-rc4 [Build: 1657196441],Windows,N1UhStcYNBaiPlFb1DvBha6wCFx9SdCWnXdh2ZMRc9WYzKFHXVu59GUn4IxAAH1M67dVwIYRJQpefDsas3rOCw== +5.0.0-qa-71-3 [Build: 1657550670],Windows,LlG39Ix9oFdfIjrjw40un1b/k4rYag0XT0yi7Lp5AQxQ/WqJCiPut9oO8HZZ1Xxoq/XJJywfnjwxKQOpN2bIDw== +5.0.0-beta71-rc6 [Build: 1657710601],Linux,h7en9dun2t8UOPN3jRRJlf4qLI6Lj2xr4UhqZdIs+H9QqD4Ox9C4Iwl0kjgldi4GV1AbuwXi5Fkfe72AwHP3CQ== +5.0.0-beta71-rc6 [Build: 1657710601],Windows,Fo4k9MsMV7HQkoUxNDk9jCd7cKEmFXCj0bS83yij0Q7IyBRvcg2PU1bpL6YPxduJ5ssCOjS6AdB4h9XS3cdBCw== +5.0.0-tra-09 [Build: 1657880771],Windows,7tCcJLRtLuVGl8SVAdwpsqX5c9k+cNuQsuAjXTcvk/DVfITmZZet7mSh99qb75T8yZnbcfZOiyd8KW23BEXtBg== +5.0.0-beta71-rc7 [Build: 1658908364],Linux,1DxbHsONSNvnCT5VHmwjx1r7+E6WkbNdoJHQK+9Yo9hLviUbJ1SyGk1okkYc45y5rYUOls5/9A0yLhmn87X4Dw== +5.0.0-beta71-rc7 [Build: 1658908364],macOS,lqXrUQqxwOTLO+hAH0DoMiOKJtDGE/oO4p7dkWudsZx+VNpepuRMLzTff6RA2XAqGqd+McHK90ohBDW77ZUYCw== +5.0.0-qa-71-4 [Build: 1659089293],Windows,kmmMWX1liFabpUSxVFnt9FcWylRrqJmEQmkaQ/Fv6EB4vak5Y9ld2gkoqpp4ahWSf4+OLQ0YE0/sLO71yIekAQ== +5.0.0-qa-71-5 [Build: 1659598962],Windows,6/S2eqmQq+4D6OcUY/FqbPo++n1aM4NU6NUJhe26v3IIYXU0igeF22Qw8TgxwXufeRQjR+F/LoX5Q8X+6VaVDQ== +5.0.0-qa-71-6 [Build: 1659957641],Windows,hdcRpNOH7DTDDVINjARSm8dpsp5UlK/YmaTzHPZIEXZcrf6qiJeEvW/5vrlGg54GXjUmASNFV3MAVXLWFYupDQ== +5.0.0-qa-71-7 [Build: 1661262442],Windows,L9risxlPhXSqSx8wFpUZz+e+YHA+AEN0n5EPebpjF18hYiGJGUlirLBbbF5QP/URzZD37/3I5KnR0uNw1JhCAQ== +5.0.0-beta71-rc9 [Build: 1661354034],Windows,1PPbMKaszRT2LZOOZJeyiomDd+P6j45NhycdYdBo1AW+1xOQYC4ZG4nTUSprOsAuIjxjSWf4Cb3iVFolMlK4Bg== +5.0.0-qa-3231-7 [Build: 1661783707],Windows,c/OT4xGrILSDLZkndPPdOp65ME/YRJREHRlqySctGfM4f/1T12dNZ0ESjCAAMwN3F3+8/GhpgAulW39R2tO2Dw== +5.0.0-beta71-rc12 [Build: 1661967524],Windows,BoSYWcyXQT0Ry2hfU1wXpGyEie9ZGFNbDy8jPk9Mv0wgs+IPQNx5HtHeFjE4dtAKth04fgJdejDXVI7GZU8dAA== +5.0.0-beta71-rc13 [Build: 1662123474],Linux,rEk3lv0SxO824CyQYSAzIKaR6GxWk251J2NytRRL4pUFagb5UcKsznyhPV0qO2Vn8JdfdU5zMfTX2e3MxDkFBw== +5.0.0-beta71-rc13 [Build: 1662123474],macOS,VkCcAk5+kRgY31T3BlX5fRo68isELG+RyQEO8ZZSh1SBhbmY9RTVxHSQZ4mODJKTsn3qNCSaCWKpVXBdd1+JAw== +5.0.0-beta71-rc13 [Build: 1662123474],Windows,zynXO8tH7q0COrhZJZD//yA223JzNu6nPnN/rt9YwI9Jq2QUNSaDzE6gHJMTv4X7vHsab+Z3g0VqUPIPTyINBQ== +3.6.0 [Build: 1662544077],Linux,9j6NSQpYSE0imFRgcJJKxUBc35bofwSZze00ftKzNspjh63/B899VbJ+zASN4IUm6GK13vNLiOkRyz8SyoEECw== +3.6.0 [Build: 1662544077],Windows,qSw1K3cyE/P3KDtGLB8OHU387sdFN3Ps2ztPfkPAZx/44/uaYl4Zh5qxuQWmOza/KbyefWBkJPxMjN9z2zjCCQ== +6.0 [Build: 1662544077],Windows3.,qSw1K3cyE/P3KDtGLB8OHU387sdFN3Ps2ztPfkPAZx/44/uaYl4Zh5qxuQWmOza/KbyefWBkJPxMjN9z2zjCCQ== +5.0.0-qa-3305-rc13 [Build: 1662565498],Windows,HCuDHsiQvNAn9tNHi8Ws3m06EQcChO3zh0+nzWWhpOaog/QD4PECVR/KKivIh3FTXpsgUzMgRwoZYlQNKcpoCQ== +5.0.0-qa-71-8 [Build: 1662994626],Windows,sYcKDUwhl8ZfrgyU7Xw0yJKV86RXvjnIfLrTQammSnqYCf72Hg1GnVBdWEOURngerrqF7WBW0frUpkYi6d5OCw== +5.0.0-beta71-rc14 [Build: 1663228073],Linux,4HTdstOwcwrKLIokg4SVrMkRtNLj35qfVfSryRYXU6YKg/fIQkvDw7LWVBfxSfdh42k609KuIA8ElXCtc91cCA== +5.0.0-beta71-rc14 [Build: 1663228073],Windows,vWB3J+ostQ8z6ydFxCOe2vp32jgGYpq38asWbXe7gLvPQaNx9gQrc/dPezrauZoUv+7SyAWnuqyQncAb7nnQBw== +5.0.0-qa-pre-crypto-fixes [Build: 1663230086],Windows,CIkiiGfRaghePf9DU3YkDA5gdS4YqcIz/74nNwZ6ic8q+1FxN4R3XYwDnAL39F6S1FAbVM1ulbGgazaMAIGcCg== +5.0.0-qa-crypto-fixes-1 [Build: 1663662700],Windows,HlXCMwcwTIdsnM7xHi9mnVvaru+8QII8ZmhWhGZSuV/hVeDL9BO+/wgdtqp7d9Ql4EyN0AYLOhMBbC0kWQLsDA== +5.0.0-qa-crypto-test-on-rc14-2 [Build: 1663768885],Windows,WxA1UVobQ6diOypmuEYoBZk6wOvfSiPM0/0wZ1dno4LWz8Y9qFu1Y1s4VhleGCVpTHmwNZvaPAxa/GHOSFmPBQ== +5.0.0-ui-polishing-11 [Build: 1664554487],Windows,ClAwrssS0bu5TJrLDm2s+g4TgA77Dmr85W+nhoJq6sLg6aZ2KRB6n33KD3NTKw2lUL1T8xOdEmILdv9I8+S9AQ== +5.0.0-qa-crypto-fixes-3 [Build: 1666096977],Windows,h7dOdFSWU2EZA22ZRtDOl/FxKmMPOAeYlzmcqJG9EwvWZHwpWyFshxWWygCtNAOTECxa5+qbwbgCUSFalBvUBg== +5.0.0-qa-71-9 [Build: 1666179837],Windows,XF9j3k9qcKCXkcBpKek8toKZMBNG3gCj983pca9mT2AS8c615qvRkRIImnSnQQAq4s1EYzLljcnFEMkzcxnVBw== +5.0.0-qa-71-10 [Build: 1666256439],Windows,MvDLE/Sr1L8Pa+y+eHEye5hsE9dIdeWDpZnjXwv7lNE1L10NRAhJHTizhErqU4XyOoSqF/O/6Akss1FSpVTGDA== +5.0.0-qa-71-12 [Build: 1666360320],Windows,KgnXG1mnZ507h8mkOPmIXHsSIowFJMhPm/hdykmd8tSUfp19csom/yWXT4QsnsKUjfjtLXBCjr1murCQgskUAA== +5.0.0-beta71-rc15 [Build: 1666706353],Linux,NAGcBwzMD/GF1Gkyxi5LvDcQIe9wY2ZKMMXVjGEy1meRAY6nyzgcavGVOnO9dxOVgd1bqfllj6HzuWXMTKMCAg== +5.0.0-beta71-rc15 [Build: 1666706353],Windows,UhMZLawOeXuCky3TJPgLHXIPk3iTIR097hwl6755oQhslTUeTtLjZ/GJPowq7RjnJt0zAvOjWSJwxSBhZMNTCA== +3.6.0 [Build: 1666781655],Linux,PdBDIrgplpy9//chwhIRbrLyiQarUll/uEh0xdCcvrLHjY2LG+B/N/RpDJfSZkrXoojRHyjcTPBV47/HXc65Cg== +3.6.0 [Build: 1666781655],macOS,0GQU2HS1HYA14STZx829IzPug8yXuWL9O89x+WSWvJTBhNovmSk+G8v4nzXpfz+B85tBrCdhBSFIZW2Meo6FDg== +3.6.0 [Build: 1666781655],Windows,cKMK6yn54MkK6J46AUfQyuHVij9TYGyOGgWeJYNPBMUmvv5Qr9GUxoeSnNBHTCqV89Et7v01H7Kzie4+tNgsDQ== +5.0.0-qa-3230-1 [Build: 1667372765],Windows,lXuPP3Y0x5qjfNL7Yp8BeGImy7oS95yEmalinun3Yxub7JX4E8ru1xU8HAW8/xVKhYzlOeVrYEwvV4bZwh/HBA== +5.0.0-qa-71-15 [Build: 1667384582],Windows,wlf/D1ISErk9dDTYuhFdOPI5Tv9snRg01RFoFmvd0v1m49HF89HR8DpsM02zOT6M1g3iC5afB7Y1QgEpL1U8DQ== +5.0.0-qa-3230-2 [Build: 1667811609],Windows,QdlYsyxyqIyE6wIXGOCKxjt6IeMXGgtAGBzU8CRZwf/+R8Xbda5jIfrcV87uxinWpFD3Fgx78zgDdRSDOfMPAg== +3.6.0 [Build: 1667819930],Android,DMxIGKedSqo66DGSTd/vCa4bP0QQPP5TYXQcjML9KARTXD9cUmsSzWVSuZN5L4wQQRDcKJ2w9QWxHZP1KQrRCw== +5.0.0-qa-71-17 [Build: 1667845499],Windows,Tp1dTr/0K+XDkRIHTsnROsZc1n3viE0eWS14E39VVcBs51o+1jZtpspWWvTbcCEWmRHx53CPzCRIw+uE1jmjAQ== +5.0.0-qa-71-18 [Build: 1668000845],Windows,WUvAlTTuoTXCFa/st2hB0dc3hKjuIP5EMrTGrtMRUXdSIX2P3aER5AcTyOf3p2BLmoUyNPXUT619x/PlFoB7Cg== +5.0.0-qa-71-19 [Build: 1668103173],Windows,ehpTF8nUjAKywymSuCubQs21DDqyuJugOXuv9dtWSxATiGZ53EzuUkj2Wj4hiiWScEv2VZ5btjr4YSui3DI+Cg== +5.0.0-qa-71-21 [Build: 1668448738],Windows,VlC4gvRTuUkY9H9QktlbLg8qPVmX2ibrrV5Xtle83CQNUZnAj119TCgTPDhE147ZdN1fLO7GrPRNgSfeE5+2Aw== +5.0.0-qa-71-24 [Build: 1668688049],Windows,AqJemaMYTMwn76j+AG5DkGXfmb79ytLdH5tmRpMTkMQ41s4vjr2j81LrYojevsTc8elodUT+pW3LicVJ5/yHAg== +5.0.0-beta71-rc16 [Build: 1668705307],Linux,S8QjXs9J1riVIW/eMtHE5tjV+iHgWZzB2ts7G/K21KEdlsjEk2TR8FTd+C2ouj64loIwhzl/Rilu26ewqC1/DQ== +5.0.0-beta71-rc16 [Build: 1668705307],Windows,j661q6B0F7v1EWt3fnr5rkBaSgP3v1LZtKOfhSsbnNz0E5+MuoDPS71GP89uWdf5g/rvwh8gXTNRqgt64+EzBA== +5.0.0-qa-71-26 [Build: 1669036474],Windows,akylWlFzsOJVvpbNZG0AaDKN7zYfykkto7ZI08ws8MmecZgDidpndxPcfp8/3My0AglFPuRKakSrONWXjo8/Dw== +5.0.0-qa-71-29 [Build: 1669300286],Windows,0PJ3NnIAyxuRQJuO7iHGOysZDEQn9Vf1S5LHyfRQLbbAiiwcnU5RQNtyu5eaWsFOfnqGwI97GbWLAysQqqbjDw== +5.0.0-beta71 [Build: 1670237565],Linux,5+PHxwb9AgALL90T6PtIl6H/En+B/x7RuAtwtsVfCLDgKUEcBNAjW4LTzZR/I64STXv5QbHFrUBBh28VgtO9BQ== +5.0.0-beta71 [Build: 1670237565],macOS,FK2fuBMl6iutX7Zb490ged1StULGIUbNA+i9HH6hqVm2RdmuLQ27q0SzI2i3n2lVh9pP7SZBgItxWcYNAp9IAg== +5.0.0-beta71 [Build: 1670237565],Windows,AGYCEceJGMGnWX3PkCUS4Kaso8LyYZNt9iALUTVg/11505ulqPBlQPygsG6X399SF2FD6jCR4bCOxSTzLlKDDA== +5.0.0-beta72 [Build: 1671465207],Linux,uI8R806y9u77z78GILvKmJB+f3ZXP+by073xKtIJCmNJKXFTTlHqRADAuGEUWbqI9+NaDtSlFHywb5VVxEYcAA== +5.0.0-beta72-rc1 [Build: 1671465207],Windows,wCy5wBohgq/a1VU630R4Vm7XjMincMH4gwFMxZlejhexDhq1jx+D/7fw2LOroNib7R9nURSHbKj9prZG8AtKDQ== +5.0.0-beta72 [Build: 1671465207],Windows,P7cFw4WFvfGRtGtfGUwM5KpF1FK1M3B1aK91ZX3wwWBht8J1fp0Spd11HhtgzXNrHD88yXbBdLqxpxgBxyEHCA== +5.0.0-qa-73-3 [Build: 1673952226],Windows,X1dCHqr0/4KQJe5vRa4F+TG6yFqJls4Pp+x5mAuvKSHMKQ+6bIa4jNVNhlBSMGoxaOQwhObFzHqMb49C4YKLBg== +5.0.0-qa-73-11 [Build: 1676933790],Windows,xSD6HeHTdSi2lt1aMKz+QiaFjaLk8++hczMJvatTLlqIn8Gm6y8kmu43rwdTyanU0H5EQW53mMUcIlV+bPCbAg== +5.0.0-beta73-rc1 [Build: 1677076356],Linux,tTaatH5xdPJ/ObMlbbSDBiov2+kdtlEVw8MF3K4xFLrug6lerU6Xdqalcsa9sAQqhOogDaifRAVpD6oEes7rCg== +5.0.0-beta73-rc1 [Build: 1677076356],Windows,WndD7PSfy+gl/haCDKGrD3lbam0i4l4AFpbFVc5GwVeteR7nzpjE99SvDn0CMMAYk3vYBKjMP+nsAWiylbYJAA== +5.0.0-beta73-rc3 [Build: 1677756122],Linux,3ugSo0Eq1aEVI4LG3+E3CmtvLBxv6qH5hYZLZu17uJC05okFcmdDRRBG3Tj5jKEy2v6y1YOsLMwArDp1xZfTDg== +5.0.0-beta73-rc3 [Build: 1677756122],Windows,A+TukrQZwCKghG/xlGk5Bo8wi0WAKNK/SPfOMZNeCC3G0ZDN1h3/lcbiGtuSpBu5tYd5n+/Q0Pjh3WjvYOEVDA== +5.0.0-beta73 [Build: 1679397420],Linux,7b8MXzq0z59NIrR88V3l/oCfUaMfpNAtosNBj20zWC1fh0vVvf/O+tyG6XiiJfQyEHc+OJ1gbx/z7roErekWBA== +5.0.0-beta73 [Build: 1679397420],OS X,weeF0ZNGrlUvB8vIQCvfLqcNV53aWJqPaqwo+hACJoomwdqZ7n1+VW1RxSedMy/ii/GtgyTbUiCojhH2MCAoAA== +5.0.0-beta73 [Build: 1679397420],Windows,EWhqEP8V36cleD0Cl7AQnG6M82KMDwQbiEObDmcDC5AAF7l13BbWje0j4yNivIOnAwkvneUmRe8RK0LLP9CHBA== +5.0.0-qa-74-1 [Build: 1679398750],Windows,A87gwqv6WCQAVkKmLJo11jss00zFyC4Yh3gTRnAng5vOxGHB8zclsJTizu12iT0Mwpa4sYTHPIS2f+zqEcCpCQ== +5.0.0-qa-74-2 [Build: 1679472836],Windows,AXcwrSeKswE5Yd/sQRd2bqH6NqnEba5l2nWoMHL/3LvZRCAf4QElRuHtLvNAZbntlEQ8/GOe+g+8ejCn83rAAQ== +5.0.0-qa-74-3 [Build: 1679578894],Windows,25zH3oeWqo0eYSWiUWxFHNlK3NK5qZPUVH8yEEaXHquGF6xoZPB9QWbjfkEaLB607j3Us1mviH7/Q47/3GpvDg== +3.?.? [Build: 5680278000],Android,AWb948BY32Z7bpIyoAlQguSmxOGcmjESPceQe1DpW5IZ4+AW1KfTk2VUIYNfUPsxReDJMCtlhVKslzhR2lf0AA== +3.?.? [Build: 5680278000],iOS,XrAf+Buq6Eb0ehEW/niFp06YX+nGGOS0Ke4MoUBzn+cX9q6G5C0A/d5XtgcNMe8r9jJgV/adIYVpsGS3pVlSAA== +3.?.? [Build: 5680278000],Linux,Hjd+N58Gv3ENhoKmGYy2bNRBsNNgm5kpiaQWxOj5HN2DXttG6REjymSwJtpJ8muC2gSwRuZi0R+8Laan5ts5CQ== +3.?.? [Build: 5680278000],OS X,SttEnjoWE8jqIM6BOHSfiZP9DGjW0EP/ajU4bdKqgGMV4aYq/kzwVA9gxbmdIzV4lbaokvXBqrRjfBHrTVh8Cg== +3.?.? [Build: 5680278000],Windows,DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg== +3.?.? [Build: 5680278000] DEBUG,Windows,FaA10gndI44f19ZThYJX2OSM8ESrx9/vJ2uY+rON4enzzPsPR9kiPhsUXtMcC5szzTu6F/vLCiNNEhCr70CKCQ== \ No newline at end of file diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/declarations/ts3protocol.md b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/ts3protocol.md new file mode 100644 index 0000000..71c774f --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/declarations/ts3protocol.md @@ -0,0 +1,864 @@ +TS3 PROTOCOL PAPER +================== + +# 0. Naming Conventions +- `(Client -> Server)` denotes packets from client to server. +- `(Client <- Server)` denotes packets from server to client. +- All datatypes are sent in network order (Big Endian) unless otherwise +specified. +- Datatypes are declared with a prefixing `u` or `i` for unsigned and signed +and a number for the bitlength. +For example `u8` would be the C equivalent of `uint8` or `unsigned char` +- Arrays are represented by the underlying datatype in square brackets, +additionally if the length is known it is added in the brackets, separated by +a semicolon. Eg: `[u8]`, `[i32; 16]` +- Array ranges (parts of an array) are specified in square brackets with the +included lower bound, two points (`..`) and the excluded upper bound. Eg: `[0..10]` + + +# 1. Low-Level Packets +## 1.1 Packet structure +- The packets are build in a fixed scheme, +though have differences depending in which direction. +- Every column here represents 1 byte. +- The entire packet size must be at max 500 bytes. + +### 1.1.1 (Client -> Server) + +--+--+--+--+--+--+--+--+--+--+--+--+--+---------//----------+ + | MAC | PId | CId |PT| Data | + +--+--+--+--+--+--+--+--+--+--+--+--+--+---------//----------+ + | \ Meta | + \ Header / + +| Name | Size | Datatype | Explanation | +|------|-------------|----------|---------------------------------| +| MAC | 8 bytes | [u8] | EAX Message Authentication Code | +| PId | 2 bytes | u16 | Packet Id | +| CId | 2 bytes | u16 | Client Id | +| PT | 1 byte | u8 | Packet Type + Flags | +| Data | ≤487 bytes | [u8] | The packet payload | + +### 1.1.2 (Client <- Server) + +--+--+--+--+--+--+--+--+--+--+--+------------//-------------+ + | MAC | PId |PT| Data | + +--+--+--+--+--+--+--+--+--+--+--+------------//-------------+ + | \ Meta | + \ Header / + +| Name | Size | Datatype | Explanation | +|------|-------------|----------|---------------------------------| +| MAC | 8 bytes | [u8] | EAX Message Authentication Code | +| PId | 2 bytes | u16 | Packet Id | +| PT | 1 byte | u8 | Packet Type + Flags | +| Data | ≤489 bytes | [u8] | The packet payload | + +## 1.2 Packet Types +- `0x00` Voice +- `0x01` VoiceWhisper +- `0x02` Command +- `0x03` CommandLow +- `0x04` Ping +- `0x05` Pong +- `0x06` Ack +- `0x07` AckLow +- `0x08` Init1 + +## 1.3 Packet Type + Flags byte +The final byte then looks like this + + MSB LSB + +--+--+--+--+--+--+--+--+ + |UE|CP|NP|FR| Type | + +--+--+--+--+--+--+--+--+ + +| Name | Size | Hex | Explanation | +|------|-------|------|-----------------| +| UE | 1 bit | 0x80 | Unencrypted | +| CP | 1 bit | 0x40 | Compressed | +| NP | 1 bit | 0x20 | Newprotocol | +| FR | 1 bit | 0x10 | Fragmented | +| Type | 4 bit | 0-8 | The packet type | + +## 1.4 Packet Compression +To reduce packet size, the data can be compressed. +When the data is compressed the `Compressed` flag must be set. +The algorithm "QuickLZ" with Level 1 is used for compression. + +## 1.5 Packet Splitting +When the packet payload exceeds the maximum datablock size the data can be +split up across multiple packets. +The current protocol only allows `Command` and `CommandLow` to be split and/or +compressed. +When splitting occurs, the `Fragmented` flag must be set on the first and +the last packet. +The `Unencrypted` and `Compressed` flag, if set in the original +packet, are only set on the first packet. (Though commands always have to be +encrypted) +The `Newprotocol` flag has to be set on all commands and therefore also has to +be applied on all splitted command packets. +The data can additionally be compressed *before* splitting. + +*Example*: + +The packet to split has the following flags: + + [__|CP|NP|__] Packet Id: 42 + +it must be split into: + + [__|CP|NP|FR] Packet Id: 42 + [__|__|NP|__] Packet Id: 43 + [__|__|NP|FR] Packet Id: 44 + + +## 1.6 Packet Encryption +When a packet is not encrypted the `Unencrypted` flag is set. For encrypted +packets the flag gets cleared. +Packets get encrypted with EAX mode (AES_128_CTR with OMAC). +The en/decryption parameters are generated for each packet as follows + +### 1.6.1 Inputs +| Name | Type | Explanation | +|------|----------|---------------------------------| +| PT | u8 | Packet Type | +| PId | u16 | Packet Id | +| PGId | u32 | Packet GenerationId (see 1.9.2) | +| PD | bool | Packet Direction | +| SIV | [u8; 20] | Shared IV (see 3.2) | + +### 1.6.2 Generation pseudocode +The temporary variable will have a different length depending on the result +from the crypto init handshake. The old protocol SharedIV will be 20 bytes long, +since it is generated with sha1, while the new protocol SharedIV will have +64 bytes, since it is generated with sha512. + + let temporary: [u8; 26] OR [u8; 70] + temporary[0] = 0x30 if (Client <- Server) + 0x31 if (Client -> Server) + temporary[1] = PT + temporary[2..6] = (PGId in network order)[0..4] + if SIV.length == 20 + temporary[6..26] = SIV[0..20] + else + temporary[6..70] = SIV[0..64] + + let keynonce: [u8; 32] + keynonce = sha256(temporary) + + key: [u8; 16] = keynonce[ 0..16] + nonce: [u8; 16] = keynonce[16..32] + key[0] = key[0] xor ((PId & 0xFF00) >> 8) + key[1] = key[1] xor ((PId & 0x00FF) >> 0) + +### 1.6.3 Encryption +The data can now be encrypted with the `key` and `nonce` from (see 1.6.2) as the +EAX key and nonce and the packet `Meta` as defined in (see 1.1) as the EAX +header (sometimes called "Associated Text"). The resulting EAX mac (sometimes +called "Tag") will be stored in the `MAC` field as defined in (see 2.1). + +### 1.6.4 Not encrypted packets +When a packet is not encrypted, no MAC can be generated by EAX. In this case +the SharedMac (see 3.2) will be used instead. + +## 1.7 Packet Stack Wrap-up +This stack is a reference for the execution order of the set data operations. +For incoming packets the stack is executed bot to top, for outgoing packets +top to bot. + + Send Receive + +-----------+ +-----------+ + | Data | | Λ | Data | + +-----------+ | | +-----------+ + | Compress | | | | Decompress| + +-----------+ | | +-----------+ + | Split | | | | Merge | + +-----------+ | | +-----------+ + | Encrypt | V | | Decrypt | + +-----------+ +-----------+ + +## 1.8 Packet Types Data Structures +The following chapter describes the data structure for different packet types. + +### 1.8.1.1 Voice (Client -> Server) + +--+--+--+---------//---------+ + | VId |C | Data | + +--+--+--+---------//---------+ + +| Name | Type | Explanation | +|------|------|-----------------| +| VId | u16 | Voice Packet Id | +| C | u8 | Codec Type | +| Data | var | Voice Data | + +### 1.8.1.2 Voice (Client <- Server) + +--+--+--+--+--+---------//---------+ + | VId | CId |C | Data | + +--+--+--+--+--+---------//---------+ + +| Name | Type | Explanation | +|------|------|-----------------| +| VId | u16 | Voice Packet Id | +| CId | u16 | Talking Client | +| C | u8 | Codec Type | +| Data | var | Voice Data | + +### 1.8.2.1 VoiceWhisper (Client -> Server) + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---------//---------+ + | VId |C |N |M | U* | T* | Data | + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---------//---------+ + +For direct user/channel targeting +The `Newprotocol` Flag must be *unset* + +| Name | Type | Explanation | +|------|-------|---------------------------------------| +| VId | u16 | Voice Packet Id | +| C | u8 | Codec Type | +| N | u8 | Count of ChannelIds to send to | +| M | u8 | Count of ClientIds to send to | +| U | [u64] | Targeted ChannelIds, repeated N times | +| T | [u16] | Targeted ClientIds, repeated M times | +| Data | var | Voice Data | + +OR + + +--+--+--+--+--+--+--+--+--+--+--+--+--+---------//---------+ + | VId |C |TY|TA| U | Data | + +--+--+--+--+--+--+--+--+--+--+--+--+--+---------//---------+ + +For targeting special groups +The `Newprotocol` Flag must be *set* + +| Name | Type | Explanation | +|------|-------|---------------------------------------------------------| +| VId | u16 | Voice Packet Id | +| C | u8 | Codec Type | +| TY | u8 | GroupWhisperType (see below) | +| TA | u8 | GroupWhisperTarget (see below) | +| U | u64 | the targeted channelId or groupId (0 if not applicable) | +| Data | var | Voice Data | + +``` +enum GroupWhisperType : u8 +{ + // Targets all users in the specified server group. + ServerGroup = 0 /* U = servergroup targetId */, + // Targets all users in the specified channel group. + ChannelGroup = 1 /* U = channelgroup targetId */, + // Targets all users with channel commander. + ChannelCommander = 2, /* U = 0 (ignored) */, + // Targets all users on the server. + AllClients = 3, /* U = 0 (ignored) */, +} + +enum GroupWhisperTarget : u8 +{ + AllChannels = 0, + CurrentChannel = 1, + ParentChannel = 2, + AllParentChannel = 3, + ChannelFamily = 4, + CompleteChannelFamily = 5, + Subchannels = 6, +} +``` + +### 1.8.2.2 VoiceWhisper (Client <- Server) + +--+--+--+--+--+---------//---------+ + | VId | CId |C | Data | + +--+--+--+--+--+---------//---------+ + +| Name | Type | Explanation | +|------|------|-----------------| +| VId | u16 | Voice Packet Id | +| CId | u16 | Talking Client | +| C | u8 | Codec Type | +| Data | var | Voice Data | + +### 1.8.3-4 Command and CommandLow +The TeamSpeak3 Query like command string encoded in UTF-8 + +### 1.8.5 Ping +Empty. + +### 1.8.6-8 Pong, Ack and AckLow + +--+--+ + | PId | + +--+--+ + +| Name | Type | Explanation | +|------|------|------------------------------------| +| PId | u16 | The packet id that is acknowledged | + +- In case of `Pong` a matching ping packet id is acknowledged. +- In case of `Ack` or `AckLow` a matching `Command` or `CommandLow` packet id +respectively is acknowledged. + +### 1.8.9 Init1 +(see 2.1)-(see 2.5) + +## 1.9 Packet Ids and Generations +### 1.9.1 Packet Ids +Each packet type and packet direction must be maintained by an own packet id +counter. +This means the client has 9 different packet id counter for outgoing packets. + +For each new packet the counter gets increased by 1. This also applies to +split packets. + +The client must also maintain packet ids for incoming packets in case of +packets arriving out of order. + +All Packet Ids start at 1 unless otherwise specified. + +### 1.9.2 Generations +Packet Ids are stored as u16, this means they range from 0 up to 65535 included. + +When the packet id overflows from 65535 to 0 at a packet, +the generation counter for this packet type gets increased by 1. + +Note that the new generation id immediately applies to the 'overflowing' packet. + +The generation id counter is solely used for encryption (see 1.6). + +## 1.10 Packet Acknowledgement / Packet Loss +In order to reliably send packets over UDP some packet types must get +acknowledged when received (see 1.11). + +The protocol uses selective repeat for lost packets. This means each packet has +its own timeout. Already acknowledged later packets must not be resent. +When a packet times out, the exact same packet should be resent until properly +acknowledged by the server. +If after 30 seconds no resent packet gets acknowledged the connection should be +closed. +Packet resend timeouts should be calculated with an exponential backoff to +prevent network congestion. + +## 1.11 Wrap-up +| Type | Acknowledged (by) | Resend | Encrypted | Splittable | Compressible | +|--------------|-------------------|--------|-----------|------------|--------------| +| Voice | ✗ | ✗ | Optional | ✗ | ✗ | +| VoiceWhisper | ✗ | ✗ | Optional | ✗ | ✗ | +| Command | ✓ (Ack) | ✓ | ✓ | ✓ | ✓ | +| CommandLow | ✓ (AckLow) | ✓ | ✓ | ✓ | ✓ | +| Ping | ✓ (Pong) | ✗ | ✗ | ✗ | ✗ | +| Pong | ✗ | ✗ | ✗ | ✗ | ✗ | +| Ack | ✗ | ✓ | ✓ | ✗ | ✗ | +| AckLow | ✗ | ✓ | ✓ | ✗ | ✗ | +| Init1 | ✓ (next Init1) | ✓ | ✗ | ✗ | ✗ | + +# 2. The (Low-Level) Initiation/Handshake +A connection is started from the client by sending the first handshake +packet. The handshake process consists of 5 different init packets. This +includes the so called RSA puzzle to prevent DOS attacks. + +The packet header values are set as following for all packets here: + +| Parameter | Value | +|-----------|--------------------------------------------------------| +| MAC | [u8]{ 0x54, 0x53, 0x33, 0x49, 0x4E, 0x49, 0x54, 0x31 } | +| key | N/A | +| nonce | N/A | +| Type | Init1 | +| Encrypted | ✗ | +| Packet Id | u16: 101 | +| Client Id | u16: 0 | + +Init packets from the client contain a version field, which is the build +timestamp of the client. This is a unix timestamp subtracted with 1356998400. +The unix timestamp 1461588969 (date 2016-04-25) is encoded as +1461588969 - 1356998400 = 0x063bece9 = { 0x06, 0x3b, 0xec, 0xe9 }. + +## 2.1 Packet 0 (Client -> Server) + 04 bytes : Version of the TeamSpeak client as timestamp + Example: { 0x06, 0x3b, 0xec, 0xe9 } + 01 bytes : Init-packet step number + Const: 0x00 + 04 bytes : Current timestamp in unix format + 04 bytes : Random bytes := [A0] + 08 bytes : Zeros, reserved. + +## 2.2 Packet 1 (Client <- Server) + 01 bytes : Init-packet step number + Const: 0x01 + 16 bytes : Server stuff := [A1] + 04 bytes : The bytes from [A0] in reversed order (not always) := [A0r] + +This packets usually contains the bytes from [A0] in reversed order, except when +connecting from some networks for a yet unknown reason. + +## 2.3 Packet 2 (Client -> Server) + 04 bytes : Version of the TeamSpeak client as timestamp + 01 bytes : Init-packet step number + Const: 0x02 + 16 bytes : The bytes from [A1] + 04 bytes : The bytes from [A0r] + +## 2.4 Packet 3 (Client <- Server) + 01 bytes : Init-packet step number + Const: 0x03 + 64 bytes : 'x', an unsigned BigInteger + 64 bytes : 'n', an unsigned BigInteger + 04 bytes : 'level' a u32 + 100 bytes : Server stuff := [A2] + +Note: +- Sometimes, instead of sending an init with step 3, the server responds with + an init that contains 127 as step number. In that case, the client has to + restart the connection by sending packet 0 again. + +## 2.5 Packet 4 (Client -> Server) + 04 bytes : Version of the TeamSpeak client as timestamp + 01 bytes : Init-packet step number + Const: 0x04 + 64 bytes : the received 'x' + 64 bytes : the received 'n' + 04 bytes : the received 'level' + 100 bytes : The bytes from [A2] + 64 bytes : 'y' which is the result of x ^ (2 ^ level) % n as an unsigned + BigInteger. Padded from the lower side with '0x00' when shorter + than 64 bytes. + Example: { 0x00, 0x00, data ... data} + var bytes : The clientinitiv command data as explained in (see 3.1) + +Note: +- `^` in this context means 'power to' +- To calculate the power of such a high number use a language integrated + function like `ModPow` or similar, when available. + If you don't have this function available you can multiply x iteratively + and apply the modulo operation after each multiplication. + +# 3. The (High-Level) Initiation/Handshake +In this phase the client and server exchange basic information and +agree on/calculate the symmetric AES encryption key with the ECDH +public/private key exchange technique. + +Both the client and the server will need a EC public/private key. This key +is also the identity which the server uses to recognize a user again. +The curve used is 'prime256v1'. + +All high level packets specified in this chapter are sent as `Command` Type +packets as explained in (see 2.8.3). Additionally the `Newprotocol` flag +(see 2.3) must be set on all `Command`, `CommandLow` and `Init1` packets. + +All commands are specified in the `Messages.txt` file. + +The packet header/encryption values for (see 3.1) and (see 3.2) are as following: + +| Parameter | Value | +|-----------|------------------------------------------------------------------------------------------------------| +| MAC | (Generated by EAX) | +| key | [u8]{0x63, 0x3A, 0x5C, 0x77, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x73, 0x5C, 0x73, 0x79, 0x73, 0x74, 0x65} | +| nonce | [u8]{0x6D, 0x5C, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6C, 0x6C, 0x33, 0x32, 0x2E, 0x63, 0x70, 0x6C} | +| Type | Command | +| Encrypted | ✓ | +| Packet Id | u16: 0 | +| Client Id | u16: 0 | + +The acknowledgement packets use the same parameters as the commands, except with +the Type `Ack`. + +_(Maybe add a #3.0 Prelude for required cryptographic values, if yes move the +omega ASN.1 encoding here)_ + +## 3.1 clientinitiv (Client -> Server) +The first packet is sent (Client -> Server) although this is only sent for +legacy reasons since newer servers (at least 3.0.13.0?) use the data part +embedded in the last `Init1` packet from the low-level handshake (see 2.5). + + clientinitiv alpha={alpha} omega={omega} ot={ot} ip={ip} + +- `alpha` is set to `base64(random[u8; 10])` + which are 10 random bytes for entropy. +- `omega` is set to `base64(publicKey[u8])` + omega is an ASN.1-DER encoded public key from the ECDH parameters as following: + + | Type | Value | Explanation | + |------------|----------------|-------------------------------------------| + | BIT STRING | 1bit, Value: 0 | LibTomCrypt uses 0 for a public key | + | INTEGER | 32 | The LibTomCrypt used keysize | + | INTEGER | publicKey.x | The affine X-Coordinate of the public key | + | INTEGER | publicKey.y | The affine Y-Coordinate of the public key | + +- `ot` should always be `1` +- `ip` should be set to the final resolved ip address of the server you are + actually connecting to. + +## 3.2 initivexpand/initivexpand2 (Client <- Server) +Depending on the server version the server will send a different init request. +- TS3 server <3.1 will send `initivexpand`. Continue with (see 3.2.1) +- TS3 server ≥3.1 will send `initivexpand2`. Continue with (see 3.2.2) + +If you want to support both protocol standards you don't need to check/know the +server version. The client just has to act accordingly depending on which +packet the server sends. + +### 3.2.1 initivexpand (Client <- Server) +The server responds with this command. + + initivexpand alpha={alpha} beta={beta} omega={omega} + +- `alpha` must have the same value as sent to the server in the previous step. +- `beta` is set to `base64(random[u8; 10])` + by the server. +- `omega` is set to `base64(publicKey[u8])` + with the public key from the server, encoded same as in (see 3.1) + +With this information the client now must calculate the shared secret. + + let sharedSecret: ECPoint + let x: [u8] + let sharedData: [u8; 32] + let SharedIV: [u8; 20] + let SharedMac: [u8; 8] + let ECDH(A, B) := (A * B).Normalize + + sharedSecret = ECDH(serverPublicKey, ownPrivateKey) + x = sharedSecret.x.AsByteArray() + if x.length < 32 + sharedData[ 0..(32-x.length)] = [0..0] + sharedData[(32-x.length)..32] = x[0..x.length] + elseif x.length == 32 + sharedData[0..32] = x[0..32] + elseif x.length > 32 + sharedData[0..32] = x[(x.length-32)..x.length] + SharedIV = sha1(sharedData) + SharedIV[0..10] = SharedIV[0..10] xor alpha.decode64() + SharedIV[10..20] = SharedIV[10..20] xor beta.decode64() + SharedMac[0..8] = sha1(SharedIV)[0..8] + +### 3.2.2 initivexpand2 (Client <- Server) +The server responds with this command. + + initivexpand2 l={l} beta={beta} omega={omega} ot={ot} proof={proof} tvd={tvd} + +- `l` the server license (see 3.2.2.2) +- `beta` is set to `base64(random[u8; 54])` + by the server. +- `omega` is a `base64(publicKey[u8])` + with the public key from the server, encoded same as in (see 3.1) +- `ot` should always be `1` +- `proof` is a `base64(ecdh_sign(l))` +- `tvd` (base64, unknown; only set on servers with a license) + +#### 3.2.2.1 Verify integrity +This step **must** be done to verity the integrity of the connection. + +The `proof` parameter is the sign of the `l` parameter (*not* base64 encoded). +The client can verify the `l` parameter with the public key of the server +which is sent in `omega`. + +Both proofs which are exchanged (the one you received in (see 3.2.2), and the +one sent in (see 3.2.2.5)) use 'prime256v1 with sha256, DER encoded'. +Note that the identity keys from client/server already should be keys +on 'prime256v1' as noted in (see 3). + +#### 3.2.2.2 Parsing the license +The license has a small header continued by a list of blocks. Each block may +vary in length and must be parsed sequentially therefore. + +The license header: + + 01 bytes : License version + Const: 0x01 + +The block base layout: + + 01 bytes : Key type + Const: 0x00 (public key) + 32 bytes : Block public key + 01 bytes : License block type + 04 bytes : Not valid before date + 04 bytes : Not valid after date + var bytes : (Content from the block type) + +There are currently 4 different `License block type`s used. +- `00` Intermediate. + `content`: + ``` + 04 bytes : Unknown + var bytes : A null terminated string, which describes the issuer of this certificate. + ``` +- `01` Website/`03` Code + `content`: + ``` + var bytes : A null terminated string, which describes the issuer of this certificate. + ``` +- `02` TS3 Server + `content`: + ``` + 01 bytes : Server License Type + 04 bytes : Max clients allowed on the server + var bytes : A null terminated string, which describes the issuer of this certificate. + ``` +- `08` TS5 Server + `content`: + ``` + 01 bytes : Server License Type + 01 bytes : Property count + var bytes : Properties, see following description on how each property is encoded + + Per property: + 01 bytes : Length of following data + 01 bytes : Property Id + 01 bytes : Data Type + var bytes : Content depending on data type, see below + ``` + + Data Types: + - `00`: Null-terminated string + - `01`/`03`: 4 byte data + - `02`/`04`: 8 byte data + + Property Id: + - `01` (type `01`): Unknown + - `02` (type `00`): Issuer of the certificate + - `03` (type `01`): Max clients allowed on the server, defaults to 32 if not present +- `32` Ephemeral + `content`: none + +Both dates are stored in BigEndian, when read you must add `0x50e22700` to the +number and import as a unix timestamp. + +Each `Not valid before` and `Not valid after` timespan must be within the range +of the parent license block. + +The license must consist of `2 ≤ count ≤ 8` blocks. +The second to last block must be of type `Server` +and the last block must be of type `Ephemeral`. + +#### 3.2.2.4 Calculating the shared secret +All elliptic curve operations for this step are done on the Curve25519. +You might find more tools looking for Ed25519 but keep in mind that Ed25519 +describes an EdDsa signing/verify operation and is not the curve itself. + +To calculate the shared secret each license block now must be processed +sequentially the following way: + + next_key = public_key * clamp(sha512(block[1..])[0..32]) + parent + +Where: +- `public_key` is the `Block public key` taken from the current license block. + This array must be imported as a compressed Curve25519 EC point. +- `sha512(block[1..])[0..32]` is the sha512 of the current license block. + Note that the first byte (`Key type`) is skipped for the sha calculation. + For the result only the first 32 bytes are used. + This resulting array must be imported as a Curve25519 private key. +- `parent` which is the resulting `next_key` from the previous block. + This is a compressed Curve25519 EC point. +- `clamp(num)` is a function describing `abs(num) mod B` where `B` is the base + point of Curve25519. This function can usually be implemented conveniently + on the number buffer like this: + ``` + let buffer: [u8; 32] + + buffer[0] &= 0xF8 + buffer[31] &= 0x3F + buffer[31] |= 0x40 + ``` + +Since the first block has no predecessor. +A fixed 'root' key is used as `parent`. +This key must be imported as a compressed Curve25519 EC point. + + [u8; 32] {0xcd, 0x0d, 0xe2, 0xae, 0xd4, 0x63, 0x45, 0x50, 0x9a, 0x7e, 0x3c, + 0xfd, 0x8f, 0x68, 0xb3, 0xdc, 0x75, 0x55, 0xb2, 0x9d, 0xcc, 0xec, + 0x73, 0xcd, 0x18, 0x75, 0x0f, 0x99, 0x38, 0x12, 0x40, 0x8a} + +The last `next_key` is now used as the public key from the server +(see pseudocode below). + +The client now has to create a temporary Curve25519 public/private keypair. +We will call them `client_public_key` and `client_private_key`. + +Now the `SharedIV` and `SharedMac` which will be used in the encryption, just as +in the old protocol, can be calculated. + + let SharedIV: [u8; 64] + let SharedMac: [u8; 8] + let sharedData: [u8; 32] + + sharedData = next_key * client_private_key + SharedIV = sha512(sharedData[0..32]) + SharedIV[ 0..10] = SharedIV[ 0..10] xor alpha.decode64() + SharedIV[10..64] = SharedIV[10..64] xor beta.decode64() + SharedMac[0..8] = sha1(SharedIV)[0..8] + +#### 3.2.2.5 clientek (Client -> Server) + + clientek ek={ek} proof={proof} + +- `ek` is `base64(client_public_key)` + which the ephemeral (temporary) key created in (see 3.2.2.4) by the client. + This should obviously be the public key part only. +- `proof` is `base64(client_public_key + beta)` + which is a sign of the client_public_key (the `ek`) concatenated with the + `beta` parameter from the `initivexpand2` command. + The sign must be done with the private key from the identity keypair. + +The normal packet id counting starts with this packet. This means that +`clientek` already has the packet id `1` and the next command will continue +with `2`. + +### 3.2.3 **Notes**: +- Only `SharedIV` and `SharedMac` are needed. The other values can (and should) + be discarded. +- The crypto handshake is now completed. The normal encryption scheme (see 1.6) + is from now on used. +- All `Command`, `CommandLow`, `Ack` and `AckLow` packets must get encrypted. +- `Voice` packets (and `VoiceWhisper` when wanted) should be encrypted when the + channel encryption or server wide encryption flag is set. +- `Ping` and `Pong` must not be encrypted. + +## 3.3 clientinit (Client -> Server) + clientinit client_nickname client_version client_platform client_input_hardware client_output_hardware client_default_channel client_default_channel_password client_server_password client_meta_data client_version_sign client_key_offset client_nickname_phonetic client_default_token hwid + +- `client_nickname` the desired nickname +- `client_version` the client version +- `client_platform` the client platform +- `client_input_hardware` whether an input device is available +- `client_output_hardware` whether an output device is available +- `client_default_channel` the default channel to join. This can be a channel + path or `/` (eg `/1`) for a channel id. +- `client_default_channel_password` the password for the join channel, prepared + the following way `base64(sha1(password))` +- `client_server_password` the password to enter the server, prepared the + following way `base64(sha1(password))` +- `client_meta_data` (can be left empty) +- `client_version_sign` a cryptographic sign to verify the genuinity of the + client +- `client_key_offset` the number offset used to calculate the hashcash (see 4.1) + value of the used identity +- `client_nickname_phonetic` the phonetic nickname for text-to-speech +- `client_default_token` permission token to be used when connecting to a server +- `hwid` hardware identification string + +**Notes**: +- Since client signs are only generated and distributed by TeamSpeak systems, + this the recommended client triple, as it is the reference for this paper + - Version: `3.0.19.3 [Build: 1466672534]` + - Platform: `Windows` + - Sign: `a1OYzvM18mrmfUQBUgxYBxYz2DUU6y5k3/mEL6FurzU0y97Bd1FL7+PRpcHyPkg4R+kKAFZ1nhyzbgkGphDWDg==` +- The `hwid` usually consists of two 32 char strings concatenated with `,` and + looks like `87056c6e1268aaf5055abf8256415e0e,408978b6d98810cc03f0aa16a4c75600` + but even empty strings are accepted. + On windows the hwid seems to be generated from a registry key + (`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId`). + On linux and macOS it seems to derive from the MAC address of the primary + Ethernet/Wifi adapter. +- Parameters which are empty or not used must be declared but left without + value and the `=` character + +## 3.4 initserver (Client <- Server) +The server sends the `initserver` command. + +Note: +- From this point on the client knows his client id, therefore it must be set + in the header of each packet. +- Newer versions of the server send parts of the `clientinit` command in the `initserver` command. + +## 3.5 Further notifications +The server will now send all needed information to display the entire +server properly. Those notifications are in no fixed order, although they + are most of the time sent in the here declared order. + +### 3.5.1 channellist and channellistfinished +The `channellist` notification type will be sent multiple times as needed to +transfer the entire server structure. + +After the last `channellist` notification the server will send +`channellistfinished` + +### 3.5.2 notifycliententerview +The `notifycliententerview` notification will be sent multiple times as needed +for each client currently connected. +This is the same notification as when a new client connects. + +# 4. Further concepts +## 4.1 Hashcash +To prevent client spamming (connecting to a server with many different clients) +the server requires a certain hashcash level on each identity. This level has a +exponentially growing calculation time with increasing level. This ensures that +a user wanting to spam a certain server needs to invest some time into +calculating the required level. + +- The publicKey is a string encoded as in (see 3.1) the omega value. +- The key offset is a u64 number, which gets converted to a string when +concatenated. + +The first step is to calculate a hash as following + + let data: [u8; 20] = sha1(publicKey + keyOffset) + +The level can now be calculated by counting the continuous leading zero bits in +the data array. +The bytes in the array get counted from 0 to 20 and the bits in each byte +from least significant to most significant. + +## 4.2 Uid +To calculate the uid of an identity the public key is required. Therefore you +can only calculate the uid of your own identity and the servers identity you +are connecting to. + +The publicKey is a string encoded as in (see 3.1) the omega value. + +The uid can be calculated as following + + let uid: string = base64(sha1(publicKey)) + +## 4.3 Ping/Pong +The server will regularly send ping packets to check if a client is still alive. +The client must answer them with the according pong packet. + +The client should also send ping packets to the server to check for connection. +They will be answered with according pong packets. + +Sending ping packets from the client side should not be started before the +crypto handshake has been completed (see 3.3) + +## 4.4 Passwords +All passwords when sent are hashed and encoded with `base64(sha1(password))` + +## 4.5 Importing/Deobfuscating Identities from the TeamSpeak3 Client +The TeamSpeak3 Client exports identities the following way: + + + 'V' + + +(For an explanation of the key offset (see 4.1)) + +```ts +const staticObfucationKey = b"b9dfaa7bee6ac57ac7b65f1094a1c155e747327bc2fe5d51c512023fe54a280201004e90ad1daaae1075d53b7d571c30e063b5a62a4a017bb394833aa0983e6e" +let ident = obfuscaded_identity.decode64() +let sha_part = ident[20..] +let idx = sha_part.indexof('\0') // where '\0' is the null-byte +let sha = sha1(sha_part[..idx]) +ident[0..20] = ident[0..20] xor sha[0..20] +let xorlen = min(ident.length, 100) +ident[0..xorlen] = ident[0..xorlen] xor staticObfucationKey[0..xorlen] +``` + +## 4.6 Audio +When the Opus codec is used, Voice and VoiceWhisper packets are using a sampling +rate of 48 kHz. An voice packat without audio data signals the end of a stream. + +## 4.7 Permissions +`permissionlist` requests the list of all permissions of the server. +`notifypermissionlist` returns the list of permissions and a grouping as a list +of `group_id_end`s. The end ids are excluding, so a `group_id_end=6` for the first +group means the first 6 permissions (`perms[0..6]`) are in this group. + +## 4.8 Channel Subscription +Clients can subscribe channels, so they get notifications when someone enters or +leaves from a subscribed channel. If a new channel is subscribed, the server +usually sends a notification, except in some cases: +- If the client server groups or permissions change, it stays subscribed, even + if it does not have the power anymore +- If the channel permissions change, the server sends a notification if the + subscription status changed +- If a client enters a channel, it gets subscribed but there is no notification +- If a client leaves a channel, there is a notification that it unsubscribed +- If a new channel is created, clients are not automatically subscribed + +## 4.? Differences between Query and Full Client +- notifyconnectioninforequest +- => setconnectioninfo diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/book.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/book.rs new file mode 100644 index 0000000..693506f --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/book.rs @@ -0,0 +1,207 @@ +use heck::*; +use once_cell::sync::Lazy; +use serde::Deserialize; + +use crate::*; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Book.toml")); + +pub static DATA: Lazy = Lazy::new(|| toml::from_str(DATA_STR).unwrap()); + +#[derive(Deserialize, Debug)] +#[serde(deny_unknown_fields)] +pub struct BookDeclarations { + #[serde(rename = "struct")] + pub structs: Vec, +} + +impl BookDeclarations { + pub fn get_struct(&self, name: &str) -> &Struct { + if let Some(s) = self.structs.iter().find(|s| s.name == name) { + s + } else { + panic!("Cannot find bookkeeping struct {}", name); + } + } +} + +#[derive(Deserialize, Clone, Debug)] +#[serde(deny_unknown_fields)] +pub struct Id { + #[serde(rename = "struct")] + pub struct_name: String, + pub prop: String, +} + +impl Id { + pub fn find_property<'a>(&self, structs: &'a [Struct]) -> &'a Property { + // Find struct + for s in structs { + if s.name == self.struct_name { + // Find property + for p in &s.properties { + if p.name == self.prop { + return p; + } + } + } + } + panic!("Cannot find struct {} of id", self.struct_name); + } +} + +#[derive(Deserialize, Clone, Debug)] +#[serde(deny_unknown_fields)] +pub struct Struct { + pub name: String, + #[serde(default = "get_false")] + pub opt: bool, + pub id: Vec, + pub doc: String, + pub properties: Vec, +} + +#[derive(Deserialize, Clone, Debug)] +#[serde(deny_unknown_fields)] +pub struct Property { + /// The name of this property (in PascalCase) which can be called from rust + /// when generated. + pub name: String, + /// The rust declaration type. + #[serde(rename = "type")] + pub type_s: String, + pub doc: Option, + #[serde(default = "get_false")] + pub opt: bool, + #[serde(rename = "mod")] + pub modifier: Option, + pub key: Option, +} + +impl Struct { + pub fn get_type(&self) -> Result { RustType::with_opt(&self.name, self.opt) } + + pub fn get_ids(&self, structs: &[Struct]) -> String { + let mut res = String::new(); + for id in &self.id { + let p = id.find_property(structs); + if !res.is_empty() { + res.push_str(", "); + } + res.push_str(&p.get_type().unwrap().to_string()); + } + embrace(&res) + } + + pub fn get_properties(&self, structs: &[Struct]) -> Vec<&Property> { + self.properties.iter().filter(|p| !structs.iter().any(|s| s.name == p.type_s)).collect() + } + + /// Get all properties, including foreign ids (own ids are listed in properties). + pub fn get_all_properties(&self) -> impl Iterator> { + self.id.iter() + // Only foreign ids, others are also stored in the properties + .filter_map(move |i| if i.struct_name != self.name { Some(PropId::from(i)) } + else { None }) + .chain(self.properties.iter().map(|p| p.into())) + } +} + +impl Property { + pub fn get_inner_type(&self) -> Result { RustType::with_opt(&self.type_s, self.opt) } + + pub fn get_type(&self) -> Result { + let key = if self.is_map() { + Some(self.key.as_deref().ok_or_else(|| { + eprintln!("Specified map without key"); + fmt::Error + })?) + } else { + None + }; + RustType::with(&self.type_s, self.opt, key, self.is_set(), self.is_array()) + } + + /// Gets the type as a name, used for storing it in an enum. + pub fn get_inner_type_as_name(&self) -> Result { Ok(self.get_inner_type()?.to_name()) } + + pub fn get_ids(&self, structs: &[Struct], struc: &Struct) -> String { + let mut ids = struc.get_ids(structs); + if !ids.is_empty() { + ids.remove(0); + ids.pop(); + } + if let Some(m) = &self.modifier { + if !ids.is_empty() { + ids.push_str(", "); + } + if m == "map" { + // The key is part of the id + ids.push_str(self.key.as_ref().unwrap()); + } else if m == "array" || m == "set" { + // Take the element itself as part of the id. + // It has to be copied but most of the times it is an id itself. + ids.push_str(&self.get_inner_type().unwrap().to_string()); + } else { + panic!("Unknown modifier {}", m); + } + } + embrace(&ids) + } + + /// Get the name without trailing `s`. + pub fn get_name(&self) -> &str { + if self.modifier.is_some() && self.name.ends_with('s') { + &self.name[..self.name.len() - 1] + } else { + &self.name + } + } + + pub fn is_array(&self) -> bool { self.modifier.as_ref().map(|s| s == "array").unwrap_or(false) } + pub fn is_set(&self) -> bool { self.modifier.as_ref().map(|s| s == "set").unwrap_or(false) } + pub fn is_map(&self) -> bool { self.modifier.as_ref().map(|s| s == "map").unwrap_or(false) } +} + +pub enum PropId<'a> { + Prop(&'a Property), + Id(&'a Id), +} + +impl<'a> PropId<'a> { + pub fn get_attr_name(&self, struc: &Struct) -> String { + match *self { + PropId::Prop(p) => p.name.to_snake_case(), + PropId::Id(id) => { + if struc.name == id.struct_name { + id.prop.to_snake_case() + } else { + format!("{}_{}", id.struct_name.to_snake_case(), id.prop.to_snake_case(),) + } + } + } + } + + pub fn get_doc(&self) -> Option<&str> { + match *self { + PropId::Prop(p) => p.doc.as_deref(), + PropId::Id(_) => None, + } + } + + pub fn get_type(&self, structs: &[Struct]) -> Result { + match *self { + PropId::Prop(p) => p.get_type(), + PropId::Id(id) => id.find_property(structs).get_type(), + } + } +} + +impl<'a> From<&'a Property> for PropId<'a> { + fn from(p: &'a Property) -> Self { PropId::Prop(p) } +} + +impl<'a> From<&'a Id> for PropId<'a> { + fn from(p: &'a Id) -> Self { PropId::Id(p) } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/book_to_messages.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/book_to_messages.rs new file mode 100644 index 0000000..3ed2331 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/book_to_messages.rs @@ -0,0 +1,344 @@ +use std::str::FromStr; + +use heck::*; +use once_cell::sync::Lazy; +use serde::Deserialize; + +use crate::book::{BookDeclarations, Property, Struct}; +use crate::messages::{Field, Message, MessageDeclarations}; +use crate::*; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/BookToMessages.toml")); + +pub static DATA: Lazy> = Lazy::new(|| { + let rules: TomlStruct = toml::from_str(DATA_STR).unwrap(); + let book = &book::DATA; + let messages = &messages::DATA; + + let decls: Vec<_> = rules + .rule + .into_iter() + .map(|r| { + let msg = messages.get_message(&r.to); + let msg_fields = + msg.attributes.iter().map(|a| messages.get_field(a)).collect::>(); + let book_struct = book + .structs + .iter() + .find(|s| s.name == r.from) + .unwrap_or_else(|| panic!("Cannot find struct {}", r.from)); + + let find_prop = + |name: &str, book_struct: &'static Struct| -> Option<&'static Property> { + book_struct.properties.iter().find(|p| p.name == *name) + }; + + // Map RuleProperty to RuleKind + let to_rule_kind = |p: RuleProperty| { + p.assert_valid(); + + if p.function.is_some() { + if p.type_s.is_some() { + RuleKind::ArgumentFunction { + type_s: p.type_s.unwrap(), + from: p.from.unwrap(), + name: p.function.unwrap(), + to: p + .tolist + .unwrap() + .into_iter() + .map(|p| find_field(&p, &msg_fields)) + .collect(), + } + } else { + RuleKind::Function { + from: p.from.as_ref().map(|p| { + find_prop(p, book_struct).unwrap_or_else(|| { + panic!("No such (nested) property {} found in struct", p) + }) + }), + name: p.function.unwrap(), + to: p + .tolist + .unwrap() + .into_iter() + .map(|p| find_field(&p, &msg_fields)) + .collect(), + } + } + } else if let Some(prop) = find_prop(p.from.as_ref().unwrap(), book_struct) { + RuleKind::Map { from: prop, to: find_field(&p.to.unwrap(), &msg_fields) } + } else { + RuleKind::ArgumentMap { + from: p.from.unwrap(), + to: find_field(&p.to.unwrap(), &msg_fields), + } + } + }; + + let mut ev = Event { + op: r.operation.parse().expect("Failed to parse operation"), + ids: r.ids.into_iter().map(to_rule_kind).collect(), + msg, + book_struct, + rules: r.properties.into_iter().map(to_rule_kind).collect(), + }; + + // Add ids, which are required fields in the message. + // The filter checks that the message is not optional. + for field in msg_fields.iter().filter(|f| msg.attributes.iter().any(|a| *a == f.map)) { + if !ev.ids.iter().any(|i| match i { + RuleKind::Map { to, .. } => to == field, + RuleKind::ArgumentMap { to, .. } => to == field, + RuleKind::Function { to, .. } | RuleKind::ArgumentFunction { to, .. } => { + to.contains(field) + } + }) { + // Try to find matching property + if let Some(prop) = book + .get_struct(&ev.book_struct.name) + .properties + .iter() + .find(|p| !p.opt && p.name == field.pretty) + { + ev.ids.push(RuleKind::Map { from: prop, to: field }) + } + // The property may be in the properties + } + } + + // Add properties + for field in msg_fields.iter().filter(|f| !msg.attributes.iter().any(|a| *a == f.map)) { + if !ev.ids.iter().chain(ev.rules.iter()).any(|i| match i { + RuleKind::Map { to, .. } => to == field, + RuleKind::ArgumentMap { to, .. } => to == field, + RuleKind::Function { to, .. } | RuleKind::ArgumentFunction { to, .. } => { + to.contains(field) + } + }) { + // We ignore that properties are set as option. In all current cases, it + // makes no sense to set them to `None`, so we handle them the same way as + // non-optional properties. + if let Some(prop) = book + .get_struct(&ev.book_struct.name) + .properties + .iter() + .find(|p| p.name == field.pretty) + { + if !ev.ids.iter().chain(ev.rules.iter()).any(|i| i.from_name() == prop.name) + { + ev.rules.push(RuleKind::Map { from: prop, to: field }) + } + } + } + } + + ev + }) + .collect(); + + BookToMessagesDeclarations { book, messages, decls } +}); + +#[derive(Debug)] +pub struct BookToMessagesDeclarations<'a> { + pub book: &'a BookDeclarations, + pub messages: &'a MessageDeclarations, + pub decls: Vec>, +} + +#[derive(Debug)] +pub struct Event<'a> { + pub op: RuleOp, + pub msg: &'a Message, + pub book_struct: &'a Struct, + pub ids: Vec>, + pub rules: Vec>, +} + +#[derive(Debug)] +pub enum RuleKind<'a> { + Map { from: &'a Property, to: &'a Field }, + ArgumentMap { from: String, to: &'a Field }, + Function { from: Option<&'a Property>, name: String, to: Vec<&'a Field> }, + ArgumentFunction { from: String, type_s: String, name: String, to: Vec<&'a Field> }, +} + +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum RuleOp { + Add, + Remove, + Update, +} + +#[derive(Deserialize, Debug)] +#[serde(deny_unknown_fields)] +struct TomlStruct { + rule: Vec, +} + +#[derive(Clone, Deserialize, Debug)] +#[serde(deny_unknown_fields)] +pub struct Rule { + from: String, + to: String, + operation: String, + #[serde(default = "Vec::new")] + ids: Vec, + #[serde(default = "Vec::new")] + properties: Vec, +} + +#[derive(Clone, Deserialize, Debug)] +#[serde(deny_unknown_fields)] +pub struct RuleProperty { + from: Option, + to: Option, + + #[serde(rename = "type")] + type_s: Option, + function: Option, + tolist: Option>, +} + +impl RuleProperty { + fn assert_valid(&self) { + if let Some(to) = &self.to { + assert!(self.from.is_some(), "to-property '{}' is invalid. It needs a 'from'", to); + assert!( + self.function.is_none(), + "to-property '{}' is invalid. It must not have a 'function'", + to + ); + assert!( + self.tolist.is_none(), + "to-property '{}' is invalid. It must not have a 'tolist'", + to + ); + assert!( + self.type_s.is_none(), + "to-property '{}' is invalid. It must not have a 'type'", + to + ); + } else if let Some(fun) = &self.function { + assert!( + self.tolist.is_some(), + "function-property '{}' is invalid. It needs 'tolist'", + fun + ); + assert!( + self.type_s.is_none() || self.from.is_some(), + "function-property '{}' is invalid. If the type ({:?}) is set, from must be set \ + too", + fun, + self.type_s + ); + } else { + panic!( + "Property is invalid. It needs either a 'to' or 'tolist'+'function'.Info: \ + tolist={:?} type={:?} from={:?}", + self.tolist, self.type_s, self.from + ); + } + } +} + +impl FromStr for RuleOp { + type Err = fmt::Error; + fn from_str(s: &str) -> Result { + if s == "add" { + Ok(RuleOp::Add) + } else if s == "remove" { + Ok(RuleOp::Remove) + } else if s == "update" { + Ok(RuleOp::Update) + } else { + eprintln!("Cannot parse operation, needs to be add, remove or update"); + Err(fmt::Error) + } + } +} + +// the in rust callable name (in PascalCase) from the field +fn find_field<'a>(name: &str, msg_fields: &[&'a Field]) -> &'a Field { + msg_fields + .iter() + .find(|f| f.pretty == name) + .unwrap_or_else(|| panic!("Cannot find field '{}'", name)) +} + +impl<'a> RuleKind<'a> { + pub fn from_name(&'a self) -> &'a str { + match self { + RuleKind::Map { from, .. } => &from.name, + RuleKind::ArgumentMap { from, .. } => from, + RuleKind::Function { from, name, .. } => { + &from.unwrap_or_else(|| panic!("From not set for function {}", name)).name + } + RuleKind::ArgumentFunction { from, .. } => from, + } + } + + pub fn from_name_singular(&'a self) -> &'a str { + let name = self.from_name(); + if let Some(s) = name.strip_suffix('s') { s } else { name } + } + + pub fn from(&self) -> &'a Property { + match self { + RuleKind::Map { from, .. } => from, + RuleKind::Function { from, name, .. } => { + from.unwrap_or_else(|| panic!("From not set for function {}", name)) + } + RuleKind::ArgumentMap { .. } | RuleKind::ArgumentFunction { .. } => { + panic!("From is not a property for argument functions") + } + } + } + + pub fn is_function(&self) -> bool { + matches!(self, RuleKind::Function { .. } | RuleKind::ArgumentFunction { .. }) + } + + pub fn get_type(&self) -> RustType { + match self { + RuleKind::Map { .. } | RuleKind::Function { .. } => self.from().get_type().unwrap(), + RuleKind::ArgumentMap { to, .. } => to.get_type("").unwrap(), + RuleKind::ArgumentFunction { type_s, .. } => type_s.parse().unwrap(), + } + } + + pub fn get_type_no_option(&self) -> RustType { + match self { + RuleKind::Map { .. } => { + let mut rust_type = self.from().clone(); + rust_type.opt = false; + rust_type.get_type().unwrap() + } + _ => self.get_type(), + } + } + + pub fn get_argument(&self) -> String { + format!("{}: {}", self.from_name().to_snake_case(), self.get_type().to_ref(true)) + } + + pub fn get_argument_no_option(&self) -> String { + format!("{}: {}", self.from_name().to_snake_case(), self.get_type_no_option().to_ref(true)) + } +} + +impl<'a> Event<'a> { + /// The name of the change, could be a keyword. + pub fn get_small_name(&self) -> String { + // Strip own struct name and 'Request' + self.msg.name.replace(&self.book_struct.name, "").replace("Request", "") + } + + /// The small name, not a keyword + pub fn get_change_name(&self) -> String { + let small_change_name = self.get_small_name(); + if small_change_name == "Move" { self.msg.name.clone() } else { small_change_name } + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/enums.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/enums.rs new file mode 100644 index 0000000..a32cce8 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/enums.rs @@ -0,0 +1,52 @@ +use once_cell::sync::Lazy; +use serde::Deserialize; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Enums.toml")); + +pub static DATA: Lazy = Lazy::new(|| toml::from_str(DATA_STR).unwrap()); + +#[derive(Deserialize, Debug)] +#[serde(deny_unknown_fields)] +pub struct Enums { + #[serde(rename = "enum")] + pub enums: Vec, + #[serde(rename = "bitflag")] + pub bitflags: Vec, +} + +#[derive(Deserialize, Clone, Debug)] +#[serde(deny_unknown_fields)] +pub struct Enum { + pub name: String, + pub doc: Option, + #[serde(rename = "type")] + pub use_type: Option, + pub variants: Vec, +} + +#[derive(Deserialize, Clone, Debug)] +#[serde(deny_unknown_fields)] +pub struct Variant { + pub name: String, + pub doc: String, + pub value: Option, +} + +impl Enum { + /// Computes the needed number of bits to store all possible variants. + pub fn bitwidth(&self) -> u32 { + let mut leading_zeros = 0; + let mut value: u64 = 0; + for v in &self.variants { + if let Some(v) = v.value { + leading_zeros = std::cmp::min(leading_zeros, value.leading_zeros()); + value = v; + } else { + value += 1; + } + } + leading_zeros = std::cmp::min(leading_zeros, value.leading_zeros()); + (64 - leading_zeros).next_power_of_two() + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/errors.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/errors.rs new file mode 100644 index 0000000..b73b559 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/errors.rs @@ -0,0 +1,20 @@ +use std::result::Result; + +use crate::*; + +use once_cell::sync::Lazy; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Errors.csv")); + +pub static DATA: Lazy = Lazy::new(|| { + Errors( + csv::Reader::from_reader(DATA_STR.as_bytes()) + .deserialize() + .collect::, _>>() + .unwrap(), + ) +}); + +#[derive(Default, Debug)] +pub struct Errors(pub Vec); diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/lib.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/lib.rs new file mode 100644 index 0000000..2d9b55d --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/lib.rs @@ -0,0 +1,398 @@ +//! `tsproto-structs` contains machine readable data for several TeamSpeak related topics. +//! +//! The underlying data files can be found in the +//! [tsdeclarations](https://github.com/ReSpeak/tsdeclarations) repository. + +use std::fmt; +use std::str::FromStr; + +use heck::*; +use serde::Deserialize; + +type Result = std::result::Result; + +pub mod book; +pub mod book_to_messages; +pub mod enums; +pub mod errors; +pub mod messages; +pub mod messages_to_book; +pub mod permissions; +pub mod versions; + +#[derive(Debug, Deserialize)] +pub struct EnumValue { + pub name: String, + pub doc: String, + pub num: String, +} + +#[derive(Clone, Debug)] +pub enum InnerRustType { + Primitive(String), + Struct(String), + Ref(Box), + Option(Box), + /// Key, value + Map(Box, Box), + Set(Box), + Vec(Box), + Cow(Box), +} + +#[derive(Clone, Debug)] +pub struct RustType { + pub inner: InnerRustType, + /// Include a lifetime specifier 'a + pub lifetime: bool, +} + +impl InnerRustType { + /// `lifetime`: Include 'a for references + /// `is_ref`: If this is a refercene, used to emit either `str` or `String` or slices + pub fn fmt(&self, f: &mut fmt::Formatter, lifetime: bool, is_ref: bool) -> fmt::Result { + let lifetime_str = if lifetime { "'a " } else { "" }; + match self { + Self::Struct(s) if s == "str" => { + if is_ref { + write!(f, "str")?; + } else { + write!(f, "String")?; + } + } + Self::Struct(s) if s == "Uid" => { + write!(f, "{}", s)?; + } + Self::Primitive(s) | Self::Struct(s) => write!(f, "{}", s)?, + Self::Ref(i) => { + write!(f, "&{}", lifetime_str)?; + i.fmt(f, lifetime, true)?; + } + Self::Option(i) => { + write!(f, "Option<")?; + i.fmt(f, lifetime, false)?; + write!(f, ">")?; + } + Self::Map(k, v) => { + write!(f, "HashMap<")?; + k.fmt(f, lifetime, false)?; + write!(f, ", ")?; + v.fmt(f, lifetime, false)?; + write!(f, ">")?; + } + Self::Set(i) => { + write!(f, "HashSet<")?; + i.fmt(f, lifetime, false)?; + write!(f, ">")?; + } + Self::Vec(i) => { + if is_ref { + write!(f, "[")?; + i.fmt(f, lifetime, false)?; + write!(f, "]")?; + } else { + write!(f, "Vec<")?; + i.fmt(f, lifetime, false)?; + write!(f, ">")?; + } + } + Self::Cow(i) => { + write!(f, "Cow<{}, ", lifetime_str.trim())?; + i.fmt(f, false, true)?; + write!(f, ">")?; + } + } + Ok(()) + } + + /// Returns a converted type. + pub fn to_ref(&self) -> Self { + match self { + Self::Struct(s) if s == "UidBuf" => Self::Ref(Box::new(Self::Struct("Uid".into()))), + Self::Struct(s) if s == "String" => Self::Ref(Box::new(Self::Struct("str".into()))), + Self::Struct(_) | Self::Map(_, _) | Self::Set(_) | Self::Vec(_) => { + Self::Ref(Box::new(self.clone())) + } + Self::Primitive(_) | Self::Ref(_) | Self::Cow(_) => self.clone(), + Self::Option(i) => Self::Option(Box::new(i.to_ref())), + } + } + + /// Returns a converted type. + pub fn to_cow(&self) -> Self { + match self { + Self::Struct(s) if s == "UidBuf" => Self::Cow(Box::new(Self::Struct("Uid".into()))), + Self::Struct(s) if s == "String" => Self::Cow(Box::new(Self::Struct("str".into()))), + Self::Struct(_) | Self::Map(_, _) | Self::Set(_) | Self::Vec(_) => { + Self::Cow(Box::new(self.clone())) + } + Self::Primitive(_) | Self::Ref(_) | Self::Cow(_) => self.clone(), + Self::Option(i) => Self::Option(Box::new(i.to_cow())), + } + } + + /// Get code snippet for `as_ref`. + pub fn code_as_ref(&self, name: &str) -> String { + match self { + Self::Struct(s) if s == "UidBuf" || s == "str" => format!("{}.as_ref()", name), + Self::Struct(s) if s == "String" => format!("{}.as_str()", name), + Self::Struct(s) if s == "str" => name.into(), + Self::Struct(_) => format!("&{}", name), + Self::Map(_, _) | Self::Set(_) | Self::Vec(_) | Self::Cow(_) => { + format!("{}.as_ref()", name) + } + Self::Primitive(_) => name.into(), + Self::Ref(i) => { + let inner = i.code_as_ref(name); + if inner == name { + format!("*{}", name) + } else if inner.starts_with('&') && &inner[1..] == name { + name.into() + } else { + inner + } + } + Self::Option(i) => { + match &**i { + // Shortcut + Self::Struct(s) if s == "String" => format!("{}.as_deref()", name), + _ => { + let inner = i.code_as_ref(name); + if inner == name { + inner + } else if inner.starts_with('&') && &inner[1..] == name { + format!("{0}.as_ref()", name) + } else { + format!("{0}.as_ref().map(|{0}| {1})", name, inner) + } + } + } + } + } + } + + pub fn uses_lifetime(&self) -> bool { + match self { + Self::Struct(s) if s == "Uid" => true, + Self::Ref(_) | Self::Cow(_) => true, + Self::Map(_, i) | Self::Set(i) | Self::Vec(i) | Self::Option(i) => i.uses_lifetime(), + _ => false, + } + } +} + +impl FromStr for InnerRustType { + type Err = fmt::Error; + fn from_str(s: &str) -> Result { + if s == "DateTime" { + Ok(Self::Primitive("OffsetDateTime".into())) + } else if s.starts_with("Duration") { + Ok(Self::Primitive("Duration".into())) + } else if s == "PermissionId" { + Ok(Self::Primitive("Permission".into())) + } else if s == "Ts3ErrorCode" { + Ok(Self::Primitive("Error".into())) + } else if s == "bool" + || s.starts_with('i') + || s.starts_with('u') + || s.starts_with('f') + || s.ends_with("Id") + || s.ends_with("Type") + || s.ends_with("Mode") + || s == "ChannelPermissionHint" + || s == "ClientPermissionHint" + || s == "Codec" + || s == "LogLevel" + || s == "MaxClients" + || s == "IpAddr" + || s == "Reason" + || s == "SocketAddr" + { + Ok(Self::Primitive(s.into())) + } else if s == "Uid" { + Ok(Self::Struct("UidBuf".into())) + } else if s == "str" || s == "String" { + Ok(Self::Struct("String".into())) + } else if let Some(rest) = s.strip_prefix('&') { + let rest = if rest.starts_with('\'') { + let i = rest.find(' ').ok_or_else(|| { + eprintln!("Reference type with lifetime has no inner type: {:?}", s); + fmt::Error + })?; + &rest[i + 1..] + } else { + rest + }; + Ok(Self::Ref(Box::new(rest.parse()?))) + } else if let Some(rest) = s.strip_suffix('?') { + Ok(Self::Option(Box::new(rest.parse()?))) + } else if s.starts_with("Option<") { + let rest = &s[7..s.len() - 1]; + Ok(Self::Option(Box::new(rest.parse()?))) + } else if let Some(rest) = s.strip_suffix("[]") { + Ok(Self::Vec(Box::new(rest.parse()?))) + } else if s.starts_with("HashMap<") { + let rest = &s[8..s.len() - 1]; + let i = rest.find(',').ok_or_else(|| { + eprintln!("HashMap without key: {:?}", s); + fmt::Error + })?; + Ok(Self::Map(Box::new(rest[..i].parse()?), Box::new(rest[i..].trim().parse()?))) + } else if s.starts_with("HashSet<") { + let rest = &s[8..s.len() - 1]; + Ok(Self::Set(Box::new(rest.parse()?))) + } else if s.starts_with("Vec<") { + let rest = &s[4..s.len() - 1]; + Ok(Self::Vec(Box::new(rest.parse()?))) + } else if s.starts_with('[') { + let rest = &s[1..s.len() - 1]; + if rest.contains(';') { + // Slice with explicit length, take as struct + Ok(Self::Struct(s.into())) + } else { + Ok(Self::Vec(Box::new(rest.parse()?))) + } + } else if let Some(rest) = s.strip_suffix('T') { + rest.parse() + } else { + Ok(Self::Struct(s.into())) + } + } +} + +impl FromStr for RustType { + type Err = fmt::Error; + fn from_str(s: &str) -> Result { + Ok(Self { inner: s.parse()?, lifetime: s.contains("&'") }) + } +} + +impl RustType { + pub fn with_opt(s: &str, opt: bool) -> Result { + let inner = s.parse()?; + let inner = if opt { InnerRustType::Option(Box::new(inner)) } else { inner }; + Ok(Self { inner, lifetime: s.contains("&'") }) + } + + /// `map` has a key + pub fn with(s: &str, opt: bool, map: Option<&str>, set: bool, vec: bool) -> Result { + assert!( + [map.is_some(), set, vec].iter().filter(|b| **b).count() <= 1, + "Too many modifiers active (map: {:?}, set: {:?}, vec: {:?})", + map, + set, + vec + ); + let mut inner = s.parse()?; + if let Some(key) = map { + inner = InnerRustType::Map(Box::new(key.parse()?), Box::new(inner)); + } + if set { + inner = InnerRustType::Set(Box::new(inner)); + } + if vec { + inner = InnerRustType::Vec(Box::new(inner)); + } + + inner = if opt { InnerRustType::Option(Box::new(inner)) } else { inner }; + Ok(Self { inner, lifetime: s.contains("&'") }) + } + + pub fn to_opt(&self, opt: bool) -> Self { + if opt { + Self { + inner: InnerRustType::Option(Box::new(self.inner.clone())), + lifetime: self.lifetime, + } + } else { + self.clone() + } + } + + pub fn to_ref(&self, as_ref: bool) -> Self { + if as_ref { + Self { inner: self.inner.to_ref(), lifetime: self.lifetime } + } else { + self.clone() + } + } + + pub fn to_cow(&self) -> Self { Self { inner: self.inner.to_cow(), lifetime: self.lifetime } } + + pub fn lifetime(&self, lifetime: bool) -> Self { + let mut r = self.clone(); + r.lifetime = lifetime; + r + } + + pub fn wrap_ref(&self) -> Self { + Self { inner: InnerRustType::Ref(Box::new(self.inner.clone())), lifetime: self.lifetime } + } + + pub fn wrap_opt(&self) -> Self { + Self { inner: InnerRustType::Option(Box::new(self.inner.clone())), lifetime: self.lifetime } + } + + pub fn is_opt(&self) -> bool { matches!(self.inner, InnerRustType::Option(_)) } + + pub fn is_primitive(&self) -> bool { + let inner = if let InnerRustType::Option(t) = &self.inner { t } else { &self.inner }; + matches!(inner, InnerRustType::Primitive(_)) + } + + pub fn is_vec(&self) -> bool { matches!(self.inner, InnerRustType::Vec(_)) } + + pub fn is_cow(&self) -> bool { + let inner = if let InnerRustType::Option(i) = &self.inner { i } else { &self.inner }; + matches!(inner, InnerRustType::Cow(_)) + } + + pub fn uses_lifetime(&self) -> bool { self.inner.uses_lifetime() } + + /// Returns an identifier from this type in camelCase. + pub fn to_name(&self) -> String { + self.to_string().replace('<', "_").replace('>', "").to_upper_camel_case() + } + + /// Get code snippet for `as_ref`. + pub fn code_as_ref(&self, name: &str) -> String { self.inner.code_as_ref(name) } +} + +impl From for RustType { + fn from(inner: InnerRustType) -> Self { Self { inner, lifetime: false } } +} + +impl fmt::Display for RustType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.inner.fmt(f, self.lifetime, false) } +} + +fn get_false() -> bool { false } + +/// Prepend `/// ` to each line of a string. +pub fn doc_comment(s: &str) -> String { s.lines().map(|l| format!("/// {}\n", l)).collect() } + +/// Indent a string by a given count using tabs. +pub fn indent>(s: S, count: usize) -> String { + let sref = s.as_ref(); + let line_count = sref.lines().count(); + let mut result = String::with_capacity(sref.len() + line_count * count * 4); + for l in sref.lines() { + if !l.is_empty() { + result.push_str(&"\t".repeat(count)); + } + result.push_str(l); + result.push('\n'); + } + result +} + +/// Unindent a string by a given count of tabs. +pub fn unindent(s: &mut String) { + std::mem::swap(&mut s.replace("\n\t", "\n"), s); + if s.get(0..1) == Some("\t") { + s.remove(0); + } +} + +/// Returns an empty string if `s` is empty, otherwise `s` with braces. +pub fn embrace(s: &str) -> String { if s.is_empty() { String::new() } else { format!("({})", s) } } diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/messages.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/messages.rs new file mode 100644 index 0000000..586b20a --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/messages.rs @@ -0,0 +1,115 @@ +use heck::*; +use once_cell::sync::Lazy; +use serde::Deserialize; + +use crate::*; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Messages.toml")); + +pub static DATA: Lazy = Lazy::new(|| toml::from_str(DATA_STR).unwrap()); + +#[derive(Deserialize, Debug, Clone)] +#[serde(deny_unknown_fields)] +pub struct MessageDeclarations { + pub fields: Vec, + pub msg_group: Vec, +} + +impl MessageDeclarations { + pub fn get_message_opt(&self, name: &str) -> Option<&Message> { + self.msg_group.iter().flat_map(|g| g.msg.iter()).find(|m| m.name == name) + } + + pub fn get_message(&self, name: &str) -> &Message { + self.get_message_opt(name).unwrap_or_else(|| panic!("Cannot find message {}", name)) + } + + pub fn get_message_group(&self, msg: &Message) -> &MessageGroup { + for g in &self.msg_group { + for m in &g.msg { + if std::ptr::eq(m, msg) { + return g; + } + } + } + panic!("Cannot find message group for message"); + } + + pub fn get_field(&self, mut map: &str) -> &Field { + if map.ends_with('?') { + map = &map[..map.len() - 1]; + } + if let Some(f) = self.fields.iter().find(|f| f.map == map) { + f + } else { + panic!("Cannot find field {}", map); + } + } + + pub fn uses_lifetime(&self, msg: &Message) -> bool { + for a in &msg.attributes { + let field = self.get_field(a); + if field.get_type(a).unwrap().to_ref(true).uses_lifetime() { + return true; + } + } + false + } +} + +#[derive(Deserialize, Debug, Clone, Eq, Hash, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct Field { + /// Internal name of this declarations file to map fields to messages. + pub map: String, + /// The name as called by TeamSpeak in messages. + pub ts: String, + /// The pretty name in PascalCase. This will be used for the fields in rust. + pub pretty: String, + #[serde(rename = "type")] + pub type_s: String, + #[serde(rename = "mod")] + pub modifier: Option, +} + +#[derive(Deserialize, Debug, Clone)] +#[serde(deny_unknown_fields)] +pub struct MessageGroup { + pub default: MessageGroupDefaults, + pub msg: Vec, +} + +#[derive(Deserialize, Debug, Clone)] +#[serde(deny_unknown_fields)] +pub struct MessageGroupDefaults { + pub s2c: bool, + pub c2s: bool, + pub response: bool, + pub low: bool, + pub np: bool, +} + +#[derive(Deserialize, Debug, Clone)] +#[serde(deny_unknown_fields)] +pub struct Message { + /// How we call this message. + pub name: String, + /// How TeamSpeak calls this message. + pub notify: Option, + pub attributes: Vec, +} + +impl Field { + pub fn get_rust_name(&self) -> String { self.pretty.to_snake_case() } + + /// Takes the attribute to look if it is optional + pub fn get_type(&self, a: &str) -> Result { + RustType::with(&self.type_s, a.ends_with('?'), None, false, self.is_array()) + } + + /// Returns if this field is optional in the message. + pub fn is_opt(&self, msg: &Message) -> bool { !msg.attributes.iter().any(|a| *a == self.map) } + + pub fn is_array(&self) -> bool { self.modifier.as_ref().map(|s| s == "array").unwrap_or(false) } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/messages_to_book.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/messages_to_book.rs new file mode 100644 index 0000000..392e628 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/messages_to_book.rs @@ -0,0 +1,263 @@ +use std::collections::HashSet; +use std::fmt::Write; +use std::str::FromStr; + +use once_cell::sync::Lazy; +use serde::Deserialize; + +use crate::book::{BookDeclarations, Property, Struct}; +use crate::messages::{Field, Message, MessageDeclarations}; +use crate::*; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/MessagesToBook.toml")); + +pub static DATA: Lazy> = Lazy::new(|| { + let rules: TomlStruct = toml::from_str(DATA_STR).unwrap(); + let book = &book::DATA; + let messages = &messages::DATA; + + let mut decls: Vec<_> = rules + .rule + .into_iter() + .map(|r| { + let msg = messages.get_message(&r.from); + let msg_fields = + msg.attributes.iter().map(|a| messages.get_field(a)).collect::>(); + let book_struct = book + .structs + .iter() + .find(|s| s.name == r.to) + .unwrap_or_else(|| panic!("Cannot find struct {}", r.to)); + + let mut ev = Event { + op: r.operation.parse().expect("Failed to parse operation"), + id: r.id.iter().map(|s| find_field(s, &msg_fields)).collect(), + msg, + book_struct, + rules: r + .properties + .into_iter() + .map(|p| { + assert!(p.is_valid()); + + let find_prop = |name, book_struct: &'static Struct| -> &'static Property { + if let Some(prop) = + book_struct.properties.iter().find(|p| p.name == name) + { + return prop; + } + panic!( + "No such (nested) property {} found in struct {}", + name, book_struct.name, + ); + }; + + if p.function.is_some() { + RuleKind::Function { + name: p.function.unwrap(), + to: p + .tolist + .unwrap() + .into_iter() + .map(|p| find_prop(p, book_struct)) + .collect(), + } + } else { + RuleKind::Map { + from: find_field(&p.from.unwrap(), &msg_fields), + to: find_prop(p.to.unwrap(), book_struct), + op: p + .operation + .map(|s| s.parse().expect("Invalid operation for property")) + .unwrap_or(RuleOp::Update), + } + } + }) + .collect(), + }; + + // Add attributes with the same name automatically (if they are not + // yet there). + let used_flds = ev + .rules + .iter() + .filter_map(|f| match *f { + RuleKind::Map { from, .. } => Some(from), + _ => None, + }) + .collect::>(); + + let mut used_props = vec![]; + for rule in &ev.rules { + if let RuleKind::Function { to, .. } = rule { + for p in to { + used_props.push(p.name.clone()); + } + } + } + + for fld in &msg_fields { + if used_flds.contains(fld) { + continue; + } + if let Some(prop) = book + .get_struct(&ev.book_struct.name) + .properties + .iter() + .find(|p| p.name == fld.pretty) + { + if used_props.contains(&prop.name) { + continue; + } + + ev.rules.push(RuleKind::Map { from: fld, to: prop, op: RuleOp::Update }); + } + } + + ev + }) + .collect(); + + // InitServer is done manually + decls.retain(|ev| ev.msg.name != "InitServer"); + + MessagesToBookDeclarations { book, messages, decls } +}); + +#[derive(Debug)] +pub struct MessagesToBookDeclarations<'a> { + pub book: &'a BookDeclarations, + pub messages: &'a MessageDeclarations, + pub decls: Vec>, +} + +#[derive(Debug)] +pub struct Event<'a> { + pub op: RuleOp, + /// Unique access tuple to get the property + pub id: Vec<&'a Field>, + pub msg: &'a Message, + pub book_struct: &'a Struct, + pub rules: Vec>, +} + +#[derive(Debug)] +pub enum RuleKind<'a> { + Map { from: &'a Field, to: &'a Property, op: RuleOp }, + Function { name: String, to: Vec<&'a Property> }, +} + +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum RuleOp { + Add, + Remove, + Update, +} + +#[derive(Clone, Deserialize, Debug)] +#[serde(deny_unknown_fields)] +struct TomlStruct { + rule: Vec, +} + +#[derive(Clone, Deserialize, Debug)] +#[serde(deny_unknown_fields)] +struct Rule { + id: Vec, + from: String, + to: String, + operation: String, + #[serde(default = "Vec::new")] + properties: Vec, +} + +#[derive(Clone, Deserialize, Debug)] +#[serde(deny_unknown_fields)] +struct RuleProperty { + from: Option, + to: Option, + operation: Option, + + function: Option, + tolist: Option>, +} + +impl Event<'_> { + /// Fill the id of a `PropertyId`. + /// + /// `msg` is the name of the message object. + pub fn get_id_args(&self, msg: &str) -> String { + let mut res = String::new(); + for f in &self.id { + if !res.is_empty() { + res.push_str(", "); + } + if !f.get_type("").unwrap().is_primitive() { + res.push('&'); + } + let _ = write!(res, "{}.{}", msg, f.get_rust_name()); + } + res + } + + /// Create a `PropertyId` from a message struct. + /// + /// `msg` is the name of the message object. + pub fn get_property_id(&self, p: &Property, from: &Field, msg: &str) -> String { + let mut ids = self.get_id_args(msg); + if let Some(m) = &p.modifier { + if !ids.is_empty() { + ids.push_str(", "); + } + if m == "map" || m == "array" || m == "set" { + let _ = write!(ids, "{}.{}", msg, from.get_rust_name()); + } else { + panic!("Unknown modifier {}", m); + } + } + format!("PropertyId::{}{}{}", self.book_struct.name, p.get_name(), embrace(&ids)) + } +} + +impl RuleProperty { + fn is_valid(&self) -> bool { + if self.from.is_some() { + self.to.is_some() && self.function.is_none() && self.tolist.is_none() + } else { + self.from.is_none() + && self.to.is_none() + && self.operation.is_none() + && self.function.is_some() + && self.tolist.is_some() + } + } +} + +impl FromStr for RuleOp { + type Err = fmt::Error; + fn from_str(s: &str) -> Result { + if s == "add" { + Ok(RuleOp::Add) + } else if s == "remove" { + Ok(RuleOp::Remove) + } else if s == "update" { + Ok(RuleOp::Update) + } else { + eprintln!("Cannot parse operation, needs to be add, remove or update"); + Err(fmt::Error) + } + } +} + +// the in rust callable name (in PascalCase) from the field +fn find_field<'a>(name: &str, msg_fields: &[&'a Field]) -> &'a Field { + msg_fields + .iter() + .find(|f| f.pretty == name) + .unwrap_or_else(|| panic!("Cannot find field '{}'", name)) +} + +impl<'a> RuleKind<'a> { + pub fn is_function(&self) -> bool { matches!(self, RuleKind::Function { .. }) } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/permissions.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/permissions.rs new file mode 100644 index 0000000..a32a3b7 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/permissions.rs @@ -0,0 +1,26 @@ +use std::result::Result; + +use crate::*; + +use once_cell::sync::Lazy; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Permissions.csv")); + +pub static DATA: Lazy = Lazy::new(|| { + Permissions( + csv::Reader::from_reader(DATA_STR.as_bytes()) + .deserialize() + .collect::, _>>() + .unwrap(), + ) +}); + +#[derive(Debug, Deserialize)] +pub struct EnumValue { + pub name: String, + pub doc: String, +} + +#[derive(Default, Debug)] +pub struct Permissions(pub Vec); diff --git a/native/vendor/tsclientlib/utils/tsproto-structs/src/versions.rs b/native/vendor/tsclientlib/utils/tsproto-structs/src/versions.rs new file mode 100644 index 0000000..d2c3324 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-structs/src/versions.rs @@ -0,0 +1,94 @@ +use std::collections::HashMap; +use std::fmt::Write; +use std::result::Result; + +use crate::*; + +use base64::prelude::*; +use once_cell::sync::Lazy; + +pub const DATA_STR: &str = + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Versions.csv")); + +pub static DATA: Lazy = Lazy::new(|| { + let mut table = csv::Reader::from_reader(DATA_STR.as_bytes()); + let mut vs = Versions(table.deserialize().collect::, _>>().unwrap()); + + // Add count if necessary + let mut counts: HashMap<_, u32> = HashMap::new(); + for v in &vs.0 { + let key = VersionKey::new(v); + *counts.entry(key).or_default() += 1; + } + counts.retain(|_, c| *c > 1); + + for v in vs.0.iter_mut().rev() { + let key = VersionKey::new(v); + if let Some(count) = counts.get_mut(&key) { + v.count = *count; + *count -= 1; + } + } + + vs +}); + +#[derive(Debug, Deserialize, Clone)] +#[serde(deny_unknown_fields)] +pub struct Version { + pub version: String, + pub platform: String, + pub hash: String, + #[serde(default)] + count: u32, +} + +impl Version { + pub fn get_enum_name(&self) -> String { + let mut res = String::new(); + res.push_str(&self.platform.replace([' ', '.'], "_")); + let ver = self.version.split(' ').next().unwrap().replace('-', "_"); + for num in ver.split('.') { + res.push('_'); + if num != "?" { + res.push_str(num); + } else { + res.push('X'); + } + } + if self.count != 0 { + res.push_str("__"); + res.push_str(&self.count.to_string()); + } + res + } + + pub fn get_sign_array(&self) -> String { + let mut res = String::new(); + for b in BASE64_STANDARD.decode(&self.hash).unwrap() { + if !res.is_empty() { + res.push_str(", "); + } + let _ = write!(res, "{:#x}", b); + } + res + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +struct VersionKey { + pub version: String, + pub platform: String, +} + +impl VersionKey { + fn new(v: &Version) -> Self { + Self { + version: v.version.split(' ').next().unwrap().to_string(), + platform: v.platform.clone(), + } + } +} + +#[derive(Default, Debug)] +pub struct Versions(pub Vec); diff --git a/native/vendor/tsclientlib/utils/tsproto-types/Cargo.toml b/native/vendor/tsclientlib/utils/tsproto-types/Cargo.toml new file mode 100644 index 0000000..e9ccf5b --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "tsproto-types" +version = "0.1.0" +authors = ["Flakebi "] +description = "Basic types and enums that are used within the TeamSpeak protocol." +repository = "https://github.com/ReSpeak/tsclientlib/tree/master/utils/tsproto-types" +readme = "README.md" +keywords = ["teamspeak3", "ts3"] +license = "MIT OR Apache-2.0" +build = "build/build.rs" +edition = "2018" +include = [ + "/Cargo.toml", + "/README.md", + "**/*.rs", + "**/*.tt", +] + +[dependencies] +base64 = "0.22" +bitflags = { version = "2", features = ["serde"] } +curve25519-dalek-ng = "4" +elliptic-curve = { version = "0.13", features = ["ecdh"] } +generic-array = "0.14" +num-bigint = "0.4" +num-derive = "0.4" +num-traits = "0.2" +p256 = { version = "0.13", features = ["ecdh", "ecdsa"] } +rand = "0.8" +ref-cast = "1" +serde = { version = "1", features = ["derive"] } +sha-1 = "0.10" +simple_asn1 = "0.6" +thiserror = "2" +time = { version = "0.3", features = ["serde"] } + +[build-dependencies] +heck = "0.5" +t4rust-derive = "0.3" +tsproto-structs = { path = "../tsproto-structs", version = "0.2" } diff --git a/native/vendor/tsclientlib/utils/tsproto-types/README.md b/native/vendor/tsclientlib/utils/tsproto-types/README.md new file mode 100644 index 0000000..2cf6bb6 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/README.md @@ -0,0 +1,10 @@ +# tsproto-types [![docs.rs](https://docs.rs/tsproto-types/badge.svg)](https://docs.rs/tsproto-types) +`tsproto-types` contains basic types and enums that are used within the TeamSpeak protocol. + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-types/README.tpl b/native/vendor/tsclientlib/utils/tsproto-types/README.tpl new file mode 100644 index 0000000..7fce8af --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/README.tpl @@ -0,0 +1,10 @@ +# tsproto-types [![docs.rs](https://docs.rs/tsproto-types/badge.svg)](https://docs.rs/tsproto-types) +{{readme}} + +## License +Licensed under either of + + * [Apache License, Version 2.0](../../LICENSE-APACHE) + * [MIT license](../../LICENSE-MIT) + +at your option. diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/Enums.tt b/native/vendor/tsclientlib/utils/tsproto-types/build/Enums.tt new file mode 100644 index 0000000..6c50119 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/Enums.tt @@ -0,0 +1,30 @@ +<#@ template cleanws="true" #> +<# for e in &self.enums { #> +<# if let Some(doc) = &e.doc { #> +<#= doc_comment(doc) #> +<# } #> +#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)] +pub enum <#= e.name #><# if let Some(ty) = &e.use_type { #>: <#= ty #><# } #> { +<# for v in &e.variants { #> +<#= indent(&doc_comment(&v.doc), 1) #> + <#= v.name #><# if let Some(val) = v.value { #> = <#= val #><# } #>, +<# } #> +} + +<# } + +for e in &self.bitflags { #> + +bitflags! { + <# if let Some(doc) = &e.doc { #> +<#= indent(&doc_comment(doc), 1) #> + <# } #> + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] + pub struct <#= e.name #>: <#= e.use_type.clone().unwrap_or_else(|| format!("u{}", e.bitwidth())) #> { + <# for v in &e.variants { #> +<#= indent(&doc_comment(&v.doc), 2) #> + const <#= v.name.to_shouty_snake_case() #><# if let Some(val) = v.value { #> = <#= val #><# } #>; + <# } #> + } +} +<# } #> diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/Errors.tt b/native/vendor/tsclientlib/utils/tsproto-types/build/Errors.tt new file mode 100644 index 0000000..e49d83c --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/Errors.tt @@ -0,0 +1,13 @@ +<#@ template cleanws="true" #> +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)] +#[non_exhaustive] +pub enum Error { +<# for e in &**self { #> + <# if !e.doc.is_empty() { #> +<#= indent(&doc_comment(&e.doc), 1) #> + <# } #> + <#= e.name.to_pascal_case() #> = <#= e.num #>, +<# } #> +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/Versions.tt b/native/vendor/tsclientlib/utils/tsproto-types/build/Versions.tt new file mode 100644 index 0000000..504ae7e --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/Versions.tt @@ -0,0 +1,41 @@ +<#@ template cleanws="true" #> +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[non_exhaustive] +#[allow(non_camel_case_types)] +pub enum Version { +<# for v in &**self { #> + <#= v.get_enum_name() #>, +<# } #> + Custom { platform: String, version: String, signature: Vec }, +} + +impl Version { + pub fn get_platform(&self) -> &str { + match *self { + <# for v in &**self { #> + Version::<#= v.get_enum_name() #> => "<#= v.platform #>", + <# } #> + Version::Custom { ref platform, .. } => platform, + } + } + + pub fn get_version_string(&self) -> &str { + match *self { + <# for v in &**self { #> + Version::<#= v.get_enum_name() #> => "<#= v.version #>", + <# } #> + Version::Custom { ref version, .. } => version, + } + } + + pub fn get_signature(&self) -> &[u8] { + match *self { + <# for v in &**self { #> + Version::<#= v.get_enum_name() #> => &[<#= v.get_sign_array() #>], + <# } #> + Version::Custom { ref signature, .. } => signature, + } + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/build.rs b/native/vendor/tsclientlib/utils/tsproto-types/build/build.rs new file mode 100644 index 0000000..43ed46a --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/build.rs @@ -0,0 +1,30 @@ +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::path::Path; + +mod enums; +mod errors; +mod versions; + +use crate::enums::Enums; +use crate::errors::Errors; +use crate::versions::Versions; + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap(); + + // Enums + let path = Path::new(&out_dir); + let mut structs = File::create(path.join("enums.rs")).unwrap(); + write!(&mut structs, "{}", Enums).unwrap(); + + // Errors + let path = Path::new(&out_dir); + let mut structs = File::create(path.join("errors.rs")).unwrap(); + write!(&mut structs, "{}", Errors).unwrap(); + + // Versions + let mut structs = File::create(path.join("versions.rs")).unwrap(); + write!(&mut structs, "{}", Versions).unwrap(); +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/enums.rs b/native/vendor/tsclientlib/utils/tsproto-types/build/enums.rs new file mode 100644 index 0000000..08e0b11 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/enums.rs @@ -0,0 +1,17 @@ +use std::ops::Deref; + +use heck::*; +use t4rust_derive::Template; +use tsproto_structs::enums; +use tsproto_structs::enums::*; +use tsproto_structs::{doc_comment, indent}; + +#[derive(Template)] +#[TemplatePath = "build/Enums.tt"] +#[derive(Default, Debug)] +pub struct Enums; + +impl Deref for Enums { + type Target = enums::Enums; + fn deref(&self) -> &Self::Target { &DATA } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/errors.rs b/native/vendor/tsclientlib/utils/tsproto-types/build/errors.rs new file mode 100644 index 0000000..cd9ade8 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/errors.rs @@ -0,0 +1,17 @@ +use std::ops::Deref; + +use heck::*; +use t4rust_derive::Template; +use tsproto_structs::errors::*; +use tsproto_structs::EnumValue; +use tsproto_structs::{doc_comment, indent}; + +#[derive(Template)] +#[TemplatePath = "build/Errors.tt"] +#[derive(Default, Debug)] +pub struct Errors; + +impl Deref for Errors { + type Target = Vec; + fn deref(&self) -> &Self::Target { &DATA.0 } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/build/versions.rs b/native/vendor/tsclientlib/utils/tsproto-types/build/versions.rs new file mode 100644 index 0000000..9ae1922 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/build/versions.rs @@ -0,0 +1,14 @@ +use std::ops::Deref; + +use t4rust_derive::Template; +use tsproto_structs::versions::*; + +#[derive(Template)] +#[TemplatePath = "build/Versions.tt"] +#[derive(Default, Debug)] +pub struct Versions; + +impl Deref for Versions { + type Target = Vec; + fn deref(&self) -> &Self::Target { &DATA.0 } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/src/crypto.rs b/native/vendor/tsclientlib/utils/tsproto-types/src/crypto.rs new file mode 100644 index 0000000..cc507a8 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/src/crypto.rs @@ -0,0 +1,609 @@ +//! This module contains cryptography related code. +use std::convert::TryInto; +use std::{cmp, fmt, str}; + +use base64::prelude::*; +use curve25519_dalek_ng::constants; +use curve25519_dalek_ng::edwards::{CompressedEdwardsY, EdwardsPoint}; +use curve25519_dalek_ng::scalar::Scalar; +use elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint}; +use generic_array::GenericArray; +use generic_array::typenum::Unsigned; +use num_bigint::{BigInt, Sign}; +use p256::ecdsa::signature::{Signer, Verifier}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use sha1::{Digest, Sha1}; +use simple_asn1::ASN1Block; +use thiserror::Error; + +type Result = std::result::Result; + +#[derive(Debug, Clone, Error)] +#[non_exhaustive] +pub enum Error { + #[error("More than one ASN.1 block")] + TooManyAsn1Blocks, + #[error("Invalid ASN.1: Expected a public key, not a private key")] + UnexpectedPrivateKey, + #[error("Invalid ASN.1: Does not contain a private key")] + NoPrivateKey, + #[error("Invalid ASN.1: Public key not found")] + PublicKeyNotFound, + #[error("Invalid ASN.1: Expected a bitstring")] + ExpectedBitString, + #[error("Invalid ASN.1: Expected a sequence")] + ExpectedSequence, + #[error("Key data is empty")] + EmptyKeyData, + #[error("Any known methods to decode the key failed")] + KeyDecodeError, + #[error("Failed to parse short private key")] + NoShortKey, + #[error("Not a obfuscated TeamSpeak key")] + NoObfuscatedKey, + #[error("Found no initial 'V' with a valid number before")] + NoCounterBlock, + #[error("Failed to parse public key")] + ParsePublicKeyFailed, + #[error("Wrong key length")] + WrongKeyLength, + #[error("Failed to parse public key, expected length {expected} but got {got}")] + WrongPublicKeyLength { expected: usize, got: usize }, + #[error("Wrong signature")] + WrongSignature { key: EccKeyPubP256, data: Vec, signature: Vec }, + + #[error(transparent)] + Asn1Decode(#[from] simple_asn1::ASN1DecodeErr), + #[error(transparent)] + Asn1Encode(#[from] simple_asn1::ASN1EncodeErr), + #[error(transparent)] + Base64(#[from] base64::DecodeError), + #[error(transparent)] + Utf8(#[from] std::str::Utf8Error), +} + +/// Xored onto saved identities in the TeamSpeak client settings file. +const IDENTITY_OBFUSCATION: [u8; 128] = *b"b9dfaa7bee6ac57ac7b65f1094a1c155\ + e747327bc2fe5d51c512023fe54a280201004e90ad1daaae1075d53b7d571c30e063b5a\ + 62a4a017bb394833aa0983e6e"; + +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +pub enum KeyType { + Public, + Private, +} + +/// A public ecc key. +/// +/// The curve of this key is P-256, or PRIME256v1 as it is called by openssl. +#[derive(Clone, Deserialize, Eq, PartialEq, Serialize)] +pub struct EccKeyPubP256( + #[serde( + deserialize_with = "deserialize_ecc_key_pub_p256", + serialize_with = "serialize_ecc_key_pub_p256" + )] + p256::PublicKey, +); +/// A private ecc key. +/// +/// The curve of this key is P-256, or PRIME256v1 as it is called by openssl. +#[derive(Clone)] +pub struct EccKeyPrivP256(p256::SecretKey); + +/// A public ecc key. +/// +/// The curve of this key is Ed25519. +#[derive(Clone)] +pub struct EccKeyPubEd25519(pub CompressedEdwardsY); +/// A private ecc key. +/// +/// The curve of this key is Ed25519. +#[derive(Clone)] +pub struct EccKeyPrivEd25519(pub Scalar); + +/// Passwords are encoded as base64(sha1(password)). +pub fn encode_password(password: &[u8]) -> String { + BASE64_STANDARD.encode(Sha1::digest(password).as_slice()) +} + +fn deserialize_ecc_key_pub_p256<'de, D: Deserializer<'de>>( + de: D, +) -> Result { + let data: Vec = Deserialize::deserialize(de)?; + Ok(EccKeyPubP256::from_short(&data).map_err(serde::de::Error::custom)?.0) +} + +fn serialize_ecc_key_pub_p256( + key: &p256::PublicKey, ser: S, +) -> Result { + Serialize::serialize(&EccKeyPubP256(*key).to_short().as_slice(), ser) +} + +impl fmt::Debug for EccKeyPubP256 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "EccKeyPubP256({})", self.to_ts()) + } +} + +impl fmt::Debug for EccKeyPrivP256 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "EccKeyPrivP256({})", BASE64_STANDARD.encode(self.to_short())) + } +} + +impl fmt::Debug for EccKeyPubEd25519 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "EccKeyPubEd25519({})", self.to_base64()) + } +} + +impl fmt::Debug for EccKeyPrivEd25519 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "EccKeyPrivEd25519({})", self.to_base64()) + } +} + +impl EccKeyPubP256 { + /// The shortest format of a public key. + /// + /// This is just the `BigNum` of the x and y coordinates concatenated in + /// this order. Each of the coordinates takes half of the size. + pub fn from_short(data: &[u8]) -> Result { + p256::PublicKey::from_sec1_bytes(data).map_err(|_| Error::ParsePublicKeyFailed).map(Self) + } + + /// From base64 encoded tomcrypt key. + pub fn from_ts(data: &str) -> Result { + Self::from_tomcrypt(&BASE64_STANDARD.decode(data)?) + } + + /// Decodes the public key from an ASN.1 DER object how tomcrypt stores it. + /// + /// The format is: + /// - `BitString` where the first bit is 1 if the private key is contained + /// - `Integer`: The key size (32) + /// - `Integer`: X coordinate of the public key + /// - `Integer`: Y coordinate of the public key + pub fn from_tomcrypt(data: &[u8]) -> Result { + let blocks = simple_asn1::from_der(data)?; + if blocks.len() != 1 { + return Err(Error::TooManyAsn1Blocks); + } + if let ASN1Block::Sequence(_, blocks) = &blocks[0] { + if let Some(ASN1Block::BitString(_, len, content)) = blocks.first() { + if *len != 1 || content[0] & 0x80 != 0 { + return Err(Error::UnexpectedPrivateKey); + } + if let (Some(ASN1Block::Integer(_, x)), Some(ASN1Block::Integer(_, y))) = + (blocks.get(2), blocks.get(3)) + { + let field_size = elliptic_curve::FieldBytesSize::::to_usize(); + let to_coord = |src: &BigInt| -> Result> { + let (sign, mut bytes) = src.to_bytes_le(); + if sign == Sign::Minus { + return Err(Error::ParsePublicKeyFailed); + } + if bytes.len() > field_size { + return Err(Error::WrongPublicKeyLength { + expected: field_size, + got: bytes.len(), + }); + } + // Pad if most significant bytes are zero + bytes.resize(field_size, 0); + // Convert to big-endian + bytes.reverse(); + Ok(*GenericArray::from_slice(&bytes)) + }; + let x_coord = to_coord(x)?; + let y_coord = to_coord(y)?; + let enc_point = p256::EncodedPoint::from_affine_coordinates( + &x_coord, + &y_coord, + false, + ); + let enc_point = p256::PublicKey::from_encoded_point(&enc_point); + if enc_point.is_some().into() { + Ok(Self(enc_point.unwrap())) + } else { + Err(Error::ParsePublicKeyFailed) + } + } else { + Err(Error::PublicKeyNotFound) + } + } else { + Err(Error::ExpectedBitString) + } + } else { + Err(Error::ExpectedSequence) + } + } + + /// Convert to base64 encoded public tomcrypt key. + pub fn to_ts(&self) -> String { BASE64_STANDARD.encode(self.to_tomcrypt()) } + + pub fn to_tomcrypt(&self) -> Vec { + let enc_point = self.0.as_affine().to_encoded_point(false); + // We can unwrap here, creating the public key ensures that it is not the identity point, + // which is the only time this returns `None`. + let pubkey_x = BigInt::from_bytes_be(Sign::Plus, enc_point.x().unwrap()); + let pubkey_y = BigInt::from_bytes_be(Sign::Plus, enc_point.y().unwrap()); + + // Only returns an error when encoding wrong objects, so fine to unwrap. + simple_asn1::to_der(&ASN1Block::Sequence(0, vec![ + ASN1Block::BitString(0, 1, vec![0]), + ASN1Block::Integer(0, 32.into()), + ASN1Block::Integer(0, pubkey_x), + ASN1Block::Integer(0, pubkey_y), + ])) + .unwrap() + } + + /// Get the SEC1 encoding of the public key point on the curve. + pub fn to_short(&self) -> Vec { + // TODO Maybe compress? + self.0.as_affine().to_encoded_point(false).as_bytes().to_vec() + } + + /// Compute the uid of this key without encoding it in base64. + /// + /// returns sha1(ts encoded key) + pub fn get_uid_no_base64(&self) -> Vec { + Sha1::digest(self.to_ts().as_bytes()).as_slice().to_vec() + } + + /// Compute the uid of this key. + /// + /// Uid = base64(sha1(ts encoded key)) + pub fn get_uid(&self) -> String { BASE64_STANDARD.encode(self.get_uid_no_base64()) } + + pub fn verify(&self, data: &[u8], signature: &[u8]) -> Result<()> { + let sig = + p256::ecdsa::Signature::from_der(signature).map_err(|_| Error::WrongSignature { + key: self.clone(), + data: data.to_vec(), + signature: signature.to_vec(), + })?; + let key = p256::ecdsa::VerifyingKey::from(&self.0); + key.verify(data, &sig).map_err(|_| Error::WrongSignature { + key: self.clone(), + data: data.to_vec(), + signature: signature.to_vec(), + }) + } + + // For the bookkeeping + #[allow(clippy::should_implement_trait)] + pub fn as_ref(&self) -> &Self { self } +} + +impl EccKeyPrivP256 { + /// Create a new key key pair. + pub fn create() -> Self { Self(p256::SecretKey::random(&mut rand::thread_rng())) } + + /// Try to import the key from any of the known formats. + pub fn import(data: &[u8]) -> Result { + if data.is_empty() { + return Err(Error::EmptyKeyData); + } + + if let Ok(s) = str::from_utf8(data) { + if let Ok(r) = Self::import_str(s) { + return Ok(r); + } + } + if let Ok(r) = Self::from_tomcrypt(data) { + return Ok(r); + } + if let Ok(r) = Self::from_short(data) { + return Ok(r); + } + Err(Error::KeyDecodeError) + } + + /// Try to import the key from any of the known formats. + pub fn import_str(s: &str) -> Result { + if let Ok(r) = BASE64_STANDARD.decode(s) { + if let Ok(r) = Self::import(&r) { + return Ok(r); + } + } + if let Ok(r) = Self::from_ts_obfuscated(s) { + return Ok(r); + } + Err(Error::KeyDecodeError) + } + + /// The shortest format of a private key. + /// + /// This is just the `BigNum` of the private key. + pub fn from_short(data: &[u8]) -> Result { + // TODO !! p256::SecretKey::from_bytes panics when the data is not 32 long !! + // maybe create a pull request for that because das not good?! + if data.len() != 32 { + Err(Error::NoShortKey) + } else { + Ok(Self( + p256::SecretKey::from_bytes(p256::FieldBytes::from_slice(data)) + .map_err(|_| Error::NoShortKey)?, + )) + } + } + + /// The shortest format of a private key. + /// + /// This is just the `BigNum` of the private key. + pub fn to_short(&self) -> elliptic_curve::FieldBytes { self.0.to_bytes() } + + /// From base64 encoded tomcrypt key. + pub fn from_ts(data: &str) -> Result { + Self::from_tomcrypt(&BASE64_STANDARD.decode(data)?) + } + + /// From the key representation which is used to store identities in the + /// TeamSpeak configuration file. + /// + /// Format: Offset for identity level || 'V' || obfuscated key + /// + /// This function takes only the obfuscated key without the level. + /// + /// Thanks to landave, who put + /// [his deobfuscation code](https://github.com/landave/TSIdentityTool) + /// under the MIT license. + pub fn from_ts_obfuscated(data: &str) -> Result { + let mut data = BASE64_STANDARD.decode(data)?; + if data.len() < 20 { + return Err(Error::NoObfuscatedKey); + } + // Hash everything until the first 0 byte, starting after the first 20 + // bytes. + let pos = data[20..].iter().position(|b| *b == b'\0').unwrap_or(data.len() - 20); + let hash = Sha1::digest(&data[20..20 + pos]); + let hash = hash.as_slice(); + // Xor first 20 bytes of data with the hash + for i in 0..20 { + data[i] ^= hash[i]; + } + + // Xor first 100 bytes with a static value + #[allow(clippy::needless_range_loop)] + for i in 0..cmp::min(data.len(), 100) { + data[i] ^= IDENTITY_OBFUSCATION[i]; + } + Self::from_ts(str::from_utf8(&data)?) + } + + /// Decodes the private key from an ASN.1 DER object how tomcrypt stores it. + /// + /// The format is: + /// - `BitString` where the first bit is 1 if the private key is contained + /// - `Integer`: The key size (32) + /// - `Integer`: X coordinate of the public key + /// - `Integer`: Y coordinate of the public key + /// - `Integer`: Private key + /// + /// The TS3AudioBot stores two 1 bits in the first `BitString` and omits the + /// public key. + pub fn from_tomcrypt(data: &[u8]) -> Result { + let blocks = simple_asn1::from_der(data)?; + if blocks.len() != 1 { + return Err(Error::TooManyAsn1Blocks); + } + if let ASN1Block::Sequence(_, blocks) = &blocks[0] { + if let Some(ASN1Block::BitString(_, len, content)) = blocks.first() { + if (*len != 1 && *len != 2) || content[0] & 0x80 == 0 { + return Err(Error::NoPrivateKey); + } + if *len == 1 { + if let Some(ASN1Block::Integer(_, i)) = blocks.get(4) { + Self::from_short(&i.to_bytes_be().1) + } else { + Err(Error::NoPrivateKey) + } + } else if let Some(ASN1Block::Integer(_, i)) = blocks.get(2) { + Self::from_short(&i.to_bytes_be().1) + } else { + Err(Error::NoPrivateKey) + } + } else { + Err(Error::ExpectedBitString) + } + } else { + Err(Error::ExpectedSequence) + } + } + + /// Convert to base64 encoded private tomcrypt key. + pub fn to_ts(&self) -> String { BASE64_STANDARD.encode(self.to_tomcrypt()) } + + /// Store as obfuscated TeamSpeak identity. + pub fn to_ts_obfuscated(&self) -> String { + let mut data = self.to_ts().into_bytes(); + // Xor first 100 bytes with a static value + #[allow(clippy::needless_range_loop)] + for i in 0..cmp::min(data.len(), 100) { + data[i] ^= IDENTITY_OBFUSCATION[i]; + } + + // Hash everything until the first 0 byte, starting after the first 20 + // bytes. + let pos = data[20..].iter().position(|b| *b == b'\0').unwrap_or(data.len() - 20); + let hash = Sha1::digest(&data[20..20 + pos]); + let hash = hash.as_slice(); + // Xor first 20 bytes of data with the hash + for i in 0..20 { + data[i] ^= hash[i]; + } + BASE64_STANDARD.encode(data) + } + + pub fn to_tomcrypt(&self) -> Vec { + let enc_point = self.0.public_key().as_affine().to_encoded_point(false); + // We can unwrap here, creating the public key ensures that it is not the identity point, + // which is the only time this returns `None`. + let pubkey_x = BigInt::from_bytes_be(Sign::Plus, enc_point.x().unwrap()); + let pubkey_y = BigInt::from_bytes_be(Sign::Plus, enc_point.y().unwrap()); + let privkey = BigInt::from_bytes_be(Sign::Plus, &self.0.to_bytes()); + + // Only returns an error when encoding wrong objects, so fine to unwrap. + simple_asn1::to_der(&ASN1Block::Sequence(0, vec![ + ASN1Block::BitString(0, 1, vec![0x80]), + ASN1Block::Integer(0, 32.into()), + ASN1Block::Integer(0, pubkey_x), + ASN1Block::Integer(0, pubkey_y), + ASN1Block::Integer(0, privkey), + ])) + .unwrap() + } + + /// This has to be the private key, the other one has to be the public key. + pub fn create_shared_secret( + self, other: EccKeyPubP256, + ) -> elliptic_curve::ecdh::SharedSecret { + elliptic_curve::ecdh::diffie_hellman(self.0.to_nonzero_scalar(), other.0.as_affine()) + } + + pub fn sign(self, data: &[u8]) -> Vec { + let key = p256::ecdsa::SigningKey::from(self.0); + let sig: p256::ecdsa::DerSignature = key.sign(data); + sig.as_bytes().to_vec() + } + + pub fn to_pub(&self) -> EccKeyPubP256 { self.into() } +} + +impl<'a> From<&'a EccKeyPrivP256> for EccKeyPubP256 { + fn from(priv_key: &'a EccKeyPrivP256) -> Self { Self(priv_key.0.public_key()) } +} + +impl EccKeyPubEd25519 { + pub fn from_bytes(data: [u8; 32]) -> Self { EccKeyPubEd25519(CompressedEdwardsY(data)) } + + pub fn from_base64(data: &str) -> Result { + let decoded = BASE64_STANDARD.decode(data)?; + if decoded.len() != 32 { + return Err(Error::WrongKeyLength); + } + Ok(Self::from_bytes(decoded[..32].try_into().unwrap())) + } + + pub fn to_base64(&self) -> String { + let EccKeyPubEd25519(CompressedEdwardsY(ref data)) = *self; + BASE64_STANDARD.encode(data) + } +} + +impl EccKeyPrivEd25519 { + /// This is not used to create TeamSpeak keys, as they are not canonical. + pub fn create() -> Self { EccKeyPrivEd25519(Scalar::random(&mut rand::thread_rng())) } + + pub fn from_base64(data: &str) -> Result { + let decoded = BASE64_STANDARD.decode(data)?; + if decoded.len() != 32 { + return Err(Error::WrongKeyLength); + } + Ok(Self::from_bytes(decoded[..32].try_into().unwrap())) + } + + pub fn from_bytes(data: [u8; 32]) -> Self { + EccKeyPrivEd25519(Scalar::from_bytes_mod_order(data)) + } + + pub fn to_base64(&self) -> String { BASE64_STANDARD.encode(self.0.as_bytes()) } + + /// This has to be the private key, the other one has to be the public key. + pub fn create_shared_secret(&self, pub_key: &EdwardsPoint) -> [u8; 32] { + let res = pub_key * self.0; + res.compress().0 + } + + pub fn to_pub(&self) -> EccKeyPubEd25519 { self.into() } +} + +impl<'a> From<&'a EccKeyPrivEd25519> for EccKeyPubEd25519 { + fn from(priv_key: &'a EccKeyPrivEd25519) -> Self { + Self((&constants::ED25519_BASEPOINT_TABLE * &priv_key.0).compress()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + const TEST_PRIV_KEY: &str = "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTA\ + O2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nmDB\ + nmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI"; + + #[test] + fn parse_p256_priv_key() { EccKeyPrivP256::from_ts(TEST_PRIV_KEY).unwrap(); } + + #[test] + fn p256_ecdh() { + let priv_key1 = EccKeyPrivP256::create(); + let pub_key1 = priv_key1.to_pub(); + let priv_key2 = EccKeyPrivP256::create(); + let pub_key2 = priv_key2.to_pub(); + + let res1 = priv_key1.create_shared_secret(pub_key2); + let res2 = priv_key2.create_shared_secret(pub_key1); + assert_eq!(res1.raw_secret_bytes(), res2.raw_secret_bytes()); + } + + #[test] + fn p256_signature() { + let license = + "AQBM0LZCVmZ7CX/\ + miewqdjOyuKa6kI78Fk43LoypifqOkAIOkvUAEn46gAcAAAAgQW5vbnltb3VzAABoruUa34pO9zy1Z5zIOmrkIO06lKg/\ + +mBrg6Mw1Rg4OyAPa7A3D2xY9w=="; + let server_key = "MEwDAgcAAgEgAiEA96WgYeYU8zoPqXJqicita+rR92FvnTlxYcUUyIDkQ6cCIE/\ + KPo+ms3BEzN/HBR71BJ/Z1Fv8918mdDKLetbOGKWt"; + let signature = "MEUCIQC+ececxC0NCcuCtrXHAO5h7qbh1s/TGP/\ + AaHa6+wV38wIgV9wwSppEdGjwuH3ETAME9tDj3aNkNvL25i0ikF9vs8M="; + let license = BASE64_STANDARD.decode(license).unwrap(); + let signature = BASE64_STANDARD.decode(signature).unwrap(); + let server_key = EccKeyPubP256::from_ts(server_key).unwrap(); + server_key.verify(&license, &signature).unwrap(); + } + + #[test] + fn obfuscated_priv_key() { + let key = EccKeyPrivP256::from_ts(TEST_PRIV_KEY).unwrap(); + let obf = key.to_ts_obfuscated(); + let key2 = EccKeyPrivP256::from_ts_obfuscated(&obf).unwrap(); + assert_eq!(key.to_short(), key2.to_short()); + } + + #[test] + fn obfuscated_identity() { + let key = EccKeyPrivP256::from_ts(TEST_PRIV_KEY).unwrap(); + let uid = key.to_pub().get_uid(); + + let expected_uid = "lks7QL5OVMKo4pZ79cEOI5r5oEA="; + assert_eq!(expected_uid, &uid); + } + + #[test] + fn tsaudiobot_identity() { + let key = EccKeyPrivP256::import_str( + "MCkDAgbAAgEgAiBhPImh+bO1xMGOrcplwN3G74bhE9XATm+DxVo3aNtBqg==", + ) + .unwrap(); + let uid = key.to_pub().get_uid(); + let expected_uid = "test/9PZ9vww/Bpf5vJxtJhpz80="; + assert_eq!(expected_uid, &uid); + } + + #[test] + fn test_p256_priv_key_short() { + let key = EccKeyPrivP256::from_ts(TEST_PRIV_KEY).unwrap(); + let short = key.to_short(); + let key = EccKeyPrivP256::from_short(short.as_slice()).unwrap(); + let short2 = key.to_short(); + assert_eq!(short, short2); + } + + #[test] + fn parse_ed25519_pub_key() { + EccKeyPubEd25519::from_base64("zQ3irtRjRVCafjz9j2iz3HVVsp3M7HPNGHUPmTgSQIo=").unwrap(); + } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/src/errors.rs b/native/vendor/tsclientlib/utils/tsproto-types/src/errors.rs new file mode 100644 index 0000000..d201ad3 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/src/errors.rs @@ -0,0 +1,13 @@ +use std::fmt; + +use num_derive::{FromPrimitive, ToPrimitive}; + +include!(concat!(env!("OUT_DIR"), "/errors.rs")); + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self, f) } +} + +impl std::error::Error for Error { + fn description(&self) -> &str { "TeamSpeak error" } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/src/lib.rs b/native/vendor/tsclientlib/utils/tsproto-types/src/lib.rs new file mode 100644 index 0000000..84a69af --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/src/lib.rs @@ -0,0 +1,173 @@ +//! `tsproto-types` contains basic types and enums that are used within the TeamSpeak protocol. + +use std::borrow::{Borrow, Cow}; +use std::fmt; + +use base64::prelude::*; +use bitflags::bitflags; +use num_derive::{FromPrimitive, ToPrimitive}; +use ref_cast::RefCast; +use serde::{Deserialize, Deserializer, Serialize}; +use time::OffsetDateTime; + +pub mod crypto; +pub mod errors; +pub mod versions; + +include!(concat!(env!("OUT_DIR"), "/enums.rs")); + +/// A `ClientId` identifies a client which is connected to a server. +/// +/// Every client that we see on a server has a `ClientId`, even our own +/// connection. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ClientId(pub u16); +/// Describes a client or server uid which is a base64 +/// encoded hash or a special reserved name. +/// +/// This is saved raw, so the base64-decoded TeamSpeak uid. +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct UidBuf(pub Vec); + +#[derive(Debug, Eq, PartialEq, RefCast, Serialize)] +#[repr(transparent)] +pub struct Uid(pub [u8]); + +impl ToOwned for Uid { + type Owned = UidBuf; + fn to_owned(&self) -> Self::Owned { UidBuf(self.0.to_owned()) } +} +impl Borrow for UidBuf { + fn borrow(&self) -> &Uid { Uid::ref_cast(self.0.borrow()) } +} +impl AsRef for UidBuf { + fn as_ref(&self) -> &Uid { self.borrow() } +} +impl core::ops::Deref for UidBuf { + type Target = Uid; + fn deref(&self) -> &Self::Target { self.borrow() } +} +impl<'a> From<&'a Uid> for Cow<'a, Uid> { + fn from(u: &'a Uid) -> Self { Cow::Borrowed(u) } +} + +impl Uid { + pub fn from_bytes(data: &'_ [u8]) -> &Self { Uid::ref_cast(data) } + + /// TeamSpeak uses a different encoding of the uid for fetching avatars. + /// + /// The raw data (base64-decoded) is encoded in hex, but instead of using + /// [0-9a-f] with [a-p]. + pub fn as_avatar(&self) -> String { + let mut res = String::with_capacity(self.0.len() * 2); + for b in &self.0 { + res.push((b'a' + (b >> 4)) as char); + res.push((b'a' + (b & 0xf)) as char); + } + res + } + + pub fn is_server_admin(&self) -> bool { &self.0 == b"ServerAdmin" } +} + +impl<'a, 'de: 'a> Deserialize<'de> for &'a Uid { + fn deserialize(d: D) -> Result<&'a Uid, D::Error> + where D: Deserializer<'de> { + let data = <&[u8]>::deserialize(d)?; + Ok(Uid::from_bytes(data)) + } +} + +/// The database id of a client. +/// +/// This is the id which is saved for a client in the database of one specific +/// server. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ClientDbId(pub u64); + +/// Identifies a channel on a server. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ChannelId(pub u64); + +/// Identifies a server group on a server. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ServerGroupId(pub u64); + +/// Identifies a channel group on a server. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ChannelGroupId(pub u64); + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct IconId(pub u32); + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct Permission(pub u32); +impl Permission { + /// Never fails + pub fn from_u32(i: u32) -> Option { Some(Permission(i)) } + /// Never fails + pub fn to_u32(self) -> Option { Some(self.0) } +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum ClientType { + Normal, + /// Server query client + Query { + admin: bool, + }, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum MaxClients { + Unlimited, + Inherited, + Limited(u16), +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct TalkPowerRequest { + pub time: OffsetDateTime, + pub message: String, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct Invoker { + pub name: String, + pub id: ClientId, + pub uid: Option, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct InvokerRef<'a> { + pub name: &'a str, + pub id: ClientId, + pub uid: Option<&'a Uid>, +} + +impl Invoker { + pub fn as_ref(&self) -> InvokerRef<'_> { + InvokerRef { name: &self.name, id: self.id, uid: self.uid.as_ref().map(|u| u.as_ref()) } + } +} + +impl fmt::Display for ClientId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } +} +impl fmt::Display for Uid { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", BASE64_STANDARD.encode(&self.0)) + } +} +impl fmt::Display for ClientDbId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } +} +impl fmt::Display for ChannelId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } +} +impl fmt::Display for ServerGroupId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } +} +impl fmt::Display for ChannelGroupId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } +} diff --git a/native/vendor/tsclientlib/utils/tsproto-types/src/versions.rs b/native/vendor/tsclientlib/utils/tsproto-types/src/versions.rs new file mode 100644 index 0000000..3e5fbc6 --- /dev/null +++ b/native/vendor/tsclientlib/utils/tsproto-types/src/versions.rs @@ -0,0 +1,9 @@ +use std::fmt; + +include!(concat!(env!("OUT_DIR"), "/versions.rs")); + +impl fmt::Display for Version { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{} {}", self.get_platform(), self.get_version_string()) + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..eab4ea7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,60 @@ +{ + "name": "voxharbor", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "voxharbor", + "version": "0.1.0", + "dependencies": { + "ipaddr.js": "^2.2.0", + "libopus-wasm": "0.3.0", + "ws": "^8.18.3" + }, + "engines": { + "node": "22.x" + }, + "license": "MIT" + }, + "node_modules/ipaddr.js": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.5.0.tgz", + "integrity": "sha512-aq+t5NAc+cS6rZQQVWC2x98CPqGtKKTMDd4Gaodv0wShnItdKg/51djkGJ1hqH+Oy0ivDftCbSLCQob8zso01w==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/libopus-wasm": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/libopus-wasm/-/libopus-wasm-0.3.0.tgz", + "integrity": "sha512-2+woONr9rwcSj6HMQDC+cEdCb/WRBDwqHXEc42hhFLRB/jEumgl90ku09Blk6zb0Wd3Sewvk6KJEGhBg3IjApQ==", + "license": "MIT", + "engines": { + "node": ">=22" + } + }, + "node_modules/ws": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz", + "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..52d47f9 --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "voxharbor", + "version": "0.1.0", + "private": true, + "type": "module", + "engines": { + "node": "22.x" + }, + "scripts": { + "dev": "node scripts/prepare-audio.mjs && node --env-file-if-exists=.env.local scripts/dev.mjs", + "test": "node --test tests/*.test.mjs", + "check": "node scripts/check.mjs", + "owner:hash": "node scripts/hash-password.mjs", + "owner:setup": "node scripts/hash-password.mjs --save", + "identity:key": "node scripts/identity-key.mjs", + "native:build": "node scripts/prepare-audio.mjs && node scripts/build-native.mjs", + "audio:qa": "node scripts/prepare-audio.mjs && node scripts/audio-browser-qa.mjs", + "deployment:package": "node scripts/package-deployment.mjs", + "publication:check": "node scripts/publication-check.mjs", + "publication:package": "node scripts/package-publication.mjs", + "icons:build": "node scripts/generate-app-icons.mjs" + }, + "dependencies": { + "ipaddr.js": "^2.2.0", + "libopus-wasm": "0.3.0", + "ws": "^8.18.3" + }, + "description": "Private, self-hosted TeamSpeak 3 web client", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/MeghdadFadaee/VoxHarbor.git" + }, + "bugs": { + "url": "https://github.com/MeghdadFadaee/VoxHarbor/issues" + } +} diff --git a/public/app.mjs b/public/app.mjs new file mode 100644 index 0000000..9cc105d --- /dev/null +++ b/public/app.mjs @@ -0,0 +1,93 @@ +import { safeDiagnostic } from './connection-diagnostics.mjs'; +import { loadProtocol, resetProtocol } from './protocol.mjs'; +import { loadWorkspace, resetWorkspace } from './workspace.mjs'; +const $ = id => document.getElementById(id); +let csrf; +document.querySelector('.skip-link').addEventListener('click', event => { + event.preventDefault(); + const target = $('lab').hidden ? $('username') : document.querySelector('section[data-page]:not(#lab):not([hidden])'); + if (!target) return; if (target.tagName === 'SECTION') target.setAttribute('tabindex', '-1'); target.focus(); target.scrollIntoView({ block: 'start' }); +}); +let registering = false; let registrationEnabled = false; let ownerAvailable = false; let authBusy = false; +const authChannel = typeof BroadcastChannel === 'function' ? new BroadcastChannel('voxharbor-auth') : null; +authChannel?.addEventListener('message', () => { locked(); $('notice').textContent = 'Sign-in changed in another tab. Sign in to continue.'; }); +$('notice-dismiss').addEventListener('click', () => { $('notice').textContent = ''; }); +new MutationObserver(() => { $('notice-toast').hidden = !$('notice').textContent; }).observe($('notice'), { childList: true, characterData: true, subtree: true }); +function authMode() { + $('welcome').dataset.authMode = registering ? 'register' : 'login'; $('auth-route').textContent = registering ? 'ACCOUNT / CREATE ACCOUNT' : 'ACCOUNT / SIGN IN'; + $('auth-title').textContent = registering ? 'Your own place on the dial.' : 'Welcome back.'; $('auth-eyebrow').textContent = registering ? 'CREATE ACCOUNT' : 'SIGN IN'; + $('auth-submit').textContent = registering ? 'Create account' : 'Sign in'; + $('auth-toggle').textContent = registering ? 'Already registered? Sign in' : 'Create an account'; + $('auth-toggle').hidden = !registrationEnabled; + $('confirm-field').hidden = !registering; $('confirm-password').required = registering; + $('password').autocomplete = registering ? 'new-password' : 'current-password'; + $('password').minLength = registering ? 16 : 0; + $('auth-hint').textContent = registering ? 'Use 16–256 characters for your password. Keep it safe; password recovery is not available yet.' : 'Your identity and saved connections belong to your account.'; +} +$('auth-toggle').addEventListener('click', () => { if (authBusy) return; registering = !registering; $('password').value = ''; $('confirm-password').value = ''; $('auth-status').textContent = ''; $('notice').textContent = ''; authMode(); }); +async function loadAuth() { + try { const options = await api('/api/auth'); registrationEnabled = options.registrationEnabled; ownerAvailable = options.ownerAvailable; authMode(); $('auth-submit').disabled = false; } + catch { $('auth-status').textContent = 'Sign-in is unavailable. Reload to try again.'; } +} +let sessionGeneration = 0; +const evidence = { schema: 'voxharbor-diagnostics-v1', startedAt: new Date().toISOString(), events: [] }; +function record(type, data) { + evidence.events.push({ at: new Date().toISOString(), type, data }); + if (evidence.events.length > 1000) evidence.events.shift(); + $('events').textContent = JSON.stringify(evidence.events.slice(-30), null, 2); +} +window.addEventListener('voxharbor-protocol-diagnostic', event => record('protocol', safeDiagnostic(event.detail))); +for (const type of ['online', 'offline']) window.addEventListener(type, () => record('browser', { state: type })); +document.addEventListener('visibilitychange', () => record('browser', { state: document.hidden ? 'hidden' : 'visible' })); +async function api(path, body) { + const response = await fetch(path, { + signal: AbortSignal.timeout(15000), method: body === undefined ? 'GET' : 'POST', + headers: body === undefined ? {} : { 'Content-Type': 'application/json', ...(csrf ? { 'X-CSRF-Token': csrf } : {}) }, + ...(body === undefined ? {} : { body: JSON.stringify(body) }), + }); + const data = await response.json(); + if (!response.ok) throw Object.assign(new Error(data.error || `Request failed (${response.status})`), { status: response.status }); + return data; +} +function locked() { + ++sessionGeneration; registering = false; authMode(); $('auth-status').textContent = ''; $('password').value = ''; $('confirm-password').value = ''; + resetProtocol(); resetWorkspace(); csrf = undefined; $('account-label').textContent = 'Your account'; $('account-label').setAttribute('aria-label', 'Account settings'); $('own-initials').textContent = '—'; + evidence.events.length = 0; $('events').textContent = 'No connection diagnostics recorded.'; + $('login').hidden = false; $('lab').hidden = true; $('welcome').hidden = false; + window.scrollTo(0, 0); +} +window.addEventListener('voxharbor-owner-expired', () => { + locked(); $('notice').textContent = 'Your session expired or was signed out. Sign in to reconnect.'; +}); +async function loadSession() { + const generation = sessionGeneration; + const data = await api('/api/session'); + if (generation !== sessionGeneration) return; + csrf = data.csrf; $('account-label').textContent = data.user.username; $('account-label').setAttribute('aria-label', `Account settings for ${data.user.username}`); $('own-initials').textContent = [...data.user.username].slice(0, 2).join('').toUpperCase(); $('profile-account-name').textContent = data.user.username; + $('login').hidden = true; $('lab').hidden = false; $('welcome').hidden = true; + $('runtime').textContent = `${data.runtime.environment} · ${data.runtime.node} · ${data.runtime.sessionStore}`; + record('runtime', { node: data.runtime.node, platform: data.runtime.platform, arch: data.runtime.arch, sessionStore: data.runtime.sessionStore }); + void loadProtocol(csrf); void loadWorkspace(csrf); +} +$('login').addEventListener('submit', async event => { + event.preventDefault(); if (authBusy) return; + if (registering && $('password').value !== $('confirm-password').value) { $('auth-status').textContent = 'Passwords do not match.'; return; } + const button = $('auth-submit'); authBusy = true; button.disabled = true; $('auth-toggle').disabled = true; $('auth-status').textContent = ''; + try { + await api(registering ? '/api/register' : '/api/login', { username: $('username').value, password: $('password').value }); $('password').value = ''; $('confirm-password').value = ''; + locked(); authChannel?.postMessage('changed'); await loadSession(); window.scrollTo(0, 0); $('notice').textContent = ''; + } catch (error) { $('auth-status').textContent = error.message; } + finally { $('password').value = ''; $('confirm-password').value = ''; authBusy = false; button.disabled = false; $('auth-toggle').disabled = false; } +}); +$('logout').addEventListener('click', async () => { + resetProtocol(); + try { await api('/api/logout', {}); locked(); authChannel?.postMessage('changed'); $('notice').textContent = 'Signed out. Session revoked.'; } + catch { locked(); $('notice').textContent = 'Connection stopped. Server sign-out could not be confirmed; retry when storage is available.'; } +}); +$('download').addEventListener('click', () => { + const url = URL.createObjectURL(new Blob([JSON.stringify(evidence, null, 2)], { type: 'application/json' })); + const link = document.createElement('a'); link.href = url; link.download = 'voxharbor-diagnostics.json'; link.click(); + setTimeout(() => URL.revokeObjectURL(url), 1000); +}); +void loadAuth(); +loadSession().catch(() => locked()); diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..92c030b Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/audio-recovery.mjs b/public/audio-recovery.mjs new file mode 100644 index 0000000..f4da0fd --- /dev/null +++ b/public/audio-recovery.mjs @@ -0,0 +1,29 @@ +// Choices live only in this signed-in page, never in shared browser storage. +export class AudioRecovery { + constructor() { this.clear(); } + clear() { this.pending = undefined; this.generation = (this.generation || 0) + 1; } + interrupted(audio, resumeMicrophone, visible) { + if (!audio) return; + this.pending = !audio.outputMuted ? { microphone: !audio.muted && resumeMicrophone && visible } : undefined; + } + async restore({ visible, create, valid, output = '', microphone = '', resumeMicrophone, status }) { + const choice = this.pending; this.pending = undefined; + if (!choice || !visible) return; + const generation = this.generation; + const active = create(); + this.restoring = active; + const current = () => generation === this.generation && valid(active); + try { + await active.listen(true); + if (!current()) return; + if (output && typeof active.context?.setSinkId === 'function') await active.context.setSinkId(output); + if (!current()) return; + if (choice.microphone && resumeMicrophone()) await active.microphone(microphone); + if (current()) status(choice.microphone && !active.muted ? 'Listening and microphone resumed after reconnect.' : 'Listening resumed. Microphone remains off.'); + } catch { + if (current()) { active.mute(); status('Audio could not resume automatically. Enable listening and the microphone to retry.'); } + } finally { + if (this.restoring === active) this.restoring = undefined; + } + } +} diff --git a/public/channel-order.mjs b/public/channel-order.mjs new file mode 100644 index 0000000..2f8b72a --- /dev/null +++ b/public/channel-order.mjs @@ -0,0 +1,47 @@ +// TeamSpeak channel_order is the preceding sibling's ID, not a numeric rank. +export function orderChannels(channels) { + const byId = new Map(channels.map(channel => [channel.id, channel])); + const groups = new Map(); + for (const channel of channels) { + const parent = channel.parentId && byId.has(channel.parentId) ? channel.parentId : 0; + if (!groups.has(parent)) groups.set(parent, []); + groups.get(parent).push(channel); + } + function siblings(group = []) { + const ids = new Set(group.map(channel => channel.id)); + const links = new Map(); + const seen = new Set(); + const ordered = []; + const sorted = [...group].sort((a, b) => a.id - b.id); + for (const channel of sorted) { + if (!links.has(channel.order)) links.set(channel.order, []); + links.get(channel.order).push(channel); + } + const starts = [...sorted.filter(channel => !ids.has(channel.order)), ...sorted]; + for (const start of starts) { + const queue = [start]; + while (queue.length) { + const channel = queue.pop(); + if (seen.has(channel.id)) continue; + seen.add(channel.id); + ordered.push(channel); + queue.push(...[...(links.get(channel.id) || [])].reverse()); + } + } + return ordered; + } + const visited = new Set(); + const result = []; + const roots = [...siblings(groups.get(0)), ...channels]; + for (const root of roots) { + const stack = [{ channel: root, depth: 0 }]; + while (stack.length) { + const item = stack.pop(); + if (visited.has(item.channel.id)) continue; + visited.add(item.channel.id); + result.push(item); + stack.push(...siblings(groups.get(item.channel.id)).reverse().map(channel => ({ channel, depth: Math.min(item.depth + 1, 10) }))); + } + } + return result; +} diff --git a/public/connection-diagnostics.mjs b/public/connection-diagnostics.mjs new file mode 100644 index 0000000..884c1f6 --- /dev/null +++ b/public/connection-diagnostics.mjs @@ -0,0 +1,12 @@ +// Explicit fields only: no URLs, close reasons, messages, account IDs or media. +const numbers = new Set(['attempt', 'delay', 'closeCode', 'durationMs', 'lastMessageAgeMs', 'roundTripMs', 'channels', 'participants', 'sequence']); +const words = new Set(['type', 'state', 'stage', 'code']); +export function safeDiagnostic(input) { + const result = {}; + for (const [key, value] of Object.entries(input || {})) { + if (numbers.has(key) && Number.isFinite(value) && value >= 0) result[key] = value; + if (words.has(key) && typeof value === 'string' && /^[a-z][a-z_]{0,63}$/.test(value)) result[key] = value; + if (key === 'receivedState' && typeof value === 'boolean') result[key] = value; + } + return result; +} diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..3c0a5bf Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..04aecf5 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..0162f52 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..58b9901 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1 @@ + diff --git a/public/fonts/OFL.txt b/public/fonts/OFL.txt new file mode 100644 index 0000000..01497cc --- /dev/null +++ b/public/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/public/fonts/ibm-plex-mono-medium.ttf b/public/fonts/ibm-plex-mono-medium.ttf new file mode 100644 index 0000000..54927d5 Binary files /dev/null and b/public/fonts/ibm-plex-mono-medium.ttf differ diff --git a/public/fonts/ibm-plex-mono-regular.ttf b/public/fonts/ibm-plex-mono-regular.ttf new file mode 100644 index 0000000..02d682c Binary files /dev/null and b/public/fonts/ibm-plex-mono-regular.ttf differ diff --git a/public/fonts/ibm-plex-sans-medium.ttf b/public/fonts/ibm-plex-sans-medium.ttf new file mode 100644 index 0000000..c43bbf1 Binary files /dev/null and b/public/fonts/ibm-plex-sans-medium.ttf differ diff --git a/public/fonts/ibm-plex-sans-regular.ttf b/public/fonts/ibm-plex-sans-regular.ttf new file mode 100644 index 0000000..af2edfe Binary files /dev/null and b/public/fonts/ibm-plex-sans-regular.ttf differ diff --git a/public/fonts/ibm-plex-sans-semibold.ttf b/public/fonts/ibm-plex-sans-semibold.ttf new file mode 100644 index 0000000..bd1c0c4 Binary files /dev/null and b/public/fonts/ibm-plex-sans-semibold.ttf differ diff --git a/public/icons/app-192.png b/public/icons/app-192.png new file mode 100644 index 0000000..d57bb01 Binary files /dev/null and b/public/icons/app-192.png differ diff --git a/public/icons/app-512.png b/public/icons/app-512.png new file mode 100644 index 0000000..dd11a61 Binary files /dev/null and b/public/icons/app-512.png differ diff --git a/public/icons/app-maskable-512.png b/public/icons/app-maskable-512.png new file mode 100644 index 0000000..6171a78 Binary files /dev/null and b/public/icons/app-maskable-512.png differ diff --git a/public/icons/headphones.svg b/public/icons/headphones.svg new file mode 100644 index 0000000..c06b034 --- /dev/null +++ b/public/icons/headphones.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/microphone.svg b/public/icons/microphone.svg new file mode 100644 index 0000000..a840e23 --- /dev/null +++ b/public/icons/microphone.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/icons/safari-pinned-tab.svg b/public/icons/safari-pinned-tab.svg new file mode 100644 index 0000000..fe5c36a --- /dev/null +++ b/public/icons/safari-pinned-tab.svg @@ -0,0 +1 @@ + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..04f0395 --- /dev/null +++ b/public/index.html @@ -0,0 +1,4 @@ +VoxHarbor · Voice console

YOUR OWN DESTINATIONS

Your rooms, remembered.

Keep your connections and nickname in your account.

YOUR OWN IDENTITY

A familiar voice.

Create or import your TeamSpeak identity after signing up.

Use 3–32 letters, numbers, underscores or hyphens for your username. Passwords need 16–256 characters.

Password recovery is not available. Keep your password safe.

SIGN IN

Welcome back.

Use your account on this instance.

Loading sign-in options…

A VoxHarbor account is separate from a TeamSpeak identity.
Set up or import your identity after signing in.
VOXHARBOR / TEAMSPEAK 3Your account / Your saved destinations
+
\ No newline at end of file diff --git a/public/jitter-buffer.mjs b/public/jitter-buffer.mjs new file mode 100644 index 0000000..927b2f8 --- /dev/null +++ b/public/jitter-buffer.mjs @@ -0,0 +1,40 @@ +// Packet sequence numbers wrap at 65536. A talk spurt begins after 60 ms. +export const sequenceDistance = (a, b) => ((a - b + 32768) & 65535) - 32768; +export class JitterBuffer { + constructor({ capacity = 12, prebuffer = 3, maxLoss = 3 } = {}) { + this.capacity = capacity; this.prebuffer = prebuffer; this.maxLoss = maxLoss; + this.packets = new Map(); this.expected = null; this.wait = 0; this.loss = 0; + this.stats = { late: 0, duplicate: 0, overflow: 0, lost: 0, received: 0 }; + } + clear() { this.packets.clear(); this.expected = null; this.wait = 0; this.loss = 0; } + push(packet) { + const id = packet.sequence; + this.stats.received++; + if (this.expected === null) { this.expected = id; this.wait = this.prebuffer; } + const delta = sequenceDistance(id, this.expected); + if (delta < 0) { this.stats.late++; return false; } + if (this.packets.has(id)) { this.stats.duplicate++; return false; } + if (delta >= this.capacity || this.packets.size >= this.capacity) { + this.clear(); this.expected = id; this.wait = this.prebuffer; + this.stats.overflow++; + } + this.packets.set(id, packet); + return true; + } + pull() { + if (this.expected === null) return { type: 'idle' }; + if (this.wait > 0) { this.wait--; return { type: 'wait' }; } + const packet = this.packets.get(this.expected); + this.packets.delete(this.expected); + this.expected = (this.expected + 1) & 65535; + if (packet) { + this.loss = 0; + if (packet.end) { this.clear(); return { type: 'end' }; } + return { type: 'packet', packet }; + } + this.stats.lost++; this.loss++; + if (this.loss >= this.maxLoss) { this.clear(); return { type: 'end' }; } + // The next packet may carry in-band FEC for exactly this missing packet. + return { type: 'loss', next: this.packets.get(this.expected) }; + } +} diff --git a/public/protocol-connection.mjs b/public/protocol-connection.mjs new file mode 100644 index 0000000..df1eb67 --- /dev/null +++ b/public/protocol-connection.mjs @@ -0,0 +1,153 @@ +// Reconnects carry only a saved-settings ID; credentials stay on the backend. +const retryable = new Set(['connection_failed', 'handshake_timeout', 'server_initialization_timeout', 'protocol_network_error', 'native_protocol_failed', 'session_lease_lost', 'another_session_is_active', 'connection_rate_limit', 'owner_transport_timeout']); +const advisory = new Set(['server_permission_or_command_error', 'subscription_unavailable', 'connection_settings_not_saved']); + +export class ProtocolConnection { + constructor({ url, session, socket = address => new WebSocket(address), phase = () => {}, event = () => {}, disconnected = () => {}, expired = () => {}, diagnostic = () => {}, + now = () => Date.now(), later = (fn, ms) => setTimeout(fn, ms), cancel = timer => clearTimeout(timer), random = Math.random }) { + Object.assign(this, { url, session, createSocket: socket, phase, event, disconnected, expired, diagnostic, now, later, cancel, random }); + this.timers = new Set(); this.epoch = 0; this.desired = false; this.connected = false; + this.lastAttempt = -Infinity; this.failures = 0; + } + timer(fn, delay) { + const id = this.later(() => { this.timers.delete(id); fn(); }, delay); + this.timers.add(id); return id; + } + clearTimers() { for (const id of this.timers) this.cancel(id); this.timers.clear(); } + start(options) { + this.stop(); + this.options = { connectionId: options.connectionId }; + this.desired = true; this.paused = false; this.failures = 0; this.lastAttempt = -Infinity; + void this.attempt(); + } + stop(reason = 'Owner stopped connection') { + this.desired = false; this.paused = false; this.options = undefined; this.connected = false; + ++this.epoch; this.clearTimers(); + this.authAbort?.abort(); this.authAbort = undefined; + const socket = this.socket; this.socket = undefined; + if (socket?.readyState === 1) { + try { socket.send(JSON.stringify({ type: 'disconnect', csrf: this.csrf })); } catch {} + } + try { socket?.close(1000, reason); } catch {} + this.csrf = undefined; this.disconnected(); this.phase({ state: 'stopped' }); + } + send(command) { + if (!this.connected || this.socket?.readyState !== 1) return false; + try { this.socket.send(JSON.stringify({ ...command, csrf: this.csrf })); return true; } catch { return false; } + } + voice(frame) { + if (!this.connected || this.socket?.readyState !== 1 || this.socket.bufferedAmount > 4096) return false; + try { this.socket.send(frame); return true; } catch { return false; } + } + offline() { + if (!this.desired) return; + this.clearTimers(); ++this.epoch; + this.authAbort?.abort(); this.authAbort = undefined; + const socket = this.socket; this.socket = undefined; + try { socket?.close(4000, 'Network offline'); } catch {} + this.connected = false; this.disconnected(); this.phase({ state: 'offline' }); + this.paused = true; + } + online() { + if (!this.desired || !this.paused) return; + this.paused = false; this.schedule(); + } + schedule(code) { + if (!this.desired || this.paused) return; + if (this.failures >= 5) { this.stop(); this.phase({ state: 'failed', code: code || 'recovery_limit' }); return; } + // At most five new handshakes per minute, below the server's six-per-minute gate. + const delay = Math.max(12000 - (this.now() - this.lastAttempt), Math.min(30000, 1000 * 2 ** this.failures) + Math.floor(this.random() * 500), + code === 'another_session_is_active' ? 36000 : 0, code === 'connection_rate_limit' ? 61000 : 0); + this.diagnostic({ type: 'retry', attempt: this.failures, delay, ...(code ? { code } : {}) }); + this.phase({ state: 'retrying', delay, code }); + this.timer(() => { void this.attempt(); }, delay); + } + async attempt() { + if (!this.desired || this.paused) return; + this.clearTimers(); const epoch = ++this.epoch; + this.connected = false; this.disconnected(); this.lastAttempt = this.now(); + this.diagnostic({ type: 'attempt', attempt: this.failures + 1 }); + this.phase({ state: 'connecting' }); + let auth; let authTimer; + const controller = new AbortController(); this.authAbort = controller; + try { auth = await Promise.race([this.session({ signal: controller.signal }), new Promise((_, reject) => { + authTimer = this.timer(() => { controller.abort(); reject(new Error('Session check timed out')); }, 15000); + })]); } + catch (error) { + if (epoch !== this.epoch || !this.desired) return; + if ([401, 403].includes(error.status)) { this.stop(); this.phase({ state: 'expired' }); this.expired(); return; } + this.failures++; this.schedule('session_unavailable'); return; + } + finally { + this.cancel(authTimer); this.timers.delete(authTimer); + if (this.authAbort === controller) this.authAbort = undefined; + } + if (epoch !== this.epoch || !this.desired || this.paused) return; + this.csrf = auth.csrf; + let socket; + try { socket = this.createSocket(this.url); } catch { this.failures++; this.schedule('transport_unavailable'); return; } + this.socket = socket; socket.binaryType = 'arraybuffer'; + const openedAt = this.now(); + let lastMessageAt = openedAt; let timeoutKind = 'handshake'; + let fault; let healthySince; let receivedState = false; let pong; let nonce = 0; let ended = false; + const current = () => epoch === this.epoch && this.desired && !ended; + const finish = (code = 1006) => { + if (!current()) return; + this.diagnostic({ type: 'transport_closed', closeCode: code, durationMs: this.now() - openedAt, lastMessageAgeMs: this.now() - lastMessageAt, receivedState, ...(fault ? { code: fault } : {}) }); + ended = true; this.clearTimers(); this.socket = undefined; + this.connected = false; this.disconnected(); + if ([4401, 4403].includes(code)) { this.stop(); this.phase({ state: 'expired' }); this.expired(); return; } + if ((fault && !retryable.has(fault)) || [1003, 1008].includes(code)) { this.stop(); this.phase({ state: 'failed', code: fault || 'transport_rejected' }); return; } + if (receivedState && healthySince !== undefined && this.now() - healthySince >= 30000) this.failures = 0; + else this.failures++; + this.schedule(fault); + }; + const abandon = () => { + if (!current()) return; + this.diagnostic({ type: 'timeout', stage: timeoutKind, lastMessageAgeMs: this.now() - lastMessageAt }); + try { socket.close(4000, 'Protocol response timeout'); } catch {} + // A dead TCP transport can remain CLOSING. Do not wait indefinitely for close. + finish(); + }; + let handshake = this.timer(abandon, 45000); + const heartbeat = () => { + if (!current() || socket.readyState !== 1) return; + if (pong && this.now() - pong.at >= 15000) { timeoutKind = 'heartbeat'; abandon(); return; } + if (!pong) { + pong = { nonce: nonce++ % 0x100000000, at: this.now() }; + try { socket.send(JSON.stringify({ type: 'ping', csrf: this.csrf, nonce: pong.nonce })); } catch { abandon(); return; } + } + this.timer(heartbeat, 10000); + }; + socket.addEventListener('open', () => { + if (!current()) { try { socket.close(1000, 'Connection canceled'); } catch {} return; } + try { socket.send(JSON.stringify({ type: 'connect', csrf: this.csrf, heartbeat: true, ...this.options })); } catch { abandon(); return; } + this.timer(heartbeat, 10000); + }); + socket.addEventListener('message', ({ data }) => { + if (!current()) return; + lastMessageAt = this.now(); + if (data instanceof ArrayBuffer) { if (this.connected) this.event(data); return; } + let message; try { message = JSON.parse(data); } catch { return; } + if (message.type === 'ts3_pong') { if (pong && message.nonce === pong.nonce) { this.diagnostic({ type: 'heartbeat', roundTripMs: this.now() - pong.at }); pong = undefined; } return; } + if (message.type === 'ts3_status') { + this.diagnostic({ type: 'protocol_status', stage: message.status }); + this.connected = message.status === 'connected'; + if (this.connected) { healthySince = this.now(); this.phase({ state: 'connected' }); } + else { + this.cancel(handshake); this.timers.delete(handshake); handshake = this.timer(abandon, 45000); + this.disconnected(); this.phase({ state: 'connecting', status: message.status }); + } + } + if (message.type === 'ts3_state' && this.connected) { + receivedState = true; this.cancel(handshake); this.timers.delete(handshake); + } + if (message.type === 'ts3_error') this.diagnostic({ type: 'protocol_error', code: message.code }); + if (message.type === 'ts3_error' && !advisory.has(message.code) && (!fault || retryable.has(fault))) fault = message.code; + this.event(message); + if (fault && !retryable.has(fault)) { try { socket.close(1000, 'Protocol recovery requires owner action'); } catch {} finish(1000); } + }); + socket.addEventListener('close', ({ code }) => finish(code)); + socket.addEventListener('error', () => { this.diagnostic({ type: 'transport_error' }); /* close/watchdog owns the single retry path */ }); + } +} diff --git a/public/protocol.mjs b/public/protocol.mjs new file mode 100644 index 0000000..7f2b78b --- /dev/null +++ b/public/protocol.mjs @@ -0,0 +1,390 @@ +/** @typedef {import('../src/protocol/types').ProtocolEvent} ProtocolEvent */ +import { VoiceAudio } from './voice.mjs'; +import { AudioRecovery } from './audio-recovery.mjs'; +import { ProtocolConnection } from './protocol-connection.mjs'; +const $ = id => document.getElementById(id); +let csrf; +let transport; +let capabilities; +let protocolLoadGeneration = 0; +let identity; +let connectionRequested = false; +let connectionGeneration = 0; +let connected = false; +let audio; +const audioRecovery = new AudioRecovery(); +let latestState; +let speaking = new Set(); +const volumes = new Map(); +export function getParticipantVolume(id) { return volumes.get(id) ?? 1; } +export function setParticipantVolume(id, value) { + if (!Number.isInteger(id) || !Number.isFinite(value)) return; + const volume = Math.max(0, Math.min(2, value)); volumes.set(id, volume); audio?.volume(id, volume); + window.dispatchEvent(new CustomEvent('voxharbor-volume', { detail: { id, volume } })); +} +const pendingCommands = new Map(); +let nextCommandId = 1; +export function clientCommand(command) { + if (!connected) return Promise.reject(new Error('Connect to the server first.')); + if (pendingCommands.size >= 16) return Promise.reject(new Error('Wait for the current actions to finish.')); + const requestId = nextCommandId++; if (nextCommandId > 0xffffffff) nextCommandId = 1; + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { pendingCommands.delete(requestId); reject(new Error('The server did not confirm this action. Check the current state before trying again.')); }, 16000); + pendingCommands.set(requestId, { resolve, reject, timer, command }); + if (!transport.send({ type: 'command', requestId, command })) { clearTimeout(timer); pendingCommands.delete(requestId); reject(new Error('The connection ended before the action was sent.')); } + }); +} +export async function joinChannel(channelId, password = '') { + await clientCommand({ type: 'join_channel', channelId, ...(password ? { password } : {}) }); + stopAudio(); + $('ts3-channel').value = String(channelId); +} +function cancelCommands() { + for (const pending of pendingCommands.values()) { clearTimeout(pending.timer); pending.reject(new Error('The connection ended. The action was not retried.')); } + pendingCommands.clear(); +} +function sendCommand(command) { + transport?.send(command); +} +function audioButtons() { + $('voice-listen').disabled = !connected; + $('voice-mic').disabled = !connected || !audio || audio.outputMuted; + $('voice-listen').textContent = audio && !audio.outputMuted ? 'Stop listening' : 'Enable listening'; + $('voice-mic').textContent = audio && !audio.muted ? 'Mute microphone' : 'Enable microphone'; + $('voice-ptt').disabled = !audio || audio.muted || !audio.canSend || audio.mode !== 'ptt'; + $('voice-ptt').hidden = $('voice-mode').value !== 'ptt' || !audio || audio.muted; + $('voice-transmission').hidden = !audio || audio.muted; + const microphoneOn = Boolean(audio && !audio.muted); const listening = Boolean(audio && !audio.outputMuted); + $('voice-mic').setAttribute('aria-pressed', String(microphoneOn)); $('voice-listen').setAttribute('aria-pressed', String(listening)); + $('voice-heading').textContent = microphoneOn ? $('voice-transmission').classList.contains('transmitting') ? 'On air.' : 'Ready to talk.' : 'Off air.'; + $('voice-description').textContent = microphoneOn ? 'Your microphone is ready. You control when you transmit.' : 'Your microphone is off. You choose when to join in.'; + $('room-listening-status').textContent = listening ? 'Listening on' : 'Listening off'; + $('ribbon-mute').hidden = !microphoneOn; + $('ribbon-audio').textContent = `${listening ? 'Listening on' : 'Listening off'} / ${microphoneOn ? 'Microphone enabled' : 'Microphone off'}`; +} +function setupAudio() { + if (audio) return; + audio = new VoiceAudio(sendCommand, frame => transport?.voice(frame) ?? false); + for (const [clientId, volume] of volumes) audio.volume(clientId, volume); + audio.addEventListener('error', event => { stopAudio(); $('voice-status').textContent = event.detail; audioButtons(); }); + audio.addEventListener('transmitting', event => { + $('voice-transmission').textContent = event.detail.active ? '● Transmitting' : 'Microphone idle'; + $('ribbon-audio').textContent = event.detail.active ? 'On air · Microphone transmitting' : audio && !audio.muted ? 'Microphone enabled' : 'Microphone off'; + $('voice-transmission').classList.toggle('transmitting', event.detail.active); $('voice-heading').textContent = event.detail.active ? 'On air.' : audio && !audio.muted ? 'Ready to talk.' : 'Off air.'; + }); + audio.addEventListener('speaking', event => { + speaking = new Set(event.detail.ids); + window.dispatchEvent(new CustomEvent('voxharbor-speaking', { detail: [...speaking] })); + }); + audio.addEventListener('stats', event => { + const { lost, late, overflow, rejected } = event.detail; + $('voice-quality').textContent = `Audio packets: ${lost} missing · ${late} late · ${overflow} queue resets · ${rejected} rejected`; + }); + applyAudioSettings(); + updateCodec(); +} +function updateCodec() { + const own = latestState?.participants.find(client => client.id === latestState.ownClientId); + const channel = latestState?.channels.find(channel => channel.id === own?.channelId); + if (channel) audio?.channel(channel.codec); +} +function stopAudio({ recovery = false } = {}) { + if (!recovery) audioRecovery.clear(); + audio?.stop(); audio = undefined; speaking.clear(); if (!recovery) { const ids = [...volumes.keys()]; volumes.clear(); for (const id of ids) window.dispatchEvent(new CustomEvent('voxharbor-volume', { detail: { id, volume: 1 } })); } + window.dispatchEvent(new CustomEvent('voxharbor-speaking', { detail: [] })); + $('voice-status').textContent = recovery && audioRecovery.pending ? 'Connection interrupted. Your audio recovery choices will apply after reconnect.' : 'Listening and microphone are off.'; $('voice-quality').textContent = ''; + $('voice-transmission').textContent = 'Microphone off'; + $('voice-transmission').classList.remove('transmitting'); + audioButtons(); +} +const errorMessages = { + native_unavailable: 'The native protocol executable is not available in this deployment.', + identity_required: 'Create or import an identity before connecting.', + another_session_is_active: 'Another session for your account is active. Disconnect it first, or wait for its lease to expire.', + connection_rate_limit: 'Connection limit reached. Wait one minute before trying again.', + identity_storage_or_destination_error: 'Identity storage or destination validation failed. Check the encryption key, Redis and public server address.', + handshake_timeout: 'The server handshake timed out. The result is inconclusive; check the voice port, firewall and server availability.', + connection_failed: 'The full-client protocol connection failed. Check the voice port, server password and server availability.', + server_rejected_connection: 'The server rejected the connection. Check its password, version and identity requirements.', + server_permission_or_command_error: 'The server denied a command. Server permissions still apply.', + session_lease_lost: 'Session ownership could not be renewed. The protocol connection was stopped.', + packet_receive_window_exceeded: 'The incoming packet sequence exceeded the protocol receive window. The connection was stopped.', + connection_required: 'Save your connection settings before connecting.', + connection_settings_changed: 'Connection settings changed in another session. Reload and connect again.', + connection_settings_not_saved: 'The server action succeeded, but its connection settings could not be saved. Save them before reconnecting.', + packet_authentication_failed: 'A server packet failed authentication. The connection was stopped.', +}; +async function request(path, input) { + const response = await fetch(path, { signal: AbortSignal.timeout(15000), method: input === undefined ? 'GET' : 'POST', + ...(input === undefined ? {} : { headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf }, body: JSON.stringify(input) }) }); + if (!response.ok) { + if (response.status === 401) window.dispatchEvent(new Event('voxharbor-owner-expired')); + const data = await response.json(); + throw new Error(data.error || 'Protocol operation failed'); + } + return response; +} +function buttons() { + const ready = capabilities?.nativeAvailable && capabilities?.identityEncryptionConfigured; + $('identity-create').disabled = !ready || Boolean(identity); + $('identity-import').disabled = !ready || Boolean(identity); + $('identity-export').disabled = !ready || !identity; + $('ts3-connect').disabled = !ready || !identity || connectionRequested; + $('ts3-disconnect').disabled = !connectionRequested; + for (const button of document.querySelectorAll('[data-disconnect]')) button.disabled = !connectionRequested; + $('connection-requirement').hidden = Boolean(identity); + $('identity-needed').hidden = !ready || Boolean(identity); + $('workspace-readiness').textContent = !capabilities ? 'Loading connection capabilities…' : !ready ? 'The server connection service is unavailable. Please try again later.' : ''; + $('workspace-readiness').hidden = Boolean(ready); + $('editor-connect').disabled = !ready || !identity || connectionRequested; + document.querySelector('.identity-grid').hidden = Boolean(identity); + window.dispatchEvent(new Event('voxharbor-capabilities')); +} +function showIdentity() { + $('identity-status').textContent = identity ? `UID ${identity.uid} · security level ${identity.level}` : 'No identity stored. Create one once or import your existing identity.'; + buttons(); +} +export async function loadProtocol(token) { + const generation = ++protocolLoadGeneration; + csrf = token; + try { + const nextCapabilities = await (await request('/api/protocol')).json(); + const nextIdentity = (await (await request('/api/identity')).json()).identity; + if (generation !== protocolLoadGeneration) return; + capabilities = nextCapabilities; identity = nextIdentity; + $('native-status').textContent = !capabilities.nativeAvailable ? 'Native build unavailable' : !capabilities.identityEncryptionConfigured ? 'Configure the separate identity encryption key' : 'Protocol adapter ready · audio starts only when you enable it'; + showIdentity(); + } catch (error) { if (generation === protocolLoadGeneration) { $('native-status').textContent = error.message; $('workspace-readiness').hidden = false; $('workspace-readiness').textContent = 'Connection capabilities could not be loaded. Reload to try again.'; } } +} +export function resetProtocol() { + ++connectionGeneration; ++protocolLoadGeneration; + cancelCommands(); + connected = false; stopAudio(); latestState = undefined; + $('voice-resume-mic').checked = false; $('voice-mode').value = 'ptt'; $('voice-threshold').value = '25'; + $('voice-input').value = ''; $('voice-output').value = ''; + transport?.stop('Session ended'); transport = undefined; + connectionRequested = false; + identity = undefined; capabilities = undefined; + csrf = undefined; + $('ts3-password').value = ''; + $('ts3-channel-password').value = ''; + $('ts3-channels').replaceChildren(); + $('ts3-state-summary').textContent = ''; $('ts3-status').textContent = 'Not connected'; + $('identity-status').textContent = 'Loading identity…'; $('native-status').textContent = 'Loading protocol capabilities…'; + window.dispatchEvent(new Event('voxharbor-reset')); + buttons(); +} +$('identity-create').addEventListener('click', async () => { + $('identity-create').disabled = true; const generation = protocolLoadGeneration; + try { + const result = (await (await request('/api/identity/create', {})).json()).identity; + if (generation !== protocolLoadGeneration) return; + identity = result; + showIdentity(); + $('ts3-status').textContent = 'Identity encrypted and stored. The same identity will be reused.'; + } catch (error) { if (generation === protocolLoadGeneration) { $('ts3-status').textContent = error.message; buttons(); } } +}); +$('identity-import').addEventListener('change', async event => { + const generation = protocolLoadGeneration; + const file = event.target.files[0]; + if (!file) return; + try { + if (file.size > 16384) throw new Error('Identity file must be smaller than 16 KiB'); + const value = await file.text(); if (generation !== protocolLoadGeneration) return; + const result = (await (await request('/api/identity/import', { value })).json()).identity; + if (generation !== protocolLoadGeneration) return; identity = result; + showIdentity(); + } catch (error) { if (generation === protocolLoadGeneration) $('ts3-status').textContent = error.message; } + finally { if (generation === protocolLoadGeneration) event.target.value = ''; } +}); +$('identity-export').addEventListener('click', async () => { + const generation = protocolLoadGeneration; + if (!window.confirm('Export the private TeamSpeak identity? Anyone holding this file can use your identity. Store the backup securely.')) return; + try { + const response = await request('/api/identity/export', {}); + const blob = await response.blob(); if (generation !== protocolLoadGeneration) return; + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = 'VoxHarbor-identity.ini'; + link.click(); + setTimeout(() => URL.revokeObjectURL(url), 1000); + } catch (error) { if (generation === protocolLoadGeneration) $('ts3-status').textContent = error.message; } +}); +function renderState(event) { + const previousChannel = latestState?.participants.find(client => client.id === latestState.ownClientId)?.channelId; + const ownChannel = event.participants.find(client => client.id === event.ownClientId)?.channelId; + if (previousChannel && previousChannel !== ownChannel) stopAudio(); + latestState = event; updateCodec(); + $('ts3-state-summary').textContent = `${event.server.name} · ${event.channels.length} channels · ${event.participants.length} visible participants · event update ${event.sequence}`; + window.dispatchEvent(new CustomEvent('voxharbor-state', { detail: event })); + window.dispatchEvent(new CustomEvent('voxharbor-protocol-diagnostic', { detail: { type: 'state', channels: event.channels.length, participants: event.participants.length, sequence: event.sequence } })); +} +$('ts3-connect').addEventListener('click', async () => { + if (connectionRequested) return; + const host = $('ts3-host').value.trim(); const port = Number($('ts3-port').value); + const nickname = $('ts3-nickname').value.trim(); + if (!/^[a-zA-Z0-9.-]{1,253}$/.test(host) || !Number.isInteger(port) || port < 1024 || port > 65535 || !nickname) { + $('native-status').textContent = 'Enter a server hostname, a port from 1024 to 65535, and your nickname.'; return; + } + if (!transport) transport = new ProtocolConnection({ + url: `${location.protocol === 'https:' ? 'wss:' : 'ws:'}//${location.host}/api/ts3`, + session: async ({ signal }) => { + const response = await fetch('/api/session', { signal }); + if (!response.ok) throw Object.assign(new Error('Session unavailable'), { status: response.status }); + const session = await response.json(); csrf = session.csrf; return session; + }, + disconnected: () => { + cancelCommands(); + audioRecovery.interrupted(audio, $('voice-resume-mic').checked, !document.hidden); + connected = false; stopAudio({ recovery: true }); + if (latestState && !$('ts3-state-summary').textContent.includes('last received state')) $('ts3-state-summary').textContent += ' · disconnected (last received state)'; + }, + diagnostic: detail => window.dispatchEvent(new CustomEvent('voxharbor-protocol-diagnostic', { detail })), + expired: () => window.dispatchEvent(new Event('voxharbor-owner-expired')), + phase: ({ state, delay, code, status }) => { + window.dispatchEvent(new CustomEvent('voxharbor-protocol-diagnostic', { detail: { type: 'phase', state, ...(delay ? { delay } : {}), ...(code ? { code } : {}) } })); + if (['stopped', 'failed', 'expired'].includes(state)) { audioRecovery.clear(); $('voice-status').textContent = 'Listening and microphone are off.'; } + connectionRequested = Boolean(transport?.desired); connected = state === 'connected'; + window.dispatchEvent(new CustomEvent('voxharbor-connection', { detail: { state, delay } })); + buttons(); audioButtons(); + const messages = { + stopped: 'Disconnected. Microphone and listening are off.', + connecting: status ? `Connection: ${status.replaceAll('_', ' ')}…` : 'Opening authenticated protocol transport…', + connected: 'Connected through the full TeamSpeak client protocol.', + retrying: `Reconnecting in ${Math.ceil((delay || 0) / 1000)} seconds. Audio will resume according to your reconnect choices.`, + offline: 'Network offline. Reconnection will resume when the network returns.', + failed: errorMessages[code] || 'Automatic recovery stopped. Check the connection error, then connect again.', + expired: 'Session expired or was signed out.', + }; + $('ts3-status').textContent = messages[state] || state; + }, + event: message => { + if (message instanceof ArrayBuffer) { audio?.receive(message); return; } + if (message.type === 'ts3_state') { + renderState(message); + void audioRecovery.restore({ visible: !document.hidden, create: () => { setupAudio(); return audio; }, + valid: active => audio === active && connected && !document.hidden, + output: $('voice-output').value, microphone: $('voice-input').value, + resumeMicrophone: () => $('voice-resume-mic').checked, + status: text => { $('voice-status').textContent = text; audioButtons(); } }); + } + else if (message.type === 'ts3_identity') { identity = { ...identity, uid: message.uid, level: message.level }; showIdentity(); } + else if (message.type === 'ts3_audio_status') { audio?.permissions(message); audioButtons(); } + else if (message.type === 'ts3_connection_saved') window.dispatchEvent(new CustomEvent('voxharbor-connection-saved', { detail: message.preferences })); + else if (message.type === 'ts3_message') window.dispatchEvent(new CustomEvent('voxharbor-message', { detail: message })); + else if (message.type === 'ts3_command_result') { + const pending = pendingCommands.get(message.requestId); if (!pending) return; + clearTimeout(pending.timer); pendingCommands.delete(message.requestId); + if (message.ok) pending.resolve(); + else pending.reject(new Error(message.code === 'server_denied_command' ? `The server denied this action${Number.isInteger(message.serverError) ? ` (error ${message.serverError}${Number.isInteger(message.missingPermission) ? `, permission ${message.missingPermission}` : ''})` : ''}. Check your permissions and any required password.` : message.code === 'command_not_sent' ? 'The action was not sent. Its recipient or channel may have changed.' : 'The action could not be confirmed. Check the current server state.')); + } + else if (message.type === 'ts3_error') $('ts3-status').textContent = errorMessages[message.code] || `Protocol error: ${message.code}`; + }, + }); + const generation = ++connectionGeneration; + const input = { host, port, nickname, channelId: $('ts3-channel').value ? Number($('ts3-channel').value) : null }; + if ($('ts3-password').value) input.password = $('ts3-password').value; + if ($('ts3-channel-password').value) input.channelPassword = $('ts3-channel-password').value; + if ($('settings-dialog').dataset.bookmarkId) input.bookmarkId = $('settings-dialog').dataset.bookmarkId; + if ($('connection-clear-passwords').checked) { input.password = ''; input.channelPassword = ''; } + for (const id of ['ts3-password', 'ts3-channel-password']) { $(id).value = ''; } $('connection-clear-passwords').checked = false; + connectionRequested = true; buttons(); + $('ts3-status').textContent = 'Saving encrypted connection settings…'; + window.dispatchEvent(new CustomEvent('voxharbor-connection', { detail: { state: 'connecting' } })); + try { + const preferences = await (await request('/api/connection', input)).json(); + if (generation !== connectionGeneration || !csrf) return; + window.dispatchEvent(new CustomEvent('voxharbor-connection-saved', { detail: preferences })); + window.dispatchEvent(new CustomEvent('voxharbor-destination', { detail: preferences.connection })); + transport.start({ connectionId: preferences.connection.id }); + } catch (error) { + if (generation !== connectionGeneration) return; + connectionRequested = false; buttons(); + $('ts3-status').textContent = error.message; + $('native-status').textContent = error.message; + window.dispatchEvent(new CustomEvent('voxharbor-connection', { detail: { state: 'failed' } })); + } finally { input.password = ''; input.channelPassword = ''; } + +}); +window.addEventListener('offline', () => transport?.offline()); +window.addEventListener('online', () => transport?.online()); + +async function devices() { + if (!navigator.mediaDevices?.enumerateDevices) return; + const entries = await navigator.mediaDevices.enumerateDevices(); + for (const [id, kind] of [['voice-input', 'audioinput'], ['voice-output', 'audiooutput']]) { + const select = $(id); const previous = select.value; + select.replaceChildren(new Option('System default', '')); + for (const device of entries.filter(device => device.kind === kind && device.deviceId && device.deviceId !== 'default')) select.add(new Option(device.label || `${kind === 'audioinput' ? 'Microphone' : 'Speaker'} ${select.length}`, device.deviceId)); + if ([...select.options].some(option => option.value === previous)) select.value = previous; + } +} +function applyAudioSettings() { + if (!audio) { audioButtons(); return; } + audio.mode = $('voice-mode').value; + audio.threshold = Number($('voice-threshold').value) / 1000; + audio.configure(); audioButtons(); +} +$('voice-listen').addEventListener('click', async () => { + audioRecovery.clear(); + $('voice-listen').disabled = true; + setupAudio(); const active = audio; + try { + await active.listen(active.outputMuted); + if (audio !== active) return; + $('voice-status').textContent = audio.outputMuted ? 'Listening stopped. Microphone muted.' : 'Listening enabled. Microphone remains off until you enable it.'; + $('voice-output').disabled = typeof audio.context?.setSinkId !== 'function'; + await devices(); + } catch (error) { if (audio === active) { stopAudio(); $('voice-status').textContent = error.message; } } + finally { audioButtons(); } +}); +$('voice-mic').addEventListener('click', async () => { + audioRecovery.clear(); + $('voice-mic').disabled = true; + const active = audio; + try { + if (active.muted) await active.microphone($('voice-input').value); + else active.mute(); + if (audio !== active) return; + $('voice-status').textContent = audio.muted ? 'Microphone muted.' : audio.mode === 'ptt' ? 'Microphone ready. Hold the talk button or Space while this page has focus.' : 'Voice activation enabled. Speech above the threshold is transmitted when the server permits it.'; + await devices(); + } catch (error) { if (audio === active) { audio?.mute(); $('voice-status').textContent = error.name === 'NotAllowedError' ? 'Microphone permission was denied. Enable it in your browser, then try again.' : error.message; } } + finally { audioButtons(); } +}); +$('voice-resume-mic').addEventListener('change', () => { + if (!$('voice-resume-mic').checked && audioRecovery.restoring) { + audioRecovery.clear(); audio?.mute(); audioButtons(); + $('voice-status').textContent = 'Automatic microphone recovery cancelled. Enable the microphone to talk.'; + } +}); +for (const id of ['voice-mode', 'voice-threshold']) $(id).addEventListener('change', applyAudioSettings); +$('voice-input').addEventListener('change', async () => { + audio?.mute(); audioButtons(); + $('voice-status').textContent = 'Input device changed. Enable the microphone to use it.'; +}); +$('voice-output').addEventListener('change', async () => { + try { + if (typeof audio?.context?.setSinkId !== 'function') throw new Error('Output selection is unavailable in this browser. Use system audio settings.'); + await audio.context.setSinkId($('voice-output').value); + } catch (error) { $('voice-status').textContent = error.message; } +}); +const releaseTalk = () => audio?.ptt(false); +$('voice-ptt').addEventListener('pointerdown', event => { if (!$('voice-ptt').disabled) { event.target.setPointerCapture(event.pointerId); audio?.ptt(true); } }); +for (const type of ['keydown', 'keyup']) $('voice-ptt').addEventListener(type, event => { + if (['Space', 'Enter'].includes(event.code)) { event.preventDefault(); audio?.ptt(type === 'keydown'); } +}); +for (const type of ['pointerup', 'pointercancel', 'lostpointercapture']) $('voice-ptt').addEventListener(type, releaseTalk); +document.addEventListener('keydown', event => { + if (event.code !== 'Space' || event.repeat || /INPUT|TEXTAREA|SELECT|BUTTON/.test(event.target.tagName) || event.target.isContentEditable || audio?.mode !== 'ptt') return; + event.preventDefault(); audio?.ptt(true); +}); +document.addEventListener('keyup', event => { if (event.code === 'Space') releaseTalk(); }); +window.addEventListener('blur', releaseTalk); +document.addEventListener('visibilitychange', () => { if (document.hidden) { audioRecovery.clear(); audio?.mute(); audioButtons(); } }); +navigator.mediaDevices?.addEventListener('devicechange', () => { audioRecovery.clear(); audio?.mute(); audioButtons(); void devices().catch(() => {}); }); +$('ts3-disconnect').addEventListener('click', () => { + ++connectionGeneration; connectionRequested = false; buttons(); + transport?.stop(); +}); +window.addEventListener('pagehide', () => { ++connectionGeneration; transport?.stop('Page closed'); }); diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 0000000..04f8e13 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,17 @@ +{ + "id": "/", + "name": "VoxHarbor", + "short_name": "VoxHarbor", + "description": "A self-hosted TeamSpeak 3 web client.", + "lang": "en", + "start_url": "/", + "scope": "/", + "display": "standalone", + "background_color": "#171818", + "theme_color": "#171818", + "icons": [ + { "src": "/icons/app-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" }, + { "src": "/icons/app-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }, + { "src": "/icons/app-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } + ] +} diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..2c19751 --- /dev/null +++ b/public/style.css @@ -0,0 +1,28 @@ +@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/ibm-plex-sans-regular.ttf') format('truetype')} +@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:500;font-display:swap;src:url('/fonts/ibm-plex-sans-medium.ttf') format('truetype')} +@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:600;font-display:swap;src:url('/fonts/ibm-plex-sans-semibold.ttf') format('truetype')} +@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/ibm-plex-mono-regular.ttf') format('truetype')} +@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:500;font-display:swap;src:url('/fonts/ibm-plex-mono-medium.ttf') format('truetype')} +:root{font-family:'IBM Plex Sans',sans-serif;font-size:14px;line-height:1.5;color-scheme:dark;--bg:#171818;--panel:#222424;--strip:#2b2d2d;--field:#101111;--ink:#dad8cc;--muted:#96978f;--line:#3b3d3b;--accent:#ec8351;--on-accent:#211b16;--control:#dad8cc;--control-ink:#171818;--connected:#c1c99c;color:var(--ink);background:var(--bg)} +:root[data-theme=light]{color-scheme:light;--bg:#ecebe4;--panel:#f5f4ef;--strip:#e2e1d8;--field:#fff;--ink:#252724;--muted:#65685e;--line:#cdcec4;--accent:#b94b1d;--on-accent:#fff;--control:#292d28;--control-ink:#faf9f1;--connected:#52642d} +*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a,input,select,textarea,summary{-webkit-tap-highlight-color:transparent}button{border:1px solid transparent;border-radius:6px;padding:12px 17px;min-height:44px;background:var(--accent);color:var(--on-accent);font-size:13px;font-weight:500;cursor:pointer;transition:background .15s,opacity .15s}button:hover:not(:disabled){filter:brightness(1.12)}button:disabled{opacity:.42;cursor:not-allowed}button.quiet{background:transparent;color:var(--muted);padding:10px 12px}button.quiet:hover:not(:disabled){color:var(--ink);background:var(--strip)}button.secondary{background:var(--control);color:var(--control-ink)}input,select,textarea{width:100%;min-width:0;border:1px solid transparent;border-radius:5px;background:var(--field);color:var(--ink);padding:12px 15px;min-height:44px;font-size:13px}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}input[type=range]{accent-color:var(--control);padding:0;cursor:pointer}input[type=checkbox]{accent-color:var(--accent);min-height:0;width:16px;height:16px;flex:none}input[type=file]{font-size:12px;border:1px solid var(--line)}input::file-selector-button{background:var(--control);color:var(--control-ink);border:0;border-radius:3px;padding:7px 12px;margin-right:10px}textarea{resize:vertical;min-height:65px;max-height:180px}label{display:block;margin:22px 0 8px;font-size:12px;color:var(--muted)}h1,h2,h3,p{margin:0 0 12px}h1,h2,h3{font-weight:400;line-height:1.15;letter-spacing:-.025em}h1{font-size:32px}h2{font-size:22px}h3{font-size:16px}a{color:inherit;text-decoration:none}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:4px}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.skip-link{position:fixed;left:16px;top:-80px;z-index:20;padding:12px;background:var(--control);color:var(--control-ink)}.skip-link:focus{top:12px}.brand{display:flex;align-items:center;gap:14px;font-size:24px;letter-spacing:-.6px;white-space:nowrap}.mark{display:flex;align-items:center;gap:3px;height:28px;color:var(--accent)}.mark i{display:block;width:3px;height:15px;background:currentColor}.mark i:nth-child(2){height:25px}.mark i:nth-child(3){height:19px}.mark i:nth-child(4){height:29px}.mark i:nth-child(5){height:11px}.eyebrow{font-family:'IBM Plex Mono',monospace;font-size:10px;font-weight:400;letter-spacing:.025em;color:var(--muted);line-height:1.6}.hint{font-size:12px;color:var(--muted);line-height:1.7;overflow-wrap:anywhere}.row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.full-width{width:100%}.connection-fields{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-bottom:12px}hr{border:0;border-top:1px solid var(--line);margin:28px 0}.welcome{max-width:1512px;min-height:100dvh;margin:auto;padding:32px;display:grid;grid-template-columns:1.2fr 1fr;column-gap:7%;grid-template-rows:auto 1fr auto}.account-header{grid-column:1/-1;display:flex;align-items:center;gap:100px;border-bottom:1px solid var(--line);padding:8px 4px 22px}.account-header .eyebrow{margin:0}.account-header>.hint{margin:0 5% 0 auto}.welcome-copy{background:var(--panel);border-radius:7px;margin:36px 0 46px;padding:48px 40px;display:flex;flex-direction:column;justify-content:center;min-height:570px}.welcome-copy>.eyebrow{color:var(--accent);margin-bottom:48px}.welcome h1{font-size:clamp(36px,3.4vw,52px);line-height:1.02;margin-bottom:30px}.welcome-copy>p:not(.eyebrow){color:var(--muted);line-height:1.9}.welcome-room{background:var(--strip);padding:30px;border-radius:5px;margin:48px 0 60px}.welcome-room h2{font-size:25px}.welcome-room .hint{margin:0}.welcome-copy .welcome-note{font-size:11px;margin-top:auto;margin-bottom:0}#login{width:100%;max-width:520px;align-self:center;padding:48px 8% 48px 0}#login>.eyebrow{color:var(--accent)}#login h2{font-size:32px;margin-bottom:8px}#login>label{margin-top:35px}#login button{width:100%;margin-top:40px}#login #auth-toggle{text-align:left;padding-left:0;margin:8px 0 26px;font-weight:400}#login .auth-note{border-top:1px solid var(--line);margin-top:32px;padding-top:22px;font-size:11px;line-height:2}.account-footer{grid-column:1/-1;display:flex;justify-content:space-between;border-top:1px solid var(--line);padding:23px 4px 6px;color:var(--muted);font-family:'IBM Plex Mono',monospace;font-size:9px} +.topbar{grid-column:1/-1;display:flex;align-items:center;gap:28px;min-height:56px;padding-bottom:9px}.topbar .brand{min-width:250px}.server-selector{display:flex;align-items:center;gap:14px;min-width:0;max-width:40%;text-align:left}.server-selector #server-name{font-family:'IBM Plex Mono',monospace;font-size:10px;text-transform:uppercase;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:190px;color:var(--ink)}#connection-badge{font:9px 'IBM Plex Mono',monospace;text-transform:uppercase;white-space:nowrap}#connection-badge::before{content:'●';font-size:8px;margin-right:6px}#connection-badge[data-state=connected]{color:var(--connected)}#connection-badge[data-state=retrying],#connection-badge[data-state=failed]{color:var(--accent)}.top-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.top-actions button{font-size:12px;padding-inline:8px}#account-label{margin-left:35px;color:var(--ink);max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rooms-bar{grid-column:1/-1;background:var(--panel);border-radius:6px;display:flex;align-items:center;gap:14px;min-height:62px;padding:8px}.room-finder{font:9px 'IBM Plex Mono',monospace!important;flex:none}.room-finder span{margin-left:8px;font-size:17px}#room-tabs{list-style:none;display:flex;gap:6px;flex:1;overflow:auto;margin:0;padding:0;scrollbar-width:thin}#room-tabs li{flex:1;min-width:140px}#room-tabs button{width:100%;background:transparent;color:var(--muted);font-weight:400;text-align:left;white-space:nowrap;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 16px}#room-tabs button[aria-current=true]{background:var(--control);color:var(--control-ink)}#room-tabs .room-number{font-family:'IBM Plex Mono',monospace;font-size:10px}#quick-connect{font-size:11px;white-space:nowrap}.conversation{display:contents}.room-panel{grid-column:1;grid-row:3;background:var(--panel);border-radius:7px;padding:24px 20px 20px;display:flex;flex-direction:column;min-width:0}.channel-header{display:flex;justify-content:space-between;align-items:center;gap:16px;margin:0 0 20px}.channel-header h1{font-size:30px;margin-bottom:8px;overflow-wrap:anywhere}.channel-header .eyebrow{font-size:9px;margin:0;text-transform:uppercase}.room-audio-status{text-align:right;flex-shrink:0;font-size:12px;color:var(--accent)}.room-audio-status .hint{font-size:11px;margin:4px 0 0}.members{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;flex:1;align-content:start;min-height:310px}.member{position:relative;background:var(--strip);border-radius:6px;padding:20px;min-width:0;display:flex;flex-direction:column;min-height:345px;border:1px solid transparent}.member.speaking{border-color:var(--accent)}.member-top{display:flex;align-items:center;justify-content:space-between;color:var(--muted);font:10px 'IBM Plex Mono',monospace;margin-bottom:24px}.member .member-info strong{display:block;font-size:20px;font-weight:400;overflow-wrap:anywhere;line-height:1.3;margin-bottom:16px}.member-info .hint{font:10px 'IBM Plex Mono',monospace;display:block;min-height:16px}.member-info .hint::before{content:'▪';margin-right:8px;color:var(--muted)}.member.speaking .hint,.member.speaking .hint::before{color:var(--accent)}.member-mix{display:flex;justify-content:space-between;gap:8px;min-height:125px;margin-top:14px}.volume-value{font-family:'IBM Plex Mono',monospace;font-size:37px;line-height:1}.volume-value small{font-size:8px;display:block;color:var(--muted);margin-top:10px}.volume-label{font-size:12px;color:var(--muted);margin-top:30px}.fader{position:relative;min-width:68px;width:40%;display:flex;justify-content:center;background:repeating-linear-gradient(to bottom,transparent 0 15px,var(--line) 15px 16px) left center/20px calc(100% - 22px) no-repeat}.fader input{writing-mode:vertical-lr;direction:rtl;appearance:none;width:7px;min-height:0;height:124px;background:var(--field);padding:0;flex:none;margin:0 8px 0 0;border-radius:5px}.fader input::-webkit-slider-thumb{appearance:none;width:38px;height:29px;border-radius:4px;background:linear-gradient(to bottom,var(--control) 0 47%,#53554e 47% 53%,var(--control) 53% 100%);border:0;box-shadow:0 0 0 1px #17181830}.fader input::-moz-range-thumb{width:38px;height:29px;border:0;border-radius:4px;background:var(--control)}.fader-scale{display:flex;flex-direction:column;justify-content:space-between;font:9px 'IBM Plex Mono',monospace;color:var(--muted);padding:0 0 0 8px}.member-actions{margin-top:auto;padding-top:16px;border-top:1px solid var(--line);display:flex;gap:12px}.member-actions button{font-size:11px;min-height:32px;padding:4px 0;flex:1;text-align:left}.member-actions button:first-child{color:var(--ink)}.room-empty{grid-column:1/-1;align-self:center;padding:55px 15px;text-align:center}.room-empty h2{font-size:28px}.room-empty button{margin-top:20px}.channel-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px;min-height:30px}.channel-footer>.hint{font-size:11px;margin:0;max-width:65%}.channel-footer button{font-size:10px;min-height:32px;padding:5px 8px}.voice-dock{grid-column:2;grid-row:3;background:var(--control);color:var(--control-ink);padding:28px 24px 12px;border-radius:8px;display:flex;flex-direction:column;min-width:0}.voice-dock .eyebrow,.voice-dock .hint{color:inherit}.voice-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;font:11px 'IBM Plex Mono',monospace}.voice-heading .eyebrow{margin:0}.voice-dock>h2{font-size:49px;font-weight:500;letter-spacing:-.04em;margin-bottom:22px}.voice-dock>p{font-size:13px;line-height:1.6}.voice-controls{margin:0;padding:0;border:0;min-width:0;flex:1}.voice-switches{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:18px 0 22px}.voice-switches button{min-height:83px;font-size:12px;text-align:left;padding:14px 13px;color:#171818;line-height:1.5}.voice-switches button:disabled{opacity:.5}.voice-switches #voice-listen{background:#eeece3}.voice-switches button::before{display:block;margin-bottom:8px;font-size:18px;font-weight:400}.voice-switches #voice-mic::before{content:'♩'}.voice-switches #voice-listen::before{content:'∩'}.voice-switches button[aria-pressed=true]{box-shadow:inset 0 0 0 2px #424339}.voice-switches #voice-mic[aria-pressed=true]{background:#c1c99c}.mode-row{display:flex;align-items:center;gap:12px;margin-bottom:14px}.mode-row label{color:inherit;font-size:12px;margin:0;flex:1}.mode-row select{width:55%;background:transparent;color:inherit;font-size:12px;padding:8px;min-height:40px}.voice-dock #voice-ptt{background:#c5c4b8;color:#171818;font-size:12px;min-height:40px}.transmission-status{font:10px 'IBM Plex Mono',monospace;display:block;min-height:18px;margin:10px 0;color:#5a5c52}.transmission-status.transmitting{color:#434b22;font-weight:500}.devices-button{color:inherit!important;font-size:12px;padding-inline:0!important;margin:3px 0 12px}.voice-controls>p{font-size:10px;line-height:1.65;color:#5a5b53;margin:7px 0}.voice-dock .disconnect-button{color:inherit;border-top:1px solid #bdbeb1;border-radius:0;text-align:left;padding:15px 0 4px;margin-top:18px;font-size:11px}.chat-panel{grid-column:1/-1;grid-row:4;background:var(--panel);border-radius:6px;padding:20px;min-width:0}.chat-header{display:flex;align-items:center;gap:15px;margin-bottom:16px}.chat-header h2{font-size:9px;min-width:175px;margin:0}.chat-header select{width:auto;background:transparent;font-size:12px;padding:8px;min-height:35px}.chat-header>p{margin:0 20% 0 auto;font-size:10px}.chat-header button{font-size:12px;min-height:35px;padding:8px}.chat-body{display:grid;grid-template-columns:minmax(0,2fr) minmax(300px,1fr);gap:24px;min-height:140px}.message-history{position:relative;min-width:0;min-height:140px}.messages{list-style:none;margin:0;padding:0;max-height:240px;overflow:auto;scrollbar-width:thin}.message{display:grid;grid-template-columns:140px 1fr;gap:18px;padding:8px 0;overflow-wrap:anywhere;font-size:12px}.message-heading{display:flex;flex-direction:row-reverse;justify-content:flex-end;gap:24px;align-items:baseline}.message-heading strong{font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:85px}.message-heading time{font:9px 'IBM Plex Mono',monospace;color:var(--muted);min-width:35px}.message p{margin:0;white-space:pre-wrap}.chat-empty{position:absolute;top:20px;left:0;color:var(--muted);font-size:13px}.chat-empty span{display:block;font-size:11px;margin-top:8px}.composer{background:var(--field);border-radius:5px;padding:14px;min-height:136px}.composer textarea{padding:0;background:transparent;border:0;min-height:54px;font-size:12px;resize:vertical}.composer-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:6px}.composer-actions .hint{font-size:9px;max-width:130px}.composer button{font-size:11px;white-space:nowrap;min-height:36px;padding:8px 17px}#message-status{font-size:11px;line-height:1.4;margin:7px 0 0;overflow-wrap:anywhere}#message-status:empty{display:none}.console-footer{grid-column:1/-1;grid-row:5;display:flex;align-items:center;gap:30px;color:var(--muted);font:9px 'IBM Plex Mono',monospace;min-height:32px}.console-footer>div{flex:1;text-align:center;min-width:0}.console-footer p{margin:0;overflow-wrap:anywhere}.console-footer button{font:10px 'IBM Plex Sans',sans-serif;padding:5px;min-height:32px}.workspace[data-connection=retrying] .console-footer,.workspace[data-connection=failed] .console-footer{color:var(--accent)} +/* The application shell contains separate pages; voice remains live when navigating. */ +.app-shell{max-width:1600px;margin:auto;padding:24px 32px 12px;min-height:100dvh}.topbar{border-bottom:1px solid var(--line);padding-bottom:18px;margin-bottom:24px;gap:18px}.topbar .brand{min-width:210px}.page-breadcrumb{margin:0}.topbar>.eyebrow{margin:0;flex:1}.top-actions{flex:none}.top-actions button[aria-current=page]{color:var(--ink);background:var(--panel)}#account-label{margin-left:12px}.app-shell:not([data-page=console]) .server-selector{display:none}.app-shell[data-page=console] #page-breadcrumb{display:none}.session-ribbon{display:flex;gap:20px;align-items:center;padding:10px 18px;background:var(--strip);border-radius:5px;font-size:11px;margin-bottom:12px}.session-ribbon button{margin-left:auto;min-height:32px;font-size:11px;padding:4px 8px}#ribbon-status{color:var(--connected)}#ribbon-audio{color:var(--muted)}.app-page{padding:30px 40px 40px;min-height:calc(100dvh - 175px)}.page-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:0 0 48px}.page-heading .eyebrow{color:var(--accent);margin-bottom:12px}.page-heading h1{font-size:34px;margin-bottom:12px}.page-heading .hint{margin:0}.page-heading>.row{flex-shrink:0}.page-heading button{min-width:160px}.settings-surface{padding:30px;background:var(--panel);border-radius:6px;margin:0 0 24px}.settings-surface>label:first-child{margin-top:0}.settings-surface>button{margin-top:22px}.editor-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);gap:24px;align-items:start}.host-fields{display:grid;grid-template-columns:1fr 160px;gap:22px}.editor-actions{display:flex;gap:22px;margin-top:36px}.editor-actions>button{flex:1}.editor-actions+p{margin-top:16px}#native-status{font-size:11px;margin:12px 0 0;color:var(--muted)}.field-note{margin-top:40px!important}.callout{border-left:2px solid var(--accent);padding:18px 20px;background:var(--strip);border-radius:0 5px 5px 0;margin:22px 0}.callout strong{font-size:13px;font-weight:400}.callout .hint{margin:7px 0 0}.callout button{margin-top:16px}.danger{color:var(--accent)!important}.destination-table{background:var(--panel);padding:24px 30px;border-radius:6px;min-height:290px}.destination-columns,.destination-row{display:grid;grid-template-columns:minmax(200px,2fr) minmax(80px,.8fr) minmax(110px,.8fr) minmax(200px,1.2fr);gap:24px;align-items:center}.destination-columns{font:9px 'IBM Plex Mono',monospace;color:var(--muted);border-bottom:1px solid var(--line);padding-bottom:18px}.destination-row{padding:28px 0;border-bottom:1px solid var(--line)}.destination-row:last-child{border-bottom:0}.destination-row h2{font-size:21px;margin-bottom:10px;overflow-wrap:anywhere}.destination-row p{font-size:11px;margin:0}.destination-nickname{font-size:13px;overflow-wrap:anywhere}.destination-state{font-size:12px;color:var(--muted)}.destination-state.is-active{color:var(--connected)}.destination-row .row{gap:8px;justify-content:flex-end}.destination-row button{font-size:12px;min-width:65px}.destination-row button.secondary{min-width:105px}.destinations-empty{padding:50px 16px;text-align:center}.destinations-empty button{margin-top:20px}.destinations-empty h2{font-size:27px}#recent-connection{display:flex;align-items:center;justify-content:space-between;margin-top:24px;gap:20px}#recent-connection h2{font-size:20px}#recent-connection p{margin-bottom:5px}.identity-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px}.identity-grid h2{font-size:28px;margin:20px 0}.identity-grid .hint{max-width:430px;min-height:48px}.identity-grid button{width:100%}.identity-ready .row{margin:28px 0}#identity-status{font:14px/1.9 'IBM Plex Mono',monospace;overflow-wrap:anywhere;background:var(--field);padding:20px;border-radius:4px}.identity-ready>.hint{margin:0}.settings-columns{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);gap:24px}.settings-columns .settings-surface{margin-bottom:24px}.processing{background:var(--control);color:var(--control-ink)}.processing .eyebrow,.processing .hint{color:inherit}.processing>p:not(.eyebrow):not(.hint){margin:26px 0;font-size:13px}.processing>.hint{margin-top:42px;font-size:11px}.mode-heading{margin-top:34px}.mode-options{margin:26px 0 24px}.mode-options button{flex:1;background:var(--control);color:var(--control-ink)}.mode-options button[aria-pressed=true]{background:var(--accent);color:var(--on-accent)}.checkbox-label{display:flex;align-items:start;gap:10px;font-size:12px;line-height:1.7}.checkbox-label input{margin-top:3px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:20px;padding-bottom:18px;border-bottom:1px solid var(--line);margin-bottom:8px}.section-title h2{font-size:16px;margin:0}.section-title span{font:10px 'IBM Plex Mono',monospace;color:var(--muted)}.channel-browser{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);gap:24px;align-items:start;margin-top:30px}.channel-browser .settings-surface{padding:24px}.channel-detail{background:var(--control);color:var(--control-ink);padding:30px;border-radius:7px;position:sticky;top:24px}.channel-detail>.eyebrow,.channel-detail .hint,.channel-detail label{color:inherit}.channel-detail h2{font-size:27px;overflow-wrap:anywhere;margin-top:28px}.channel-detail label{margin-top:28px}.channel-detail input{background:#f7f5ed;color:#171818}.channel-detail button:not(.quiet){background:#101111;color:#eeeae0}.channel-detail #join-submit{width:100%;margin-top:18px}.channel-detail>p:not(.eyebrow):not(.hint){font-size:13px;overflow-wrap:anywhere}.channel-detail .field-note{font-size:11px}.channel-detail button.quiet{color:inherit}.channel-detail ul{list-style:none;padding:0;margin:24px 0}.channel-detail li{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:13px;border-top:1px solid #bcbdb0;padding:7px 0;overflow-wrap:anywhere}.channel-detail li button{font-size:11px;min-height:36px}.channel-result{display:flex;align-items:center;justify-content:space-between;gap:20px;background:transparent;color:var(--ink);width:100%;text-align:left;padding:14px 16px;min-height:67px;border:1px solid transparent}.channel-result[aria-pressed=true]{background:var(--strip);border-color:var(--line)}.channel-result strong{display:block;font-size:15px;font-weight:400;overflow-wrap:anywhere}.channel-result .hint{display:block;font-size:10px}.channel-result>.hint{max-width:125px;text-align:right;flex-shrink:0}#ts3-channels{list-style:none;padding:0;margin:0;overflow:auto;max-height:calc(100dvh - 370px);min-height:230px;scrollbar-width:thin}#ts3-channels li[data-depth="1"]{padding-left:14px}#ts3-channels li[data-depth="2"]{padding-left:28px}#ts3-channels li[data-depth="3"],#ts3-channels li[data-depth="4"]{padding-left:42px}#join-status{font-size:12px;margin:16px 0}#browse-participants:empty{display:none} +.console-page{display:grid;grid-template-columns:minmax(0,2.5fr) minmax(305px,1fr);grid-template-rows:auto minmax(480px,auto) auto;gap:20px;min-height:calc(100dvh - 165px)}.console-page .rooms-bar{grid-column:1/-1;grid-row:1}.console-page .room-panel{grid-column:1;grid-row:2}.console-page .voice-dock{grid-column:2;grid-row:2}#console-chat-slot{display:contents}.console-page .chat-panel{grid-column:1/-1;grid-row:3}#room-tabs li{max-width:240px;min-width:120px}.room-finder{font-size:10px!important}#quick-connect{margin-left:auto}.mixer-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:-4px 0 14px}.mixer-toolbar .hint{margin:0;font-size:10px}.mixer-toolbar button{font-size:11px;min-height:34px;padding:4px 8px}.members{max-height:520px;overflow:auto;min-height:320px;scrollbar-width:thin}.member{min-height:330px}.member-top{margin-bottom:24px}.member-info .hint{overflow-wrap:anywhere}.members.compact-members{display:flex;flex-direction:column;gap:8px;align-items:stretch}.compact-members .member{min-height:100px;display:grid;grid-template-columns:30px minmax(100px,1fr) 160px 130px;gap:16px;align-items:center}.compact-members .member-top{margin:0}.compact-members .member-info strong{font-size:17px;margin-bottom:8px}.compact-members .member-mix{min-height:0;align-items:center;margin:0;gap:10px}.compact-members .volume-value{font-size:22px}.compact-members .volume-value small,.compact-members .volume-label,.compact-members .fader-scale{display:none}.compact-members .fader{background:none;min-width:0;width:100%}.compact-members .fader input{writing-mode:horizontal-tb;direction:ltr;appearance:auto;width:100%;height:26px;margin:0}.compact-members .fader input::-webkit-slider-thumb{appearance:auto;width:auto;height:auto;background:none;box-shadow:none}.compact-members .member-actions{margin:0;padding:0;border:0;gap:8px}.compact-members .member-actions button{min-height:44px}.voice-heading{margin-bottom:24px}.voice-dock>h2{margin-bottom:18px}.voice-switches{margin:12px 0 16px}.voice-switches #voice-mic::before{content:'';width:22px;height:22px;background:url('/icons/microphone.svg') center no-repeat}.voice-switches #voice-listen::before{content:'';width:22px;height:22px;background:url('/icons/headphones.svg') center no-repeat}.voice-dock .disconnect-button{margin-top:12px}.voice-transmission{clear:both}.chat-tabs{display:flex;align-items:center;gap:6px;min-width:0}.chat-tabs button{max-width:240px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:400}.chat-tabs button[aria-pressed=true]{color:var(--ink)}.chat-header #poke-open{font-size:11px}.console-footer{display:flex;padding-top:18px;border-top:1px solid var(--line);margin-top:24px}.console-footer>div{line-height:1.7}.console-footer>button{flex:none}.direct-grid{display:grid;grid-template-columns:230px minmax(0,1fr) 290px;gap:24px;min-height:550px}.thread-list{background:var(--panel);padding:24px 16px;border-radius:6px}.thread{display:block;text-align:left;width:100%;background:transparent;color:var(--ink);padding:14px;margin:8px 0}.thread[aria-pressed=true]{background:var(--strip)}.thread strong{display:block;font-size:14px;font-weight:400;overflow-wrap:anywhere}.thread .hint{display:block;font-size:10px;margin-top:4px}.thread-list>button{display:block;width:100%;text-align:left;font-size:12px}#direct-chat-slot{min-width:0}#direct-chat-slot .chat-panel{height:100%;display:flex;flex-direction:column;padding:28px}#direct-chat-slot .chat-header{align-items:start;flex-wrap:wrap}#direct-chat-slot .chat-header h2{display:none}#direct-chat-slot .chat-tabs{display:none}#direct-chat-slot .chat-header>p{margin:0 auto;font-size:10px}#direct-chat-slot #chat-context{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto;white-space:normal;font-size:15px;color:var(--ink);display:block;padding-bottom:20px}#direct-chat-slot .chat-body{display:flex;flex-direction:column;flex:1}#direct-chat-slot .message-history{flex:1;min-height:240px}#direct-chat-slot .messages{max-height:360px}#direct-chat-slot .message{display:block;padding:15px 0;border-top:1px solid var(--line)}#direct-chat-slot .message-heading{flex-direction:row;justify-content:space-between;margin-bottom:12px}#direct-chat-slot .message-heading strong{max-width:80%;white-space:normal}#direct-chat-slot .composer-actions .hint{display:none}.direct-grid .channel-detail{position:static}.direct-grid label{margin-top:40px}.direct-grid #direct-poke{margin-top:30px}.direct-grid #direct-volume{padding:0;background:transparent;accent-color:#171818} +dialog{padding:28px;width:480px;max-width:calc(100vw - 32px);max-height:90dvh;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--ink);box-shadow:0 20px 90px #0006}dialog::backdrop{background:#0b0d0bbd;backdrop-filter:blur(4px)}.dialog-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:24px}.dialog-heading h2{margin:0}.dialog-heading button{flex:none}#confirm-description{font-size:14px;line-height:1.8;color:var(--muted);margin-bottom:26px}#poke-recipient{overflow-wrap:anywhere;font-size:19px}#poke-status{font-size:12px;margin:18px 0}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:11px/1.6 'IBM Plex Mono',monospace;max-height:520px;overflow:auto;background:var(--field);padding:22px}.notice-toast{position:fixed;right:20px;top:20px;z-index:20;max-width:min(520px,calc(100vw - 32px));display:flex;align-items:start;gap:8px;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:6px;background:var(--panel);padding:6px;box-shadow:0 8px 40px #0005}#notice{margin:0;padding:10px 8px 10px 12px;font-size:12px}#notice-dismiss{flex:none;min-width:44px;min-height:44px;padding:8px}.signin-copy{display:contents}.registration-copy{display:none}.signin-copy>.eyebrow{color:var(--accent);margin-bottom:48px}.signin-copy>p:not(.eyebrow){color:var(--muted);line-height:1.9}.welcome[data-auth-mode=register] .welcome-copy{grid-column:2;grid-row:2;min-height:0;align-self:center;background:transparent;padding:0 24px;margin:40px 0}.welcome[data-auth-mode=register] .signin-copy{display:none}.welcome[data-auth-mode=register] .registration-copy{display:block}.registration-copy section{background:var(--strip);border-radius:5px;padding:26px;margin-bottom:20px}.registration-copy h2{font-size:22px}.registration-copy .eyebrow{color:var(--accent)}.welcome[data-auth-mode=register] #login{grid-column:1;grid-row:2;background:var(--panel);border-radius:7px;padding:34px;max-width:none;margin:40px 0} +@media(max-width:1200px){.topbar{flex-wrap:wrap;gap:12px}.topbar .brand{min-width:170px}.top-actions{margin-left:auto}#account-label{max-width:150px}.topbar>.eyebrow{font-size:9px}.app-page{padding:24px 12px 36px}.direct-grid{grid-template-columns:190px minmax(0,1fr) 240px;gap:16px}.destination-columns,.destination-row{grid-template-columns:minmax(170px,1.6fr) 90px 100px minmax(180px,1.2fr);gap:16px}.console-page{grid-template-columns:minmax(0,2fr) 300px}.members{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.member{padding:16px;min-height:320px}.member-info strong{font-size:19px!important}.compact-members .member{grid-template-columns:22px minmax(85px,1fr) 100px}.compact-members .member-actions{grid-column:2/4}.chat-header h2{min-width:140px}.voice-dock{padding:24px 20px 12px}.page-heading{margin-bottom:34px}} +@media(max-width:900px){.app-shell{padding:18px}.topbar>.eyebrow{display:none}.topbar .brand{min-width:0}.top-actions{width:100%;padding-top:8px;justify-content:flex-end;border-top:1px solid var(--line)}.server-selector{margin-left:auto;max-width:65%}.app-shell:not([data-page=console]) .top-actions{width:auto;border-top:0}#account-label{max-width:120px;margin-left:0}.editor-grid,.settings-columns,.channel-browser{grid-template-columns:minmax(0,1.3fr) minmax(250px,1fr);gap:18px}.settings-surface,.channel-detail{padding:24px}.host-fields{grid-template-columns:1fr 105px;gap:12px}.editor-actions{flex-direction:column;gap:12px}.direct-grid{grid-template-columns:180px minmax(0,1fr)}.direct-grid>.channel-detail{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:center}.direct-grid>.channel-detail .field-note{grid-column:1/-1}.direct-grid>.channel-detail h2,.direct-grid>.channel-detail p{margin:0}.direct-grid>.channel-detail label{margin:0}.destination-nickname{display:none}.destination-columns,.destination-row{grid-template-columns:minmax(180px,1.7fr) 100px minmax(160px,1fr)}.destination-columns>span:nth-child(2){display:none}.destination-row button.secondary{min-width:85px}.destination-table{padding:20px}.console-page{grid-template-columns:minmax(0,1fr) 280px;gap:14px}.room-panel{padding:20px 14px}.room-audio-status{display:none}.channel-header h1{font-size:25px}.member-info strong{font-size:17px!important}.fader{min-width:58px}.fader-scale{font-size:8px;padding-left:2px}.member{padding:14px}.member-mix{gap:3px}.volume-value{font-size:30px}.chat-body{grid-template-columns:1.2fr 1fr;gap:16px}.message{display:block}.message-heading{margin-bottom:8px}.composer-actions .hint{display:none}.composer-actions{justify-content:flex-end}.page-heading h1{font-size:30px}.page-heading>.row button{min-width:0}.session-ribbon{flex-wrap:wrap;gap:4px 16px}.session-ribbon button{margin-left:auto}.console-footer{font-size:8px;gap:14px}.channel-result{padding:12px 8px;gap:10px}.channel-result>.hint{max-width:90px}.channel-result strong{font-size:14px}.welcome{padding:24px;grid-template-columns:1.1fr 1fr;column-gap:6%}.account-header{gap:40px}.account-header>.hint{display:none}.welcome-copy{min-height:600px;padding:32px 24px}.signin-copy>.eyebrow{margin-bottom:35px;font-size:9px}.welcome h1{font-size:36px}.signin-copy>p:not(.eyebrow){font-size:13px}.welcome-room{padding:24px;margin:30px 0}#login{padding:40px 0}#login h2{font-size:29px}} +@media(max-width:660px){.app-shell{padding:16px 14px 0}.app-page{padding:14px 2px 24px;min-height:calc(100dvh - 180px)}.topbar{padding:0 0 12px;margin-bottom:20px;gap:10px}.topbar .brand{font-size:22px}.mark{gap:2px}.mark i{width:2px}.topbar .server-selector{max-width:55%;padding:4px 0;gap:6px}.server-selector #server-name{max-width:90px;font-size:8px}#connection-badge{font-size:8px}.top-actions{gap:0;justify-content:space-between;width:100%!important;border-top:1px solid var(--line)!important;padding-top:6px}.top-actions button{font-size:11px;min-height:44px;padding:8px 7px}#account-label{max-width:100px}.page-heading{display:block;margin-bottom:28px}.page-heading .eyebrow{font-size:9px}.page-heading h1{font-size:30px}.page-heading>.row{margin-top:20px}.page-heading button{min-width:0;min-height:44px}.editor-grid,.settings-columns,.identity-grid,.channel-browser{display:flex;flex-direction:column;gap:0}.editor-grid>*,.settings-columns>*,.channel-browser>*{width:100%}.editor-grid>aside{display:flex;flex-direction:column}.editor-grid .settings-surface{order:1}.editor-grid>aside .settings-surface{margin-bottom:0}.settings-surface{padding:24px 20px;margin-bottom:18px}.host-fields{grid-template-columns:1fr 100px}.callout{padding:16px;margin:18px 0}.field-note{margin-top:26px!important}.identity-grid .settings-surface{width:100%}.identity-grid h2{font-size:25px}.destination-columns{display:none}.destination-table{padding:4px 20px;min-height:0}.destination-row{display:grid;grid-template-columns:1fr auto;gap:16px;padding:23px 0}.destination-row>div:first-child{grid-column:1/-1}.destination-row h2{font-size:21px}.destination-row .row{gap:4px}.destination-row button{min-height:44px;font-size:11px}.destination-state{font-size:11px}.destination-nickname{display:none}.destinations-empty{padding:36px 4px}.destinations-empty h2{font-size:26px}#recent-connection{display:block}#recent-connection button{margin-top:18px}.channel-browser{margin-top:22px}.channel-browser>.settings-surface{padding:18px 12px}.channel-detail{position:static;padding:24px}.channel-detail h2{margin-top:20px;font-size:26px}#ts3-channels{max-height:340px;min-height:100px}.channel-result{gap:8px;padding:12px 8px}.channel-result strong{font-size:14px}.channel-result>.hint{font-size:9px;max-width:83px}#ts3-channels li[data-depth="1"]{padding-left:10px}#ts3-channels li[data-depth="2"],#ts3-channels li[data-depth="3"],#ts3-channels li[data-depth="4"]{padding-left:20px}.channel-detail li button{min-height:44px}.console-page{display:flex;flex-direction:column;gap:16px;min-height:0}.rooms-bar{gap:3px;padding:5px;min-height:54px}.room-finder{font-size:8px!important;padding:8px!important}.rooms-bar #quick-connect{display:none}#room-tabs li{min-width:135px}#room-tabs button{padding:10px 12px;font-size:12px}.room-panel{padding:20px 14px 14px}.channel-header{margin-bottom:14px}.channel-header h1{font-size:26px}.channel-header .eyebrow{font-size:8px}.mixer-toolbar{margin-bottom:8px}.mixer-toolbar button{display:none}.mixer-toolbar .hint{font-size:9px}.members,.members.compact-members{display:flex;flex-wrap:nowrap;flex-direction:column;align-items:stretch;gap:10px;min-height:0;max-height:460px}.member,.compact-members .member{width:100%;min-height:130px;display:grid;grid-template-columns:20px minmax(0,1fr) 95px;grid-template-rows:auto auto;column-gap:8px;padding:14px}.member-top,.compact-members .member-top{font-size:8px;grid-column:1;grid-row:1;margin:4px 0 0}.member .member-info,.compact-members .member-info{grid-column:2;grid-row:1}.member .member-info strong,.compact-members .member-info strong{font-size:15px!important;margin-bottom:8px}.member-info .hint{font-size:9px}.member-mix,.compact-members .member-mix{grid-column:3;grid-row:1;min-height:0;flex-direction:column;margin:0;gap:4px;align-items:stretch}.volume-value,.compact-members .volume-value{font-size:20px}.volume-value small,.volume-label,.fader-scale{display:none}.fader{width:100%;min-width:0;background:none;padding:0}.fader input,.compact-members .fader input{writing-mode:horizontal-tb;direction:ltr;appearance:auto;width:100%;height:24px;margin:0}.fader input::-webkit-slider-thumb{appearance:auto;width:auto;height:auto;background:none;box-shadow:none}.member-actions,.compact-members .member-actions{grid-column:2/4;grid-row:2;gap:20px;padding:0;margin-top:4px;border:0}.member-actions button,.compact-members .member-actions button{flex:none;min-height:44px;font-size:11px;padding:4px}.channel-footer{gap:8px;margin-top:14px;align-items:start}.channel-footer>.hint{max-width:60%;font-size:10px}.channel-footer button{font-size:10px}.chat-panel{padding:18px 14px;min-height:280px}.chat-header{gap:3px;flex-wrap:wrap;margin-bottom:14px}.chat-header h2{font-size:8px;min-width:86px}.chat-header button{font-size:11px;min-height:44px;padding:8px 6px}.chat-tabs{gap:0}.chat-tabs button{max-width:130px}.chat-header>p{display:none}.chat-body{grid-template-columns:1fr;gap:16px}.message-history{min-height:95px}.messages{max-height:230px}.message{display:grid;grid-template-columns:90px 1fr;gap:10px;font-size:11px}.message-heading{gap:6px;margin:0}.message-heading time{display:none}.composer{min-height:110px;padding:12px}.composer textarea{min-height:40px}.voice-dock{position:sticky;bottom:0;padding:14px 16px 10px;margin:0 -14px;border-radius:8px 8px 0 0;box-shadow:0 -8px 30px #0004;z-index:3;display:block;order:5}.voice-heading{display:none}.voice-dock>h2{font-size:22px;display:inline;margin:0}.voice-dock>p{font-size:10px;display:inline;margin:0 0 0 8px}.voice-dock>p br{display:none}.voice-controls{display:block}.voice-switches{margin:12px 0 6px;gap:10px}.voice-switches button{min-height:44px;padding:10px;font-size:12px}.voice-switches #voice-mic::before,.voice-switches #voice-listen::before{display:none}.mode-row{margin:0;float:left;width:55%;min-height:34px}.mode-row label{font-size:10px}.mode-row select{width:62%;font-size:10px;min-height:34px;padding:4px}.voice-dock #voice-ptt{width:43%;min-height:34px;padding:6px;font-size:10px;float:right}.transmission-status{clear:both;float:left;font-size:9px;margin:4px 0 0;max-width:45%}.devices-button{display:block;margin:0 0 0 auto!important;padding:3px 0!important;font-size:10px;min-height:30px}.voice-controls>p{font-size:9px;line-height:1.5;margin:4px 0 0;max-height:38px;overflow:auto;clear:both}.voice-controls>p:empty{display:none}.voice-dock .disconnect-button{display:none}.console-footer{margin-top:22px;padding-bottom:16px;display:flex;flex-direction:column;align-items:start;gap:4px}.console-footer>div{text-align:left}.console-footer>span{display:none}.console-footer button{font-size:10px;padding:3px 0}.session-ribbon{padding:8px 12px;font-size:10px;gap:5px 12px}.session-ribbon button{width:100%;text-align:left;margin:0}.direct-grid{display:flex;flex-direction:column;gap:16px}.thread-list{padding:18px 14px}.thread-list>.eyebrow{margin-bottom:10px}#conversation-threads{display:flex;overflow:auto;gap:8px}.thread{flex:none;width:180px;margin:0}.thread-list>button{display:inline;width:auto;min-height:44px;padding:6px 10px}.direct-grid>.channel-detail{display:block}.direct-grid>.channel-detail>*{margin-bottom:12px!important}.direct-grid>.channel-detail label{margin-top:20px!important}#direct-chat-slot .chat-panel{min-height:420px;padding:20px}#direct-chat-slot .chat-body{gap:12px}#direct-chat-slot .message-history{min-height:160px}#direct-chat-slot .messages{max-height:300px}#direct-chat-slot .message-heading time{display:block}dialog{padding:24px 20px;max-width:calc(100vw - 24px)}.notice-toast{top:12px;right:12px;max-width:calc(100vw - 24px)}.welcome{display:flex;flex-direction:column;padding:22px 20px;gap:0;min-height:100dvh}.account-header{gap:20px;padding:0 0 18px}.account-header .brand{font-size:23px}.account-header .eyebrow{font-size:8px;margin-left:auto}.welcome-copy{min-height:0;padding:26px;margin:24px 0 0}.signin-copy>.eyebrow{margin-bottom:26px;font-size:8px}.welcome h1{font-size:38px;margin-bottom:20px}.signin-copy>p:not(.eyebrow){font-size:12px}.welcome-room,.welcome-note{display:none}#login{max-width:none;padding:32px 4px}#login>.eyebrow{font-size:9px}#login h2{font-size:29px}#login>label{margin-top:24px}#login button{margin-top:28px}#login #auth-toggle{margin-bottom:16px}.account-footer{font-size:8px;gap:20px;padding-top:18px}.account-footer>span:last-child{text-align:right}.welcome[data-auth-mode=register] .welcome-copy{order:2;margin:0 0 30px;padding:0}.welcome[data-auth-mode=register] #login{order:1;margin:24px 0;padding:24px 20px}.welcome[data-auth-mode=register] .account-footer{order:3}.registration-copy section{padding:20px}} +@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}} + +.page-heading h1:focus{outline:none}.app-shell[data-connection=retrying] .console-footer,.app-shell[data-connection=failed] .console-footer{color:var(--accent)} + +.skip-link:not(:focus){clip-path:inset(50%)}.channel-detail #browse-participants{max-height:240px;overflow:auto;scrollbar-width:thin}.channel-browser>.channel-detail{max-height:calc(100dvh - 180px);overflow:auto;scrollbar-width:thin}#ribbon-mute{margin-left:0;background:var(--control);color:var(--control-ink)} +@media(max-width:660px){.channel-browser>.channel-detail{max-height:none}.top-actions button{padding-inline:5px;font-size:10px}.session-ribbon #ribbon-mute{width:auto}.session-ribbon>button:last-child{width:auto;margin-left:auto}} + +#direct-chat-slot #poke-open{display:none}#conversation-threads{max-height:450px;overflow:auto;scrollbar-width:thin}.composer-actions{justify-content:flex-end}.app-page>label{margin-top:0}.direct-grid .chat-empty{top:75px;font-size:13px} +@media(max-width:660px){#conversation-threads{max-height:145px}} + +#direct-tools-toggle{display:none}#editor-mobile-actions:empty{display:none} +@media(max-width:660px){#editor-mobile-actions{padding:20px;background:var(--panel);border-radius:6px;margin-top:18px}.editor-actions{margin-top:0}#direct-tools-toggle{display:block;margin:-10px 0 20px;padding-inline:0}.direct-grid>.thread-list{order:0}.direct-grid>#direct-chat-slot{order:2}.direct-grid>.channel-detail{display:none;order:1}.direct-grid.show-direct-controls>.channel-detail{display:block}} diff --git a/public/vendor/opus/COPYING.libopus b/public/vendor/opus/COPYING.libopus new file mode 100644 index 0000000..7571146 --- /dev/null +++ b/public/vendor/opus/COPYING.libopus @@ -0,0 +1,44 @@ +Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo, Mozilla, Amazon + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ diff --git a/public/vendor/opus/LICENSE b/public/vendor/opus/LICENSE new file mode 100644 index 0000000..c6d2a30 --- /dev/null +++ b/public/vendor/opus/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 openclaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/public/vendor/opus/PROVENANCE.json b/public/vendor/opus/PROVENANCE.json new file mode 100644 index 0000000..d807b1d --- /dev/null +++ b/public/vendor/opus/PROVENANCE.json @@ -0,0 +1,7 @@ +{ + "package": "libopus-wasm", + "version": "0.3.0", + "generatedSha256": "0041fc800ccd26f56b27eaeb1834c8c6854e5167d48cd628a4f98ec5b590c6f1", + "licenseSource": "https://github.com/xiph/opus/blob/v1.6.1/COPYING", + "note": "The unchanged upstream-generated WASM includes published upstream compiler/assertion build paths; no owner configuration is embedded." +} diff --git a/public/vendor/opus/THIRD_PARTY_NOTICES.md b/public/vendor/opus/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..cb8dbc8 --- /dev/null +++ b/public/vendor/opus/THIRD_PARTY_NOTICES.md @@ -0,0 +1,12 @@ +# Third-party notices + +This package builds and distributes WebAssembly generated from Xiph.Org's +`libopus`. + +## libopus + +- Source: https://github.com/xiph/opus +- Release source: https://downloads.xiph.org/releases/opus/ +- License: BSD-style license, see the upstream source archive for the full text. + +The JavaScript and TypeScript wrapper code in this repository is MIT licensed. diff --git a/public/vendor/opus/generated/libopus.generated.mjs b/public/vendor/opus/generated/libopus.generated.mjs new file mode 100644 index 0000000..64b4638 Binary files /dev/null and b/public/vendor/opus/generated/libopus.generated.mjs differ diff --git a/public/vendor/opus/index.js b/public/vendor/opus/index.js new file mode 100644 index 0000000..fcbe65a --- /dev/null +++ b/public/vendor/opus/index.js @@ -0,0 +1,666 @@ +import createLibopusModule from "./generated/libopus.generated.mjs"; +export const Application = { + Voip: 2048, + Audio: 2049, + RestrictedLowDelay: 2051, +}; +export const Signal = { + Auto: -1000, + Voice: 3001, + Music: 3002, +}; +export const Bitrate = { + Auto: -1000, + Max: -1, +}; +export const Bandwidth = { + Narrowband: 1101, + Mediumband: 1102, + Wideband: 1103, + Superwideband: 1104, + Fullband: 1105, +}; +export const EncoderCtl = { + SetApplication: 4000, + SetBitrate: 4002, + SetMaxBandwidth: 4004, + SetVbr: 4006, + SetBandwidth: 4008, + SetComplexity: 4010, + SetInBandFec: 4012, + SetPacketLossPercent: 4014, + SetDtx: 4016, + SetVbrConstraint: 4020, + SetForceChannels: 4022, + SetSignal: 4024, + SetLsbDepth: 4036, + SetExpertFrameDuration: 4040, + SetPredictionDisabled: 4042, + SetPhaseInversionDisabled: 4046, +}; +export const DecoderCtl = { + SetGain: 4034, + SetPhaseInversionDisabled: 4046, +}; +const DEFAULT_CHANNELS = 2; +const DEFAULT_FRAME_DURATION_MS = 20; +const MAX_PACKET_DURATION_MS = 120; +const DEFAULT_MAX_PACKET_BYTES = 4000; +const MAX_I32 = 0x7fff_ffff; +const DEFAULT_SAMPLE_RATE = 48_000; +const DECODER_INTEGER_CTL_REQUESTS = new Set(Object.values(DecoderCtl)); +const ENCODER_INTEGER_CTL_REQUESTS = new Set(Object.values(EncoderCtl)); +const ENCODE_FRAME_DURATIONS_MS = [2.5, 5, 10, 20, 40, 60]; +const VALID_SAMPLE_RATES = [8000, 12000, 16000, 24000, 48000]; +let modulePromise; +export async function loadLibopus() { + const module = await getModule(); + return { version: module.UTF8ToString(module._oc_get_version_string()) }; +} +export async function createEncoder(options = {}) { + const module = await getModule(); + return new WasmOpusEncoder(module, normalizeEncoderOptions(options)); +} +export async function createDecoder(options = {}) { + const module = await getModule(); + return new WasmOpusDecoder(module, normalizeDecoderOptions(options)); +} +export async function getPacketInfo(packet, options = {}) { + const sampleRate = options.sampleRate ?? DEFAULT_SAMPLE_RATE; + validateCodecOptions({ channels: DEFAULT_CHANNELS, sampleRate }); + if (packet.byteLength === 0) { + throw new RangeError("packet must not be empty"); + } + const module = await getModule(); + const packetPtr = checkedMalloc(module, packet.byteLength); + try { + module.HEAPU8.set(packet, packetPtr); + const decodedSamples = module._oc_packet_validate_decode(packetPtr, packet.byteLength, sampleRate); + if (decodedSamples < 0) { + throw createOpusError(module, decodedSamples, "getPacketInfo"); + } + const frames = module._oc_packet_parse(packetPtr, packet.byteLength); + if (frames < 0) { + throw createOpusError(module, frames, "getPacketInfo"); + } + const samples = module._oc_packet_get_nb_samples(packetPtr, packet.byteLength, sampleRate); + if (samples < 0) { + throw createOpusError(module, samples, "getPacketInfo"); + } + const channels = module._oc_packet_get_nb_channels(packetPtr); + if (channels !== 1 && channels !== 2) { + throw new OpusError(channels, `libopus getPacketInfo failed (${channels}): invalid channel count`); + } + const bandwidth = module._oc_packet_get_bandwidth(packetPtr); + if (bandwidth < 0) { + throw createOpusError(module, bandwidth, "getPacketInfo"); + } + validateBandwidth(bandwidth, "packet bandwidth"); + return { + bandwidth: bandwidth, + channels, + durationMs: (samples / sampleRate) * 1000, + frames, + samples, + samplesPerFrame: module._oc_packet_get_samples_per_frame(packetPtr, sampleRate), + sampleRate, + }; + } + finally { + module._free(packetPtr); + } +} +class WasmOpusEncoder { + application; + channels; + frameSize; + sampleRate; + #freed = false; + #module; + #packetBytes = 0; + #packetPtr = 0; + #pcmBytes = 0; + #pcmPtr = 0; + #ptr; + constructor(module, options) { + this.#module = module; + this.application = options.application; + this.channels = options.channels; + this.frameSize = options.frameSize; + this.sampleRate = options.sampleRate; + const errorPtr = module._malloc(4); + try { + const ptr = module._oc_create_encoder(options.sampleRate, options.channels, options.application, errorPtr); + const error = module.HEAP32[errorPtr >> 2] ?? 0; + if (!ptr || error !== 0) { + throw createOpusError(module, error, "createEncoder"); + } + this.#ptr = ptr; + } + finally { + module._free(errorPtr); + } + let configured = false; + try { + this.setBitrate(options.bitrate); + this.setComplexity(options.complexity); + this.setDtx(options.dtx); + this.setFec(options.fec); + if (options.maxBandwidth !== undefined) { + this.setMaxBandwidth(options.maxBandwidth); + } + this.setPacketLossPercent(options.packetLossPercent); + this.setSignal(options.signal); + if (options.vbr !== undefined) { + this.setVbr(options.vbr); + } + if (options.vbrConstraint !== undefined) { + this.setVbrConstraint(options.vbrConstraint); + } + configured = true; + } + finally { + if (!configured) { + this.free(); + } + } + } + encode(pcm, options = {}) { + this.#assertLive(); + const frameSize = options.frameSize ?? this.frameSize; + validateEncodeFrameSize(frameSize, this.sampleRate, "frameSize"); + const pcmBytes = toUint8Array(pcm); + const expectedBytes = frameSize * this.channels * 2; + if (pcmBytes.byteLength !== expectedBytes) { + throw new RangeError(`PCM frame has ${pcmBytes.byteLength} bytes; expected ${expectedBytes} for ${frameSize} samples and ${this.channels} channel(s)`); + } + const maxPacketBytes = options.maxPacketBytes ?? DEFAULT_MAX_PACKET_BYTES; + validateIntegerRange(maxPacketBytes, 1, MAX_I32, "maxPacketBytes"); + const pcmPtr = this.#ensurePcmBytes(pcmBytes.byteLength); + const packetPtr = this.#ensurePacketBytes(maxPacketBytes); + this.#module.HEAPU8.set(pcmBytes, pcmPtr); + const encodedBytes = this.#module._oc_encode(this.#ptr, pcmPtr, frameSize, packetPtr, maxPacketBytes); + if (encodedBytes < 0) { + throw createOpusError(this.#module, encodedBytes, "encode"); + } + return this.#module.HEAPU8.slice(packetPtr, packetPtr + encodedBytes); + } + encodeFloat(pcm, options = {}) { + this.#assertLive(); + const frameSize = options.frameSize ?? this.frameSize; + validateEncodeFrameSize(frameSize, this.sampleRate, "frameSize"); + const expectedSamples = frameSize * this.channels; + if (pcm.length !== expectedSamples) { + throw new RangeError(`Float32 PCM frame has ${pcm.length} samples; expected ${expectedSamples} for ${frameSize} samples and ${this.channels} channel(s)`); + } + const maxPacketBytes = options.maxPacketBytes ?? DEFAULT_MAX_PACKET_BYTES; + validateIntegerRange(maxPacketBytes, 1, MAX_I32, "maxPacketBytes"); + const pcmPtr = this.#ensurePcmBytes(pcm.byteLength); + const packetPtr = this.#ensurePacketBytes(maxPacketBytes); + this.#module.HEAPF32.set(pcm, pcmPtr >> 2); + const encodedBytes = this.#module._oc_encode_float(this.#ptr, pcmPtr, frameSize, packetPtr, maxPacketBytes); + if (encodedBytes < 0) { + throw createOpusError(this.#module, encodedBytes, "encodeFloat"); + } + return this.#module.HEAPU8.slice(packetPtr, packetPtr + encodedBytes); + } + encodeFrames(frames, options = {}) { + return frames.map((frame) => this.encode(frame, options)); + } + encodeFloatFrames(frames, options = {}) { + return frames.map((frame) => this.encodeFloat(frame, options)); + } + encoderCtl(request, value) { + this.#assertLive(); + validateInteger(request, "request"); + validateInteger(value, "value"); + if (!ENCODER_INTEGER_CTL_REQUESTS.has(request)) { + throw new RangeError("encoderCtl only supports integer setter requests"); + } + this.#check(this.#module._oc_encoder_ctl(this.#ptr, request, value), "encoderCtl"); + } + setBitrate(bitrate) { + this.encoderCtl(EncoderCtl.SetBitrate, normalizeBitrate(bitrate)); + } + getBitrate() { + this.#assertLive(); + const bitrate = this.#module._oc_encoder_ctl_get_bitrate(this.#ptr); + if (bitrate < 0) { + throw createOpusError(this.#module, bitrate, "getBitrate"); + } + return bitrate; + } + getLookahead() { + this.#assertLive(); + const lookahead = this.#module._oc_encoder_ctl_get_lookahead(this.#ptr); + if (lookahead < 0) { + throw createOpusError(this.#module, lookahead, "getLookahead"); + } + return lookahead; + } + getInDtx() { + this.#assertLive(); + const inDtx = this.#module._oc_encoder_ctl_get_in_dtx(this.#ptr); + if (inDtx < 0) { + throw createOpusError(this.#module, inDtx, "getInDtx"); + } + return inDtx !== 0; + } + setComplexity(complexity) { + validateIntegerRange(complexity, 0, 10, "complexity"); + this.encoderCtl(EncoderCtl.SetComplexity, complexity); + } + setDtx(enabled) { + this.encoderCtl(EncoderCtl.SetDtx, enabled ? 1 : 0); + } + setFec(enabled) { + this.encoderCtl(EncoderCtl.SetInBandFec, enabled ? 1 : 0); + } + setMaxBandwidth(bandwidth) { + validateBandwidth(bandwidth, "maxBandwidth"); + this.encoderCtl(EncoderCtl.SetMaxBandwidth, bandwidth); + } + setPacketLossPercent(percentage) { + validateIntegerRange(percentage, 0, 100, "packetLossPercent"); + this.encoderCtl(EncoderCtl.SetPacketLossPercent, percentage); + } + setSignal(signal) { + if (!Object.values(Signal).includes(signal)) { + throw new RangeError("signal must be Signal.Auto, Signal.Voice, or Signal.Music"); + } + this.encoderCtl(EncoderCtl.SetSignal, signal); + } + setVbr(enabled) { + this.encoderCtl(EncoderCtl.SetVbr, enabled ? 1 : 0); + } + setVbrConstraint(enabled) { + this.encoderCtl(EncoderCtl.SetVbrConstraint, enabled ? 1 : 0); + } + free() { + if (this.#freed) { + return; + } + this.#freeScratch(); + this.#module._oc_destroy_encoder(this.#ptr); + this.#freed = true; + } + [Symbol.dispose]() { + this.free(); + } + #assertLive() { + if (this.#freed) { + throw new Error("OpusEncoder has been freed"); + } + } + #check(code, operation) { + if (code < 0) { + throw createOpusError(this.#module, code, operation); + } + } + #ensurePacketBytes(requiredBytes) { + if (this.#packetPtr !== 0 && this.#packetBytes >= requiredBytes) { + return this.#packetPtr; + } + const nextPtr = checkedMalloc(this.#module, requiredBytes); + if (this.#packetPtr !== 0) { + this.#module._free(this.#packetPtr); + } + this.#packetPtr = nextPtr; + this.#packetBytes = requiredBytes; + return this.#packetPtr; + } + #ensurePcmBytes(requiredBytes) { + if (this.#pcmPtr !== 0 && this.#pcmBytes >= requiredBytes) { + return this.#pcmPtr; + } + const nextPtr = checkedMalloc(this.#module, requiredBytes); + if (this.#pcmPtr !== 0) { + this.#module._free(this.#pcmPtr); + } + this.#pcmPtr = nextPtr; + this.#pcmBytes = requiredBytes; + return this.#pcmPtr; + } + #freeScratch() { + if (this.#packetPtr !== 0) { + this.#module._free(this.#packetPtr); + } + if (this.#pcmPtr !== 0) { + this.#module._free(this.#pcmPtr); + } + this.#packetPtr = 0; + this.#packetBytes = 0; + this.#pcmPtr = 0; + this.#pcmBytes = 0; + } +} +class WasmOpusDecoder { + channels; + maxFrameSize; + sampleRate; + #freed = false; + #module; + #packetBytes = 0; + #packetPtr = 0; + #pcmBytes = 0; + #pcmPtr = 0; + #ptr; + constructor(module, options) { + this.#module = module; + this.channels = options.channels; + this.maxFrameSize = options.maxFrameSize; + this.sampleRate = options.sampleRate; + const errorPtr = module._malloc(4); + try { + const ptr = module._oc_create_decoder(options.sampleRate, options.channels, errorPtr); + const error = module.HEAP32[errorPtr >> 2] ?? 0; + if (!ptr || error !== 0) { + throw createOpusError(module, error, "createDecoder"); + } + this.#ptr = ptr; + } + finally { + module._free(errorPtr); + } + } + decode(packet, options = {}) { + this.#assertLive(); + const frameSize = this.#resolveDecodeFrameSize(packet, options); + const pcmBytes = frameSize * this.channels * 2; + const pcmPtr = this.#ensurePcmBytes(pcmBytes); + const { packetLength, packetPtr } = this.#copyPacket(packet, options.decodeFec); + const decodedSamples = this.#module._oc_decode(this.#ptr, packetPtr, packetLength, pcmPtr, frameSize, options.decodeFec ? 1 : 0); + if (decodedSamples < 0) { + throw createOpusError(this.#module, decodedSamples, packet === null ? "decodePacketLoss" : "decode"); + } + const sampleCount = decodedSamples * this.channels; + return this.#module.HEAP16.slice(pcmPtr >> 1, (pcmPtr >> 1) + sampleCount); + } + decodeFloat(packet, options = {}) { + this.#assertLive(); + const frameSize = this.#resolveDecodeFrameSize(packet, options); + const pcmBytes = frameSize * this.channels * 4; + const pcmPtr = this.#ensurePcmBytes(pcmBytes); + const { packetLength, packetPtr } = this.#copyPacket(packet, options.decodeFec); + const decodedSamples = this.#module._oc_decode_float(this.#ptr, packetPtr, packetLength, pcmPtr, frameSize, options.decodeFec ? 1 : 0); + if (decodedSamples < 0) { + throw createOpusError(this.#module, decodedSamples, packet === null ? "decodePacketLossFloat" : "decodeFloat"); + } + const sampleCount = decodedSamples * this.channels; + return this.#module.HEAPF32.slice(pcmPtr >> 2, (pcmPtr >> 2) + sampleCount); + } + decodeFrames(packets, options = {}) { + return packets.map((packet) => this.decode(packet, options)); + } + decodeFloatFrames(packets, options = {}) { + return packets.map((packet) => this.decodeFloat(packet, options)); + } + decodePacketLoss(frameSize = samplesForDuration(this.sampleRate, DEFAULT_FRAME_DURATION_MS)) { + return this.decode(null, { frameSize }); + } + decodePacketLossFloat(frameSize = samplesForDuration(this.sampleRate, DEFAULT_FRAME_DURATION_MS)) { + return this.decodeFloat(null, { frameSize }); + } + decoderCtl(request, value) { + this.#assertLive(); + validateInteger(request, "request"); + validateInteger(value, "value"); + if (!DECODER_INTEGER_CTL_REQUESTS.has(request)) { + throw new RangeError("decoderCtl only supports integer setter requests"); + } + const code = this.#module._oc_decoder_ctl(this.#ptr, request, value); + if (code < 0) { + throw createOpusError(this.#module, code, "decoderCtl"); + } + } + free() { + if (this.#freed) { + return; + } + this.#freeScratch(); + this.#module._oc_destroy_decoder(this.#ptr); + this.#freed = true; + } + [Symbol.dispose]() { + this.free(); + } + #assertLive() { + if (this.#freed) { + throw new Error("OpusDecoder has been freed"); + } + } + #copyPacket(packet, decodeFec) { + if (packet === null) { + if (decodeFec) { + throw new RangeError("decodeFec requires a packet"); + } + return { packetLength: 0, packetPtr: 0 }; + } + if (packet.byteLength === 0) { + throw new RangeError("packet must not be empty; use null or decodePacketLoss() for PLC"); + } + const packetPtr = this.#ensurePacketBytes(packet.byteLength); + this.#module.HEAPU8.set(packet, packetPtr); + return { packetLength: packet.byteLength, packetPtr }; + } + #ensurePacketBytes(requiredBytes) { + if (this.#packetPtr !== 0 && this.#packetBytes >= requiredBytes) { + return this.#packetPtr; + } + const nextPtr = checkedMalloc(this.#module, requiredBytes); + if (this.#packetPtr !== 0) { + this.#module._free(this.#packetPtr); + } + this.#packetPtr = nextPtr; + this.#packetBytes = requiredBytes; + return this.#packetPtr; + } + #ensurePcmBytes(requiredBytes) { + if (this.#pcmPtr !== 0 && this.#pcmBytes >= requiredBytes) { + return this.#pcmPtr; + } + const nextPtr = checkedMalloc(this.#module, requiredBytes); + if (this.#pcmPtr !== 0) { + this.#module._free(this.#pcmPtr); + } + this.#pcmPtr = nextPtr; + this.#pcmBytes = requiredBytes; + return this.#pcmPtr; + } + #freeScratch() { + if (this.#packetPtr !== 0) { + this.#module._free(this.#packetPtr); + } + if (this.#pcmPtr !== 0) { + this.#module._free(this.#pcmPtr); + } + this.#packetPtr = 0; + this.#packetBytes = 0; + this.#pcmPtr = 0; + this.#pcmBytes = 0; + } + #resolveDecodeFrameSize(packet, options) { + const frameSize = packet === null || options.decodeFec + ? (options.frameSize ?? options.maxFrameSize ?? samplesForDuration(this.sampleRate, DEFAULT_FRAME_DURATION_MS)) + : (options.maxFrameSize ?? this.maxFrameSize); + if (packet === null || options.decodeFec) { + validatePlcFrameSize(frameSize, this.sampleRate, "frameSize"); + return frameSize; + } + validateDecodeCapacity(frameSize, this.sampleRate, "maxFrameSize"); + return frameSize; + } +} +export class OpusError extends Error { + code; + codeName; + operation; + constructor(code, message, operation) { + super(message); + this.name = "OpusError"; + this.code = code; + this.codeName = resolveOpusErrorCodeName(code); + this.operation = operation; + } +} +export const OpusErrorCode = { + BadArg: -1, + BufferTooSmall: -2, + InternalError: -3, + InvalidPacket: -4, + Unimplemented: -5, + InvalidState: -6, + AllocFail: -7, +}; +export function isOpusError(error) { + if (error instanceof OpusError) { + return true; + } + const candidate = error; + return (Boolean(error) && + typeof error === "object" && + candidate.name === "OpusError" && + typeof candidate.message === "string" && + typeof candidate.code === "number" && + (typeof candidate.codeName === "string" || candidate.codeName === undefined) && + (typeof candidate.operation === "string" || candidate.operation === undefined)); +} +async function getModule() { + modulePromise ??= createLibopusModule(); + return await modulePromise; +} +function resolveOpusErrorCodeName(code) { + for (const [name, value] of Object.entries(OpusErrorCode)) { + if (value === code) { + return name; + } + } + return undefined; +} +function createOpusError(module, code, operation) { + const message = module.UTF8ToString(module._oc_strerror(code)); + return new OpusError(code, `libopus ${operation} failed (${code}): ${message}`, operation); +} +function toUint8Array(input) { + return input instanceof Uint8Array + ? input + : new Uint8Array(input.buffer, input.byteOffset, input.byteLength); +} +function normalizeEncoderOptions(options) { + const sampleRate = options.sampleRate ?? DEFAULT_SAMPLE_RATE; + const channels = options.channels ?? DEFAULT_CHANNELS; + validateCodecOptions({ channels, sampleRate }); + const frameSize = options.frameSize ?? samplesForDuration(sampleRate, DEFAULT_FRAME_DURATION_MS); + validateEncodeFrameSize(frameSize, sampleRate, "frameSize"); + if (options.maxBandwidth !== undefined) { + validateBandwidth(options.maxBandwidth, "maxBandwidth"); + } + const complexity = options.complexity ?? 10; + validateIntegerRange(complexity, 0, 10, "complexity"); + const packetLossPercent = options.packetLossPercent ?? 0; + validateIntegerRange(packetLossPercent, 0, 100, "packetLossPercent"); + const signal = options.signal ?? Signal.Auto; + if (!Object.values(Signal).includes(signal)) { + throw new RangeError("signal must be Signal.Auto, Signal.Voice, or Signal.Music"); + } + return { + application: options.application ?? Application.Audio, + bitrate: normalizeBitrate(options.bitrate ?? 64_000), + channels, + complexity, + dtx: options.dtx ?? false, + fec: options.fec ?? false, + frameSize, + maxBandwidth: options.maxBandwidth, + packetLossPercent, + sampleRate, + signal, + vbr: options.vbr, + vbrConstraint: options.vbrConstraint, + }; +} +function normalizeDecoderOptions(options) { + const sampleRate = options.sampleRate ?? DEFAULT_SAMPLE_RATE; + const channels = options.channels ?? DEFAULT_CHANNELS; + validateCodecOptions({ channels, sampleRate }); + const maxFrameSize = options.maxFrameSize ?? samplesForDuration(sampleRate, MAX_PACKET_DURATION_MS); + validateDecodeCapacity(maxFrameSize, sampleRate, "maxFrameSize"); + return { channels, maxFrameSize, sampleRate }; +} +function samplesForDuration(sampleRate, durationMs) { + return (sampleRate / 1000) * durationMs; +} +function validateCodecOptions(options) { + if (!VALID_SAMPLE_RATES.includes(options.sampleRate)) { + throw new RangeError("sampleRate must be 8000, 12000, 16000, 24000, or 48000"); + } + if (options.channels !== 1 && options.channels !== 2) { + throw new RangeError("channels must be 1 or 2"); + } +} +function normalizeBitrate(bitrate) { + if (bitrate === "auto") { + return Bitrate.Auto; + } + if (bitrate === "max") { + return Bitrate.Max; + } + if (bitrate === Bitrate.Auto || bitrate === Bitrate.Max) { + return bitrate; + } + validatePositiveInteger(bitrate, "bitrate"); + return bitrate; +} +function validateBandwidth(bandwidth, name) { + if (!Object.values(Bandwidth).includes(bandwidth)) { + throw new RangeError(`${name} must be Bandwidth.Narrowband, Bandwidth.Mediumband, Bandwidth.Wideband, Bandwidth.Superwideband, or Bandwidth.Fullband`); + } +} +function validateEncodeFrameSize(frameSize, sampleRate, name) { + validateFrameSizeForDurations(frameSize, sampleRate, name, ENCODE_FRAME_DURATIONS_MS); +} +function validateDecodeCapacity(frameSize, sampleRate, name) { + const maxFrameSize = samplesForDuration(sampleRate, MAX_PACKET_DURATION_MS); + if (!Number.isInteger(frameSize) || frameSize <= 0 || frameSize > maxFrameSize) { + throw new RangeError(`${name} must be an integer from 1 to ${maxFrameSize} samples at ${sampleRate} Hz`); + } +} +function validatePlcFrameSize(frameSize, sampleRate, name) { + const minFrameSize = samplesForDuration(sampleRate, 2.5); + const maxFrameSize = samplesForDuration(sampleRate, MAX_PACKET_DURATION_MS); + if (!Number.isInteger(frameSize) || + frameSize < minFrameSize || + frameSize > maxFrameSize || + frameSize % minFrameSize !== 0) { + throw new RangeError(`${name} must be a multiple of ${minFrameSize} samples from ${minFrameSize} to ${maxFrameSize} at ${sampleRate} Hz`); + } +} +function validateFrameSizeForDurations(frameSize, sampleRate, name, durationsMs) { + const validFrameSizes = durationsMs.map((durationMs) => samplesForDuration(sampleRate, durationMs)); + if (!Number.isInteger(frameSize) || !validFrameSizes.includes(frameSize)) { + throw new RangeError(`${name} must be one of ${validFrameSizes.join(", ")} samples at ${sampleRate} Hz`); + } +} +function validateInteger(value, name) { + if (!Number.isInteger(value)) { + throw new RangeError(`${name} must be an integer`); + } +} +function validatePositiveInteger(value, name) { + if (!Number.isInteger(value) || value <= 0) { + throw new RangeError(`${name} must be a positive integer`); + } +} +function validateIntegerRange(value, min, max, name) { + if (!Number.isInteger(value) || value < min || value > max) { + throw new RangeError(`${name} must be an integer from ${min} to ${max}`); + } +} +function checkedMalloc(module, bytes) { + validateIntegerRange(bytes, 1, MAX_I32, "malloc size"); + const ptr = module._malloc(bytes); + if (ptr === 0) { + throw new Error(`WASM malloc failed for ${bytes} bytes`); + } + return ptr; +} diff --git a/public/voice-frame.mjs b/public/voice-frame.mjs new file mode 100644 index 0000000..45e2937 --- /dev/null +++ b/public/voice-frame.mjs @@ -0,0 +1,19 @@ +// Versioned binary transport; no tokens, passwords or identity material in audio frames. +export const MAX_OPUS_PACKET = 1275; +export function encodeVoice({ direction, clientId = 0, sequence = 0, codec = 4, whisper = false, data }) { + if (!(data instanceof Uint8Array) || data.length > MAX_OPUS_PACKET || ![1, 2].includes(direction) || ![4, 5].includes(codec)) throw new Error('Invalid voice frame'); + const result = new Uint8Array(8 + data.length); + const header = new DataView(result.buffer); + result[0] = 1; result[1] = direction; + header.setUint16(2, clientId); header.setUint16(4, sequence); + result[6] = codec; result[7] = (data.length <= 1 ? 1 : 0) | (whisper ? 2 : 0); + result.set(data, 8); + return result; +} +export function decodeVoice(bytes, direction) { + if (!(bytes instanceof Uint8Array) || bytes.length < 8 || bytes.length > 8 + MAX_OPUS_PACKET) throw new Error('Invalid voice frame size'); + const header = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); + if (bytes[0] !== 1 || bytes[1] !== direction || ![4, 5].includes(bytes[6]) || bytes[7] & ~3 || + Boolean(bytes[7] & 1) !== (bytes.length <= 9) || (direction === 1 && (header.getUint16(2) !== 0 || bytes[7] & 2))) throw new Error('Invalid voice frame header'); + return { clientId: header.getUint16(2), sequence: header.getUint16(4), codec: bytes[6], end: Boolean(bytes[7] & 1), whisper: Boolean(bytes[7] & 2), data: bytes.subarray(8) }; +} diff --git a/public/voice-worker.mjs b/public/voice-worker.mjs new file mode 100644 index 0000000..da7654d --- /dev/null +++ b/public/voice-worker.mjs @@ -0,0 +1,136 @@ +import { createEncoder, createDecoder, getPacketInfo, Application, Signal } from './vendor/opus/index.js'; +import { JitterBuffer } from './jitter-buffer.mjs'; +import { encodeVoice, decodeVoice } from './voice-frame.mjs'; + +const speakers = new Map(); +const volumes = new Map(); +let encoder; +let mode = 'ptt'; +let pressed = false; +let muted = true; +let outputMuted = true; +let canSend = false; +let codec = 4; +let threshold = 0.025; +let hangover = 0; +let transmitting = false; +let sequence = 0; +let generation = 0; +let pendingPackets = 0; +let clock; +let lastTick = 0; +let reportTicks = 0; +let rejected = 0; +let currentSpeaking = ''; +function status(active) { + if (transmitting === active) return; + transmitting = active; + postMessage({ type: 'transmitting', active }); +} +function endTransmission() { + hangover = 0; + if (transmitting) { + const frame = encodeVoice({ direction: 1, sequence: sequence++ & 65535, codec, data: new Uint8Array() }); + postMessage({ type: 'encoded', frame }, [frame.buffer]); + } + status(false); +} +function resetSpeakers() { + generation++; + for (const speaker of speakers.values()) speaker.decoder?.free(); + speakers.clear(); +} +async function receive(frame) { + if (outputMuted) return; + const packet = decodeVoice(new Uint8Array(frame), 2); + if (!packet.end && (await getPacketInfo(packet.data, { sampleRate: 48000 })).samples !== 960) { rejected++; return; } + let speaker = speakers.get(packet.clientId); + if (!speaker) { + if (packet.end || speakers.size >= 32) { rejected++; return; } + speaker = { queue: new JitterBuffer(), volume: volumes.get(packet.clientId) ?? 1, last: performance.now(), decoder: null, ready: null }; + speakers.set(packet.clientId, speaker); + const currentGeneration = generation; + speaker.ready = createDecoder({ sampleRate: 48000, channels: 2, maxFrameSize: 960 }).then(decoder => { + if (generation !== currentGeneration || speakers.get(packet.clientId) !== speaker) { decoder.free(); return; } + speaker.decoder = decoder; + }); + } + await speaker.ready; + if (speakers.get(packet.clientId) !== speaker || !speaker.decoder || outputMuted) return; + speaker.last = performance.now(); + speaker.queue.push(packet); +} +function tick() { + const now = performance.now(); + // A suspended/background worker must never replay its backlog on resume. + if (now - lastTick > 100) resetSpeakers(); + lastTick = now; + if (outputMuted) return; + const mix = new Float32Array(1920); + const speaking = []; + for (const [id, speaker] of speakers) { + if (!speaker.decoder) continue; + const item = speaker.queue.pull(); + let pcm; + try { + if (item.type === 'packet') pcm = speaker.decoder.decodeFloat(item.packet.data, { maxFrameSize: 960 }); + else if (item.type === 'loss') pcm = item.next && !item.next.end ? speaker.decoder.decodeFloat(item.next.data, { decodeFec: true, frameSize: 960, maxFrameSize: 960 }) : speaker.decoder.decodePacketLossFloat(960); + } catch { rejected++; speaker.queue.clear(); } + if (pcm) { + speaking.push(id); + for (let i = 0; i < Math.min(pcm.length, mix.length); i++) mix[i] += pcm[i] * speaker.volume; + } + if (now - speaker.last > 3000) { speaker.decoder.free(); speakers.delete(id); } + } + // Bound summed output when several speakers transmit together. + for (let i = 0; i < mix.length; i++) mix[i] = Math.max(-1, Math.min(1, mix[i])); + postMessage({ type: 'pcm', pcm: mix, at: Date.now() }, [mix.buffer]); + const ids = speaking.sort((a, b) => a - b).join(','); + if (ids !== currentSpeaking) { currentSpeaking = ids; postMessage({ type: 'speaking', ids: speaking }); } + if (++reportTicks % 50 === 0) { + const stats = { lost: 0, late: 0, overflow: 0, received: 0, rejected }; + for (const speaker of speakers.values()) for (const key of ['lost', 'late', 'overflow', 'received']) stats[key] += speaker.queue.stats[key]; + postMessage({ type: 'stats', ...stats, speakers: speakers.size }); + } +} +onmessage = async ({ data: event }) => { + try { + if (event.type === 'init') { + encoder = await createEncoder({ sampleRate: 48000, channels: 1, application: Application.Voip, signal: Signal.Voice, frameSize: 960, bitrate: 32000, complexity: 5, fec: true, packetLossPercent: 10 }); + lastTick = performance.now(); + clock = setInterval(tick, 20); + postMessage({ type: 'ready' }); + } else if (event.type === 'configure') { + endTransmission(); + mode = event.mode; pressed = false; muted = event.muted; outputMuted = event.outputMuted; + canSend = event.canSend; codec = event.codec; threshold = event.threshold; + if (outputMuted) resetSpeakers(); + } else if (event.type === 'ptt') { pressed = Boolean(event.pressed); if (!pressed) endTransmission(); } + else if (event.type === 'volume') { + if (!volumes.has(event.clientId) && volumes.size >= 128) volumes.delete(volumes.keys().next().value); + const volume = Math.max(0, Math.min(2, Number(event.volume) || 0)); + volumes.set(event.clientId, volume); + const speaker = speakers.get(event.clientId); if (speaker) speaker.volume = volume; + } + else if (event.type === 'packet') { + if (++pendingPackets > 64) { pendingPackets--; postMessage({ type: 'packet_ack' }); return; } + try { await receive(event.frame); } catch { rejected++; } + finally { pendingPackets--; postMessage({ type: 'packet_ack' }); } + } else if (event.type === 'capture') { + try { + if (!encoder || muted || outputMuted || !canSend || ![4, 5].includes(codec) || Date.now() - event.at > 100) { endTransmission(); return; } + let energy = 0; + for (const value of event.pcm) energy += value * value; + const level = Math.sqrt(energy / event.pcm.length); + if (level >= threshold) hangover = 10; + const active = mode === 'ptt' ? pressed : hangover-- > 0; + if (!active) { endTransmission(); return; } + const packet = encoder.encodeFloat(event.pcm, { maxPacketBytes: 1275 }); + const frame = encodeVoice({ direction: 1, sequence: sequence++ & 65535, codec, data: packet }); + postMessage({ type: 'encoded', frame }, [frame.buffer]); + status(true); + } finally { postMessage({ type: 'capture_ack' }); } + } else if (event.type === 'reset') { endTransmission(); resetSpeakers(); } + else if (event.type === 'stop') { clearInterval(clock); endTransmission(); resetSpeakers(); encoder?.free(); close(); } + } catch { postMessage({ type: 'error', code: 'audio_processing_failed' }); } +}; diff --git a/public/voice-worklet.mjs b/public/voice-worklet.mjs new file mode 100644 index 0000000..4e639aa --- /dev/null +++ b/public/voice-worklet.mjs @@ -0,0 +1,53 @@ +class VoxCapture extends AudioWorkletProcessor { + constructor() { + super(); this.frame = new Float32Array(960); this.offset = 0; this.pending = 0; this.enabled = false; + this.port.onmessage = ({ data }) => { + if (data.type === 'ack') this.pending = Math.max(0, this.pending - 1); + else if (data.type === 'enabled') { this.enabled = data.value; this.offset = 0; } + }; + } + process(inputs) { + const input = inputs[0]?.[0]; + if (!input || !this.enabled) return true; + for (const value of input) { + this.frame[this.offset++] = value; + if (this.offset === 960) { + if (this.pending < 2) { + const frame = this.frame; + this.port.postMessage({ pcm: frame, at: currentTime }, [frame.buffer]); + this.pending++; + this.frame = new Float32Array(960); + } + this.offset = 0; + } + } + return true; + } +} +class VoxPlayback extends AudioWorkletProcessor { + constructor() { + super(); this.frames = []; this.offset = 0; this.enabled = true; + this.port.onmessage = ({ data }) => { + if (data.type === 'clear') { this.frames = []; this.offset = 0; } + else if (data.pcm instanceof Float32Array && data.pcm.length === 1920) { + // At most 80 ms after the jitter buffer. Drop old samples on overrun. + if (this.frames.length >= 4) { this.frames = []; this.offset = 0; } + this.frames.push(data.pcm); + } + }; + } + process(_inputs, outputs) { + const output = outputs[0]; + if (!output?.[0]) return true; + for (let i = 0; i < output[0].length; i++) { + const frame = this.frames[0]; + if (!frame) break; + output[0][i] = frame[this.offset * 2]; + if (output[1]) output[1][i] = frame[this.offset * 2 + 1]; + if (++this.offset >= 960) { this.frames.shift(); this.offset = 0; } + } + return true; + } +} +registerProcessor('vox-capture', VoxCapture); +registerProcessor('vox-playback', VoxPlayback); diff --git a/public/voice.mjs b/public/voice.mjs new file mode 100644 index 0000000..81ea8cc --- /dev/null +++ b/public/voice.mjs @@ -0,0 +1,134 @@ + +export class VoiceAudio extends EventTarget { + constructor(sendCommand, sendFrame) { + super(); this.sendCommand = sendCommand; this.sendFrame = sendFrame; + this.muted = true; this.outputMuted = true; this.canSend = false; + this.mode = 'ptt'; this.codec = 4; this.threshold = 0.025; this.packetPending = 0; + this.inputDevice = ''; this.stopped = false; + } + event(type, detail) { if (!this.stopped) this.dispatchEvent(new CustomEvent(type, { detail })); } + assertActive() { if (this.stopped) throw new DOMException('The audio connection ended.', 'AbortError'); } + async start() { + this.assertActive(); + if (this.starting) return this.starting; + const operation = this.initialize(); this.starting = operation; + try { await operation; } finally { if (this.starting === operation) this.starting = undefined; } + } + async initialize() { + this.assertActive(); + if (this.context) { await this.context.resume(); return; } + this.context = new AudioContext({ sampleRate: 48000, latencyHint: 'interactive' }); + if (this.context.sampleRate !== 48000 || !this.context.audioWorklet) throw new Error('This browser cannot create the required 48 kHz audio worklet.'); + await this.context.audioWorklet.addModule('/voice-worklet.mjs'); + this.assertActive(); + this.playback = new AudioWorkletNode(this.context, 'vox-playback', { numberOfInputs: 0, numberOfOutputs: 1, outputChannelCount: [2] }); + this.playback.connect(this.context.destination); + this.worker = new Worker('/voice-worker.mjs', { type: 'module' }); + this.worker.onmessage = ({ data }) => { + if (this.stopped) return; + if (data.type === 'ready') this.ready?.(); + else if (data.type === 'encoded') { + const sent = this.sendFrame(data.frame) !== false; + if (!sent) this.ptt(false); + } else if (data.type === 'pcm' && !this.outputMuted && Date.now() - data.at < 100 && this.context?.state === 'running') { + this.playback.port.postMessage({ pcm: data.pcm }, [data.pcm.buffer]); + } else if (data.type === 'packet_ack') this.packetPending = Math.max(0, this.packetPending - 1); + else if (data.type === 'capture_ack') this.capture?.port.postMessage({ type: 'ack' }); + else if (data.type === 'error') { this.mute(); this.event('error', 'Audio processing failed. Microphone stopped; reconnect audio to retry.'); } + else if (['speaking', 'transmitting', 'stats'].includes(data.type)) this.event(data.type, data); + }; + this.worker.onerror = () => { this.mute(); this.event('error', 'The audio worker failed. Reconnect to restart it.'); }; + await new Promise((resolve, reject) => { + const timer = setTimeout(() => reject(new Error('Audio codec initialization timed out.')), 10000); + this.ready = () => { clearTimeout(timer); resolve(); }; + this.cancelInitialization = () => { clearTimeout(timer); reject(new DOMException('The audio connection ended.', 'AbortError')); }; + this.worker.postMessage({ type: 'init' }); + }); + this.cancelInitialization = undefined; + this.assertActive(); + for (const [clientId, volume] of this.gains || []) this.worker.postMessage({ type: 'volume', clientId, volume }); + this.context.onstatechange = () => { + if (this.context?.state !== 'running') { this.ptt(false); this.mute(); this.clearPlayback(); this.event('error', 'Audio paused by the browser. Resume listening, then enable the microphone again.'); } + }; + await this.context.resume(); + this.assertActive(); + } + configure() { + if (this.stopped) return; + this.worker?.postMessage({ type: 'configure', mode: this.mode, muted: this.muted, outputMuted: this.outputMuted, canSend: this.canSend, codec: this.codec, threshold: this.threshold }); + this.capture?.port.postMessage({ type: 'enabled', value: !this.muted && this.canSend && !this.outputMuted }); + } + sync() { if (this.stopped) return; this.sendCommand({ type: 'audio_state', inputMuted: this.muted, outputMuted: this.outputMuted }); this.configure(); } + async listen(enabled) { + if (enabled && ![4, 5].includes(this.codec)) throw new Error('This channel uses an unsupported codec. Join an Opus Voice or Opus Music channel.'); + if (enabled) await this.start(); + this.assertActive(); + this.outputMuted = !enabled; + if (!enabled) this.mute(); + this.clearPlayback(); this.sync(); + } + permissions(event) { this.canSend = event.canSend; this.configure(); } + channel(codec) { + if (this.codec === codec) return; + this.codec = codec; + this.mute(); this.worker?.postMessage({ type: 'reset' }); this.clearPlayback(); + if (![4, 5].includes(codec)) this.event('error', 'This channel uses a codec that is not supported yet. Join an Opus Voice or Opus Music channel.'); + } + async microphone(deviceId = this.inputDevice) { + this.assertActive(); + if (this.outputMuted) throw new Error('Enable listening before enabling your microphone.'); + if (![4, 5].includes(this.codec)) throw new Error('Microphone requires an Opus channel.'); + this.mute(); + const captureGeneration = this.captureGeneration; + this.stream?.getTracks().forEach(track => track.stop()); + this.source?.disconnect(); this.capture?.disconnect(); + this.inputDevice = deviceId; + const stream = await navigator.mediaDevices.getUserMedia({ audio: { + ...(deviceId ? { deviceId: { exact: deviceId } } : {}), + channelCount: 1, sampleRate: 48000, echoCancellation: true, noiseSuppression: true, autoGainControl: true, + }, video: false }); + if (this.stopped || this.outputMuted || captureGeneration !== this.captureGeneration) { stream.getTracks().forEach(track => track.stop()); return; } + this.stream = stream; + this.source = this.context.createMediaStreamSource(stream); + this.capture = new AudioWorkletNode(this.context, 'vox-capture', { numberOfInputs: 1, numberOfOutputs: 1, outputChannelCount: [1] }); + this.capture.port.onmessage = ({ data }) => { + if (this.muted || !this.canSend || !this.context || typeof data.at !== 'number' || (this.context.currentTime - data.at) * 1000 > 100) { this.capture?.port.postMessage({ type: 'ack' }); return; } + this.worker.postMessage({ type: 'capture', pcm: data.pcm, at: Date.now() }, [data.pcm.buffer]); + }; + // The worklet emits silence. Its output keeps capture scheduled without local sidetone. + this.source.connect(this.capture); this.capture.connect(this.context.destination); + for (const track of stream.getAudioTracks()) { + track.onended = () => { this.mute(); this.event('error', 'Microphone disconnected. Select a device and enable it again.'); }; + track.onmute = () => { this.ptt(false); this.mute(); this.event('error', 'Microphone input became unavailable.'); }; + } + this.muted = false; this.sync(); + } + mute() { + this.captureGeneration = (this.captureGeneration || 0) + 1; + this.muted = true; + this.stream?.getAudioTracks().forEach(track => { track.enabled = false; }); + this.ptt(false); this.sync(); + } + ptt(pressed) { this.worker?.postMessage({ type: 'ptt', pressed: !this.muted && this.canSend && pressed }); } + volume(clientId, volume) { + this.gains ||= new Map(); + if (!this.gains.has(clientId) && this.gains.size >= 128) this.gains.delete(this.gains.keys().next().value); + volume = Math.max(0, Math.min(2, Number(volume) || 0)); this.gains.set(clientId, volume); + this.worker?.postMessage({ type: 'volume', clientId, volume }); + } + clearPlayback() { this.playback?.port.postMessage({ type: 'clear' }); } + receive(frame) { + if (!this.worker || this.outputMuted || this.packetPending >= 64) return; + this.packetPending++; + this.worker.postMessage({ type: 'packet', frame }, [frame]); + } + stop() { + if (!this.stopped && (!this.muted || !this.outputMuted)) { this.muted = true; this.outputMuted = true; this.sync(); } + this.stopped = true; this.mute(); + this.cancelInitialization?.(); this.cancelInitialization = undefined; + this.stream?.getTracks().forEach(track => { track.onended = null; track.onmute = null; track.stop(); }); + this.source?.disconnect(); this.capture?.disconnect(); this.playback?.disconnect(); + this.worker?.terminate(); this.worker = null; + if (this.context) { this.context.onstatechange = null; void this.context.close(); this.context = null; } + } +} diff --git a/public/workspace-model.mjs b/public/workspace-model.mjs new file mode 100644 index 0000000..bc4b060 --- /dev/null +++ b/public/workspace-model.mjs @@ -0,0 +1,16 @@ +export const pages = new Set(['connections', 'connection', 'identity', 'console', 'channels', 'conversation', 'audio', 'profile', 'diagnostics']); +export function resolvePage(hash) { const page = hash.replace(/^#/, ''); return pages.has(page) ? page : 'connections'; } +export function sameDestination(a, b) { return Boolean(a && b && a.host === b.host && a.port === b.port); } +export function recentChannels(channels, currentId, recentIds) { + return [...new Set([currentId, ...recentIds])].map(id => channels.find(channel => channel.id === id)).filter(Boolean).slice(0, 4); +} +export function channelPath(channel, channels) { + const byId = new Map(channels.map(item => [item.id, item])); const seen = new Set([channel.id]); const names = []; + let parent = byId.get(channel.parentId); + while (parent && !seen.has(parent.id)) { seen.add(parent.id); names.unshift(parent.name); parent = byId.get(parent.parentId); } + return names.join(' / '); +} +export function matchesChannel(channel, channels, participants, query) { + const needle = query.trim().toLocaleLowerCase(); + return !needle || [channel.name, channelPath(channel, channels), ...participants.filter(person => person.channelId === channel.id).map(person => person.name)].some(text => text.toLocaleLowerCase().includes(needle)); +} diff --git a/public/workspace.mjs b/public/workspace.mjs new file mode 100644 index 0000000..283250a --- /dev/null +++ b/public/workspace.mjs @@ -0,0 +1,416 @@ +import { clientCommand, joinChannel, getParticipantVolume, setParticipantVolume } from './protocol.mjs'; +import { orderChannels } from './channel-order.mjs'; +import { resolvePage, recentChannels, channelPath, matchesChannel, sameDestination } from './workspace-model.mjs'; +const $ = id => document.getElementById(id); +let selected, state, previousOwnChannel, privatePeer, privatePeerUid, workspaceCsrf, preferences, selectedBookmark; +let connected = false, connectionActive = false, sequence = 0, sending = false, workspaceEpoch = 0, preferenceBusy = false; +let activeSpeakers = new Set(); const messages = []; const drafts = new Map(); let draftKey; const threads = new Map(); const unread = new Map(); let recent = []; +let page = 'connections', editorDirty = false, routeGeneration = 0, signedIn = false; +let theme = 'system'; const themes = ['system', 'light', 'dark']; +const pageCopy = { connections: 'CONNECTIONS / SAVED DESTINATIONS', connection: 'CONNECTIONS / EDIT DESTINATION', identity: 'ACCOUNT / TEAMSPEAK IDENTITY', console: 'VOICE CONSOLE', channels: 'WORKSPACE / FIND A CHANNEL', conversation: 'CONVERSATION / PRIVATE', audio: 'AUDIO / PREFERENCES', profile: 'ACCOUNT / PRESENCE', diagnostics: 'CONNECTION / DIAGNOSTICS' }; +async function workspaceApi(path, body) { + const response = await fetch(path, { signal: AbortSignal.timeout(15000), method: body === undefined ? 'GET' : 'POST', ...(body === undefined ? {} : { headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': workspaceCsrf }, body: JSON.stringify(body) }) }); + if (response.status === 401) window.dispatchEvent(new Event('voxharbor-owner-expired')); + const result = await response.json(); if (!response.ok) throw new Error(result.error || 'Workspace storage is unavailable.'); return result; +} +let confirmResolve; +function confirmAction(title, description, accept = 'Continue') { + if (confirmResolve) return Promise.resolve(false); + $('confirm-title').textContent = title; $('confirm-description').textContent = description; $('confirm-accept').textContent = accept; + $('confirm-dialog').showModal(); return new Promise(resolve => { confirmResolve = resolve; }); +} +function finishConfirm(value) { const resolve = confirmResolve; confirmResolve = undefined; $('confirm-dialog').close(); resolve?.(value); } +$('confirm-form').addEventListener('submit', event => { event.preventDefault(); finishConfirm(true); }); +$('confirm-cancel').addEventListener('click', () => finishConfirm(false)); +$('confirm-dialog').addEventListener('cancel', event => { event.preventDefault(); finishConfirm(false); }); +async function navigate(next, { replace = false, fromHistory = false, force = false } = {}) { + next = resolvePage('#' + next); const generation = ++routeGeneration; + if (!signedIn) return; + if (!force && page === 'connection' && next !== page && editorDirty && !await confirmAction('Discard unsaved changes?', 'Your saved connection has not changed. Leave this editor and discard the changes?', 'Discard changes')) { + if (fromHistory) history.replaceState(null, '', '#' + page); return; + } + if (generation !== routeGeneration) return; + if (page === 'connection' && next !== page) { clearEditorSecrets(); editorDirty = false; } + page = next; + if (page === 'conversation' && privatePeer && connected && $('chat-scope').querySelector('option[value=private]')) $('chat-scope').value = 'private'; + if (page === 'console' && scope() === 'private') { $('chat-scope').value = 'channel'; renderMessages(); } + for (const section of document.querySelectorAll('section[data-page]:not(#lab)')) section.hidden = section.dataset.page !== page; + $('lab').dataset.page = page; $('page-breadcrumb').textContent = pageCopy[page]; + for (const button of document.querySelectorAll('.top-actions [data-route]')) { if (button.dataset.route === page) button.setAttribute('aria-current', 'page'); else button.removeAttribute('aria-current'); } + (page === 'conversation' ? $('direct-chat-slot') : $('console-chat-slot')).append($('chat-panel')); + $('session-ribbon').hidden = !connectionActive || page === 'console'; + if (!fromHistory && location.hash !== '#' + page) history[replace ? 'replaceState' : 'pushState'](null, '', '#' + page); + document.title = `VoxHarbor · ${pageCopy[page].split(' / ').at(-1).toLowerCase()}`; + document.querySelector('.skip-link').href = page === 'console' ? '#workspace-content' : `#page-${page}`; + const section = document.querySelector(`section[data-page="${page}"]:not(#lab)`); section.id ||= `page-${page}`; + window.scrollTo(0, 0); section.querySelector('h1')?.focus({ preventScroll: true }); + if (page === 'channels') renderBrowser(); if (page === 'conversation') renderMessages(); +} +window.addEventListener('hashchange', () => void navigate(resolvePage(location.hash), { fromHistory: true })); +for (const button of document.querySelectorAll('[data-route]')) button.addEventListener('click', event => { event.preventDefault(); void navigate(button.dataset.route); }); +function clearEditorSecrets() { $('ts3-password').value = ''; $('ts3-channel-password').value = ''; $('bookmark-clear-passwords').checked = false; $('connection-clear-passwords').checked = false; } +function applyConnection(connection) { + delete $('settings-dialog').dataset.bookmarkId; clearEditorSecrets(); + $('ts3-host').value = connection?.host || ''; $('ts3-port').value = String(connection?.port || 9987); $('ts3-nickname').value = connection?.nickname || preferences?.nickname || ''; + $('ts3-channel').value = connection?.channelId ? String(connection.channelId) : ''; + $('ts3-password').placeholder = connection?.hasPassword ? 'Saved on backend; leave blank to keep' : 'Optional'; + $('ts3-channel-password').placeholder = connection?.hasChannelPassword ? 'Saved on backend; leave blank to keep' : 'Optional'; +} +async function editConnection(connection) { + if (page === 'connection' && editorDirty && !await confirmAction('Discard unsaved changes?', 'Open another destination and discard the current edits?', 'Discard changes')) return; + selectedBookmark = connection?.id && preferences?.bookmarks.some(item => item.id === connection.id) ? connection.id : undefined; + applyConnection(connection); if (selectedBookmark) $('settings-dialog').dataset.bookmarkId = selectedBookmark; + $('bookmark-name').value = connection?.name || ''; $('bookmark-delete').hidden = !selectedBookmark; + $('bookmark-passwords').checked = true; $('editor-status').textContent = ''; editorDirty = false; + await navigate('connection'); +} +async function startConnection(connection, passwords = {}) { + if ($('ts3-connect').disabled) { $('notice').textContent = 'Set up your identity before connecting, or wait for the current connection to finish.'; if (!connectionActive) await navigate('identity'); return; } + if (connectionActive) return; + applyConnection(connection); if (typeof passwords.password === 'string') $('ts3-password').value = passwords.password; if (typeof passwords.channelPassword === 'string') $('ts3-channel-password').value = passwords.channelPassword; $('server-name').textContent = connection.name || connection.host; + if (preferences.bookmarks.some(item => item.id === connection.id)) $('settings-dialog').dataset.bookmarkId = connection.id; + $('ts3-connect').click(); await navigate('console', { force: true }); +} +function renderBookmarks() { + if (!preferences) return; + const fragment = document.createDocumentFragment(); + for (const bookmark of preferences?.bookmarks || []) { + const active = connectionActive && sameDestination(bookmark, preferences.connection); + const row = node('article', undefined, 'destination-row'); + const info = node('div'); info.append(node('h2', bookmark.name), node('p', `${bookmark.host}:${bookmark.port}${bookmark.channelId ? ` · Channel ${bookmark.channelId}` : ''}`, 'hint')); + row.append(info, node('span', bookmark.nickname, 'destination-nickname'), node('span', active ? $('connection-badge').textContent : 'Disconnected', `destination-state${active ? ' is-active' : ''}`)); + const actions = node('div', undefined, 'row'); + const connect = node('button', active ? connected ? 'Open console' : 'View connection' : 'Connect', 'secondary'); connect.disabled = !active && (connectionActive || !$('ts3-connect') || $('ts3-connect').disabled); + connect.setAttribute('aria-label', `${active ? 'Open console for' : 'Connect to'} ${bookmark.name}`); + connect.addEventListener('click', () => active ? navigate('console') : startConnection(bookmark)); + const edit = node('button', 'Edit', 'quiet'); edit.setAttribute('aria-label', `Edit ${bookmark.name}`); edit.addEventListener('click', () => void editConnection(bookmark)); actions.append(connect, edit); + if (active) { const disconnect = node('button', 'Disconnect', 'quiet'); disconnect.addEventListener('click', () => $('ts3-disconnect').click()); actions.append(disconnect); } + row.append(actions); fragment.append(row); + } + if (!fragment.childNodes.length) { const empty = node('div', undefined, 'destinations-empty'); empty.append(node('h2', 'Your next destination starts here.'), node('p', 'Save a server, nickname and optional channel. Come back to it whenever you sign in.', 'hint')); const add = node('button', 'Add your first connection'); add.addEventListener('click', () => void editConnection()); empty.append(add); fragment.append(empty); } + $('bookmarks').replaceChildren(fragment); + const last = preferences?.connection; + $('recent-connection').hidden = !last || preferences.bookmarks.some(item => sameDestination(item, last)); + if (last) { const description = node('div'); description.append(node('p', 'LAST USED CONNECTION', 'eyebrow'), node('h2', `${last.host}:${last.port}`), node('p', last.nickname, 'hint')); const reconnect = node('button', connectionActive ? 'Open console' : 'Reconnect', 'secondary'); reconnect.disabled = !connectionActive && $('ts3-connect').disabled; reconnect.addEventListener('click', () => connectionActive ? navigate('console') : startConnection(last)); $('recent-connection').replaceChildren(description, reconnect); } + $('workspace-loading').hidden = Boolean(preferences); + if (connectionActive) $('preferences-status').textContent = 'One connection is active. Open its console or disconnect before connecting to another server.'; +} +function applyTheme() { document.documentElement.dataset.theme = theme === 'system' ? 'dark' : theme; $('theme-toggle').textContent = `Theme: ${theme}`; } +export async function loadWorkspace(token) { + const epoch = ++workspaceEpoch; workspaceCsrf = token; preferences = undefined; signedIn = true; editorDirty = false; + await navigate(resolvePage(location.hash), { replace: true, force: true }); + try { + const value = await workspaceApi('/api/preferences'); if (epoch !== workspaceEpoch) return; + preferences = value; theme = value.theme; applyTheme(); applyConnection(page === 'connection' ? undefined : value.connection); $('profile-nickname').value = value.nickname; + $('bookmark-save').disabled = false; $('preferences-status').textContent = 'Your saved destinations are ready.'; renderBookmarks(); + } catch (error) { if (epoch === workspaceEpoch) { $('workspace-loading').textContent = 'Destinations could not be loaded. Reload to try again.'; $('preferences-status').textContent = error.message; } } +} +export function resetWorkspace() { + ++workspaceEpoch; signedIn = false; preferences = undefined; workspaceCsrf = undefined; selectedBookmark = undefined; preferenceBusy = false; editorDirty = false; + clearEditorSecrets(); $('connection-form').reset(); $('profile-nickname').value = ''; $('bookmarks').replaceChildren(); $('workspace-loading').hidden = false; $('workspace-loading').textContent = 'Loading your destinations…'; $('recent-connection').hidden = true; + $('editor-status').textContent = ''; $('preferences-status').textContent = ''; delete $('settings-dialog').dataset.bookmarkId; + if (confirmResolve) finishConfirm(false); history.replaceState(null, '', '#connections'); +} +async function savePreferences(value) { + if (!preferences || preferenceBusy) throw new Error('Wait for your destinations to finish loading or saving.'); + const epoch = workspaceEpoch; preferenceBusy = true; $('bookmark-save').disabled = true; + try { const result = await workspaceApi('/api/preferences', value); if (epoch !== workspaceEpoch) return; preferences = result; renderBookmarks(); return result; } + finally { if (epoch === workspaceEpoch) { preferenceBusy = false; $('bookmark-save').disabled = false; } } +} +window.addEventListener('voxharbor-connection-saved', ({ detail }) => { if (!workspaceCsrf) return; preferences = detail; renderBookmarks(); }); +window.addEventListener('voxharbor-capabilities', renderBookmarks); +function node(tag, text, className) { const element = document.createElement(tag); if (text !== undefined) element.textContent = text; if (className) element.className = className; return element; } +function scope() { return $('chat-scope').value; } +function own() { return state?.participants.find(client => client.id === state.ownClientId); } +function scopeKey(message) { return message.target === 'private' || message.target === 'poke' ? `private:${message.peerUid || (message.peerId ?? message.clientId)}` : message.target === 'channel' ? `channel:${message.channelId}` : 'server'; } +function activeKey() { return scope() === 'private' ? `private:${privatePeerUid || privatePeer}` : scope() === 'channel' ? `channel:${own()?.channelId}` : 'server'; } +function renderMessages() { + const nextDraftKey = activeKey(); + if (draftKey !== nextDraftKey) { + if (draftKey) { if ($('message-input').value) drafts.set(draftKey, $('message-input').value); else drafts.delete(draftKey); } + if (drafts.size > 40) drafts.delete(drafts.keys().next().value); + $('message-input').value = drafts.get(nextDraftKey) || ''; draftKey = nextDraftKey; + } + const list = $('messages'); const oldScroll = list.scrollTop; const pinned = list.scrollHeight - list.scrollTop - list.clientHeight < 60; + const fragment = document.createDocumentFragment(); + for (const message of (page === 'conversation' && scope() !== 'private' ? [] : messages.filter(message => scopeKey(message) === activeKey()))) { + const row = node('li', undefined, `message${message.outgoing ? ' own-message' : ''}`); + row.dataset.message = String(message.id); + const heading = node('div', undefined, 'message-heading'); + heading.append(node('strong', message.name), node('time', new Date(message.at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }))); + row.append(heading, node('p', message.message)); fragment.append(row); + } + list.replaceChildren(fragment); + $('chat-empty').hidden = list.children.length > 0; + $('chat-empty').replaceChildren(document.createTextNode(page === 'conversation' && scope() !== 'private' ? 'Choose a participant.' : 'No messages yet.'), node('span', page === 'conversation' && scope() !== 'private' ? 'Your private conversations appear here.' : 'Your conversation starts here.')); + list.scrollTop = pinned ? list.scrollHeight : oldScroll; + const channel = state?.channels.find(channel => channel.id === own()?.channelId); + const peer = state?.participants.find(client => client.id === privatePeer && (!privatePeerUid || client.uid === privatePeerUid)); + $('chat-context').textContent = scope() === 'private' ? `Private conversation with ${peer?.name || 'a disconnected participant'}` : scope() === 'server' ? 'Visible to the server. Messages are not saved.' : channel ? `Current channel · ${channel.name}` : 'Messages stay in this browser session.'; + $('message-input').disabled = !connected || (scope() === 'private' && !peer); + $('message-send').disabled = $('message-input').disabled || sending; + for (const button of document.querySelectorAll('[data-chat-scope]')) button.setAttribute('aria-pressed', String(button.dataset.chatScope === scope())); + $('private-chat').setAttribute('aria-pressed', String(scope() === 'private')); + $('private-chat').textContent = scope() === 'private' && peer ? `Private · ${peer.name}` : 'Private'; + $('message-input').placeholder = scope() === 'private' ? `Message ${peer?.name || 'participant'}…` : scope() === 'server' ? 'Message the server…' : channel ? `Message ${channel.name}…` : 'Message this room…'; + renderThreads(); + $('poke-open').hidden = scope() !== 'private'; $('poke-open').disabled = !connected || !peer; +} +function appendMessage(message) { + const duplicate = messages.some(previous => previous.outgoing !== message.outgoing && previous.clientId === message.clientId && scopeKey(previous) === scopeKey(message) && previous.message === message.message && Math.abs(previous.at - message.at) < 5000); + if (duplicate) return; + messages.push({ ...message, id: ++sequence }); if (messages.length > 200) messages.shift(); renderMessages(); +} +function openPrivate(client) { + unread.delete(client.uid || String(client.id)); + privatePeer = client.id; + privatePeerUid = client.uid || undefined; + let option = $('chat-scope').querySelector('option[value="private"]'); + if (!option) { option = new Option('', 'private'); $('chat-scope').add(option); } + option.textContent = `Private · ${client.name}`; $('chat-scope').value = 'private'; + threads.set(client.uid || String(client.id), { ...client }); renderMessages(); void navigate('conversation').then(() => $('message-input').focus()); +} + +function emptyRoom() { + const empty = node('div', undefined, 'room-empty'); + empty.append(node('p', 'NO ROOM SELECTED', 'eyebrow'), node('h2', 'A little quieter here.'), node('p', 'Connect to your server to see rooms and people.', 'hint')); + const button = node('button', 'Set up a connection ↗', 'secondary'); button.addEventListener('click', () => navigate('connections')); empty.append(button); + $('member-list').replaceChildren(empty); +} +function renderChannel() { + renderRooms(); + if (!state) return; + const channel = state.channels.find(channel => channel.id === own()?.channelId); + if (!channel) return; + const current = channel.id === own()?.channelId; + const peers = state.participants.filter(client => client.channelId === channel.id && client.id !== state.ownClientId); + $('selected-channel-name').textContent = channel.name; + $('selected-channel-topic').textContent = channel.topic || (current ? 'A place to catch up. Keep it kind.' : 'Select Join channel to move here.'); + $('channel-context').textContent = `${current ? 'Your room' : 'Channel preview'} / ${peers.length} ${peers.length === 1 ? 'other' : 'others'} / ${channel.codec === 4 || channel.codec === 5 ? 'Opus voice' : 'Unsupported audio codec'}`; + $('join-selected').hidden = current; $('join-selected').disabled = !connected; + $('subscription-toggle').hidden = false; $('subscription-toggle').disabled = !connected; + $('subscription-toggle').textContent = channel.subscribed ? 'Subscribed / Unsubscribe' : 'Subscribe'; + const fragment = document.createDocumentFragment(); + for (const [index, client] of peers.entries()) { + const card = node('div', undefined, 'member'); card.dataset.member = String(client.id); + card.classList.toggle('speaking', activeSpeakers.has(client.id)); + const top = node('div', undefined, 'member-top'); top.append(node('span', String(index + 1).padStart(2, '0'))); card.append(top); + const baseStatus = client.awayMessage !== null && client.awayMessage !== undefined ? `Away${client.awayMessage ? ` · ${client.awayMessage}` : ''}` : client.outputMuted ? 'Output muted' : client.inputMuted ? 'Microphone muted' : 'Listening'; + const status = node('span', activeSpeakers.has(client.id) ? 'Speaking' : baseStatus, 'hint'); status.dataset.baseStatus = baseStatus; + const info = node('div', undefined, 'member-info'); info.append(node('strong', client.name), status); card.append(info); + const mix = node('div', undefined, 'member-mix'); const value = Math.round(getParticipantVolume(client.id) * 100); + const readout = node('div'); const output = node('output', String(value), 'volume-value'); output.dataset.volumeReadout = String(client.id); output.append(node('small', 'PLAYBACK %')); + readout.append(output, node('p', 'Volume', 'volume-label')); + const fader = node('div', undefined, 'fader'); const volume = node('input'); volume.type = 'range'; volume.min = '0'; volume.max = '200'; volume.value = String(value); volume.disabled = !connected; + volume.dataset.volumeClient = String(client.id); volume.setAttribute('aria-label', `Playback volume for ${client.name}`); volume.setAttribute('aria-valuetext', `${value} percent`); + volume.addEventListener('input', () => setParticipantVolume(client.id, Number(volume.value) / 100)); + const scale = node('div', undefined, 'fader-scale'); scale.setAttribute('aria-hidden', 'true'); scale.append(node('span', '200'), node('span', '100'), node('span', '0')); + fader.append(volume, scale); mix.append(readout, fader); card.append(mix); + const actions = node('div', undefined, 'member-actions'); + const message = node('button', 'Message', 'quiet'); message.disabled = !connected; message.addEventListener('click', () => openPrivate(client)); + const poke = node('button', 'Poke', 'quiet'); poke.disabled = !connected; poke.addEventListener('click', () => { openPrivate(client); $('poke-open').click(); }); + actions.append(message, poke); card.append(actions); fragment.append(card); + } + if (!fragment.childNodes.length) { + const empty = node('div', undefined, 'room-empty'); empty.append(node('p', current ? 'YOU’RE HERE' : 'ROOM PREVIEW', 'eyebrow'), node('h2', 'Room for conversation.'), node('p', 'No other visible participants in this channel.', 'hint')); fragment.append(empty); + } + const focused = document.activeElement?.dataset.volumeClient; const scroll = $('member-list').scrollTop; + $('member-list').replaceChildren(fragment); $('member-list').scrollTop = scroll; + if (focused) $('member-list').querySelector(`[data-volume-client="${focused}"]`)?.focus({ preventScroll: true }); + $('mixer-count').textContent = `${peers.length} ${peers.length === 1 ? 'participant' : 'participants'} · Playback volume 0–200%`; +} +window.addEventListener('voxharbor-volume', ({ detail }) => { + for (const input of document.querySelectorAll('[data-volume-client]')) if (Number(input.dataset.volumeClient) === detail.id) { input.value = String(Math.round(detail.volume * 100)); input.setAttribute('aria-valuetext', `${input.value} percent`); } + for (const output of document.querySelectorAll('[data-volume-readout]')) if (Number(output.dataset.volumeReadout) === detail.id) { output.replaceChildren(document.createTextNode(String(Math.round(detail.volume * 100))), node('small', 'PLAYBACK %')); } +}); + +$('subscription-toggle').addEventListener('click', async () => { + const channel = state?.channels.find(channel => channel.id === own()?.channelId); if (!channel) return; + $('subscription-toggle').disabled = true; + try { await clientCommand({ type: 'subscribe', channelId: channel.id, subscribed: !channel.subscribed }); } + catch (error) { $('notice').textContent = error.message; } + finally { renderChannel(); } +}); +$('nickname-update').addEventListener('click', async () => { + $('nickname-update').disabled = true; + try { await clientCommand({ type: 'nickname', name: $('profile-nickname').value.trim() }); $('ts3-nickname').value = $('profile-nickname').value.trim(); $('profile-status').textContent = 'Nickname updated.'; } + catch (error) { $('profile-status').textContent = error.message; } + finally { $('nickname-update').disabled = !connected; } +}); +$('away-toggle').addEventListener('click', async () => { + $('away-toggle').disabled = true; + try { + if (new TextEncoder().encode($('away-message').value).length > 500) throw new Error('Keep the away message within 500 UTF-8 bytes.'); + await clientCommand({ type: 'away', away: own()?.awayMessage === null || own()?.awayMessage === undefined, message: $('away-message').value }); $('profile-status').textContent = 'Status updated.'; + } + catch (error) { $('profile-status').textContent = error.message; } + finally { $('away-toggle').disabled = !connected; } +}); +$('poke-open').addEventListener('click', () => { const peer = state?.participants.find(client => client.id === privatePeer && (!privatePeerUid || client.uid === privatePeerUid)); if (!peer) return; $('poke-recipient').textContent = peer.name; $('poke-message').value = ''; $('poke-status').textContent = ''; $('poke-dialog').showModal(); }); +$('poke-form').addEventListener('submit', async event => { + event.preventDefault(); const id = privatePeer; const uid = privatePeerUid; + if (!connected || !state?.participants.some(client => client.id === id && (!uid || client.uid === uid))) { $('poke-status').textContent = 'This participant is no longer connected.'; return; } + if (new TextEncoder().encode($('poke-message').value).length > 500) { $('poke-status').textContent = 'Keep the poke within 500 UTF-8 bytes.'; return; } + let message = $('poke-message').value; $('poke-message').value = ''; $('poke-submit').disabled = true; + try { await clientCommand({ type: 'poke', clientId: id, ...(uid ? { clientUid: uid } : {}), message }); $('poke-dialog').close(); $('message-status').textContent = 'Poke sent.'; } + catch (error) { $('poke-status').textContent = error.message; } + finally { message = ''; $('poke-submit').disabled = false; } +}); +$('poke-dialog').addEventListener('close', () => { $('poke-message').value = ''; }); +for (const button of document.querySelectorAll('[data-chat-scope]')) button.addEventListener('click', () => { $('chat-scope').value = button.dataset.chatScope; $('chat-scope').dispatchEvent(new Event('change')); }); +$('chat-scope').addEventListener('change', () => { $('message-status').textContent = ''; renderMessages(); }); +$('message-form').addEventListener('submit', async event => { + event.preventDefault(); if (sending) return; const message = $('message-input').value.trim(); if (!message) return; + if (new TextEncoder().encode(message).length > 1000) { $('message-status').textContent = 'Message is too long. Keep it within 1,000 UTF-8 bytes.'; return; } + const epoch = workspaceEpoch; const requestDraftKey = activeKey(); const target = scope(); const peerId = privatePeer; const peerUid = privatePeerUid; const channelId = own()?.channelId; const sender = own(); + sending = true; $('message-send').disabled = true; $('message-status').textContent = 'Sending…'; + try { + await clientCommand({ type: 'text_message', target, ...(target === 'channel' ? { channelId } : {}), ...(target === 'private' ? { clientId: peerId, ...(peerUid ? { clientUid: peerUid } : {}) } : {}), message }); + if (epoch !== workspaceEpoch) return; + appendMessage({ target, peerId, peerUid, channelId, clientId: sender.id, name: sender.name, message, outgoing: true, at: Date.now() }); + drafts.delete(requestDraftKey); if (activeKey() === requestDraftKey && $('message-input').value.trim() === message) $('message-input').value = ''; $('message-status').textContent = 'Sent.'; + } catch (error) { if (epoch === workspaceEpoch) $('message-status').textContent = error.message; } + finally { if (epoch === workspaceEpoch) { sending = false; renderMessages(); } } +}); + +function renderRooms() { + const fragment = document.createDocumentFragment(); + for (const channel of recentChannels(state?.channels || [], own()?.channelId, recent)) { + const row = node('li'); const button = node('button', channel.name); + button.setAttribute('aria-current', String(channel.id === own()?.channelId)); button.setAttribute('aria-label', `Preview channel ${channel.name}`); + button.append(node('span', String(state.participants.filter(client => client.channelId === channel.id).length).padStart(2, '0'), 'room-number')); + button.addEventListener('click', () => { selected = channel.id; void navigate('channels'); }); row.append(button); fragment.append(row); + } + if (!fragment.childNodes.length) fragment.append(node('li', 'Connect to find your rooms.', 'hint')); + $('room-tabs').replaceChildren(fragment); +} +function renderBrowser() { + const fragment = document.createDocumentFragment(); const query = $('channel-search').value; let count = 0; + for (const { channel, depth } of orderChannels(state?.channels || [])) { + if (!matchesChannel(channel, state.channels, state.participants, query)) continue; + count++; const row = node('li'); row.dataset.channel = String(channel.id); row.dataset.depth = String(Math.min(depth, 4)); + const button = node('button', undefined, 'channel-result'); button.setAttribute('aria-label', `Preview ${channel.name}`); button.setAttribute('aria-pressed', String(selected === channel.id)); + const text = node('div'); text.append(node('strong', channel.name), node('span', channelPath(channel, state.channels) || 'Top-level channel', 'hint')); + const people = state.participants.filter(person => person.channelId === channel.id); + const matching = query.trim() ? people.filter(person => person.name.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())).map(person => person.name).join(', ') : ''; + if (matching) text.append(node('span', `People: ${matching}`, 'hint')); + button.append(text, node('span', `${people.length} ${people.length === 1 ? 'person' : 'people'}${channel.passwordProtected ? ' · Password' : ''}${channel.id === own()?.channelId ? ' · You’re here' : ''}`, 'hint')); + button.addEventListener('click', () => { selected = channel.id; $('join-password').value = ''; $('join-status').textContent = ''; renderBrowser(); if (matchMedia('(max-width: 660px)').matches) $('channel-detail').scrollIntoView({ behavior: 'smooth', block: 'start' }); }); row.append(button); fragment.append(row); + } + const focus = document.activeElement?.closest('[data-channel]')?.dataset.channel; const scroll = $('ts3-channels').scrollTop; + $('ts3-channels').replaceChildren(fragment); $('ts3-channels').scrollTop = scroll; + if (focus) $('ts3-channels').querySelector(`[data-channel="${focus}"] button`)?.focus({ preventScroll: true }); + $('channel-count').textContent = `${count} / ${state?.channels.length || 0}`; $('tree-empty').hidden = Boolean(state?.channels.length); $('search-empty').hidden = !state || count > 0; + const channel = state?.channels.find(channel => channel.id === selected); + $('browse-channel-name').textContent = channel?.name || 'Choose a channel'; $('browse-channel-topic').textContent = channel?.topic || ''; + $('browse-channel-meta').textContent = channel ? `${channelPath(channel, state.channels) || 'Top-level channel'}${channel.passwordProtected ? ' / Password required' : ''}${!connected ? ' / Last received state' : ''}` : 'Select a room to preview its participants.'; + const people = document.createDocumentFragment(); + for (const person of state?.participants.filter(person => person.channelId === selected) || []) { const item = node('li', person.name); if (person.id !== state.ownClientId) { const message = node('button', 'Message', 'quiet'); message.disabled = !connected; message.addEventListener('click', () => openPrivate(person)); item.append(message); } people.append(item); } + $('browse-participants').replaceChildren(people); + $('join-form').hidden = !channel || channel.id === own()?.channelId; $('browse-return').hidden = !channel || channel.id !== own()?.channelId; + $('join-password').hidden = !channel?.passwordProtected; $('join-password-label').hidden = !channel?.passwordProtected; $('join-password').required = Boolean(channel?.passwordProtected); + $('join-submit').disabled = !connected; $('join-name').textContent = channel?.name || ''; +} +function renderThreads() { + const fragment = document.createDocumentFragment(); + const totalUnread = [...unread.values()].reduce((sum, count) => sum + count, 0); $('messages-nav').textContent = totalUnread ? `Messages (${totalUnread})` : 'Messages'; + const peers = state?.participants.filter(person => person.id !== state.ownClientId) || []; + for (const person of peers) { const key = person.uid || String(person.id); if (!threads.has(key)) threads.set(key, person); } + for (const [key, person] of threads) { + const current = peers.find(peer => (peer.uid || String(peer.id)) === key); + const button = node('button', undefined, 'thread'); button.append(node('strong', person.name), node('span', `${unread.get(key) ? `${unread.get(key)} unread · ` : ''}${current && connected ? 'Available · This session' : 'Disconnected · This session'}`, 'hint')); + button.setAttribute('aria-pressed', String(Boolean(current && privatePeer === current.id))); button.disabled = !current || !connected; + button.addEventListener('click', () => openPrivate(current)); fragment.append(button); + } + if (!fragment.childNodes.length) fragment.append(node('p', 'Connected participants will appear here.', 'hint')); + $('conversation-threads').replaceChildren(fragment); + const peer = state?.participants.find(person => person.id === privatePeer && (!privatePeerUid || person.uid === privatePeerUid)); + $('direct-name').textContent = peer?.name || 'Choose someone'; $('direct-status').textContent = peer ? state.channels.find(channel => channel.id === peer.channelId)?.name || 'Connected participant' : 'Choose a participant to start a private conversation.'; + $('direct-volume').disabled = !peer || !connected; $('direct-poke').disabled = !peer || !connected; + $('direct-volume').value = String(Math.round(getParticipantVolume(peer?.id) * 100)); $('direct-volume-value').textContent = `${$('direct-volume').value}% / Range 0–200%`; + if (page === 'conversation' && scope() !== 'private') { $('message-input').disabled = true; $('message-send').disabled = true; $('chat-context').textContent = 'Choose a participant to open a private conversation.'; } +} +$('direct-volume').addEventListener('input', () => { if (privatePeer) { setParticipantVolume(privatePeer, Number($('direct-volume').value) / 100); $('direct-volume-value').textContent = `${$('direct-volume').value}% / Range 0–200%`; } }); +$('ribbon-mute').addEventListener('click', () => { if ($('voice-mic').getAttribute('aria-pressed') === 'true') $('voice-mic').click(); }); +$('direct-poke').addEventListener('click', () => $('poke-open').click()); +for (const button of document.querySelectorAll('[data-return-scope]')) button.addEventListener('click', () => { $('chat-scope').value = button.dataset.returnScope; renderMessages(); void navigate('console'); }); +$('private-chat').addEventListener('click', () => { void navigate('conversation'); }); +$('channel-search').addEventListener('input', renderBrowser); +$('join-selected').addEventListener('click', () => { selected = own()?.channelId; void navigate('channels'); }); +$('join-form').addEventListener('submit', async event => { + event.preventDefault(); const id = selected; let password = $('join-password').value; $('join-password').value = ''; $('join-submit').disabled = true; + try { await joinChannel(id, password); $('join-status').textContent = ''; await navigate('console'); } + catch (error) { $('join-status').textContent = error.message; } + finally { password = ''; $('join-submit').disabled = !connected; } +}); +$('quick-connect').addEventListener('click', () => void navigate('connections')); +$('connection-add').addEventListener('click', () => void editConnection()); +$('connection-form').addEventListener('input', () => { editorDirty = true; }); +async function saveEditor(connect) { + if (!$('connection-form').reportValidity() || preferenceBusy) return; + if (connect && ($('ts3-connect').disabled || connectionActive)) { $('editor-status').textContent = 'Set up your identity and disconnect any active server before connecting.'; return; } + const epoch = workspaceEpoch; const id = selectedBookmark || crypto.randomUUID(); + const connectionPasswords = {}; if ($('ts3-password').value) connectionPasswords.password = $('ts3-password').value; if ($('ts3-channel-password').value) connectionPasswords.channelPassword = $('ts3-channel-password').value; if ($('bookmark-clear-passwords').checked) { connectionPasswords.password = ''; connectionPasswords.channelPassword = ''; } + const bookmark = { id, name: $('bookmark-name').value.trim(), host: $('ts3-host').value.trim(), port: Number($('ts3-port').value), nickname: $('ts3-nickname').value.trim(), channelId: $('ts3-channel').value ? Number($('ts3-channel').value) : null }; + if ($('bookmark-passwords').checked) { if ($('ts3-password').value) bookmark.password = $('ts3-password').value; if ($('ts3-channel-password').value) bookmark.channelPassword = $('ts3-channel-password').value; } + if ($('bookmark-clear-passwords').checked) { bookmark.password = ''; bookmark.channelPassword = ''; } + $('editor-status').textContent = 'Saving your destination…'; $('editor-connect').disabled = true; + try { + const result = await savePreferences({ ...preferences, nickname: bookmark.nickname, theme, bookmarks: [...preferences.bookmarks.filter(item => item.id !== id), bookmark] }); + if (!result || epoch !== workspaceEpoch) return; editorDirty = false; selectedBookmark = id; clearEditorSecrets(); + $('editor-status').textContent = 'Connection saved.'; + if (connect) await startConnection(preferences.bookmarks.find(item => item.id === id), connectionPasswords); else await navigate('connections'); + } catch (error) { if (epoch === workspaceEpoch) $('editor-status').textContent = error.message; } + finally { connectionPasswords.password = ''; connectionPasswords.channelPassword = ''; bookmark.password = ''; bookmark.channelPassword = ''; if (epoch === workspaceEpoch) $('editor-connect').disabled = $('ts3-connect').disabled; } +} +$('connection-form').addEventListener('submit', event => { event.preventDefault(); void saveEditor(true); }); +$('bookmark-save').addEventListener('click', () => void saveEditor(false)); +$('bookmark-delete').addEventListener('click', async () => { + if (!selectedBookmark || !preferences || preferenceBusy) return; + const id = selectedBookmark; + if (!await confirmAction('Delete this saved connection?', 'This removes only the saved destination. Your account and TeamSpeak identity are kept.', 'Delete connection')) return; + try { const result = await savePreferences({ ...preferences, bookmarks: preferences.bookmarks.filter(item => item.id !== id) }); if (!result) return; editorDirty = false; await navigate('connections'); } + catch (error) { $('editor-status').textContent = error.message; } +}); +$('mixer-layout').addEventListener('click', () => { const compact = $('mixer-layout').getAttribute('aria-pressed') !== 'true'; $('mixer-layout').setAttribute('aria-pressed', String(compact)); $('mixer-layout').textContent = compact ? 'Mixer view' : 'Compact view'; $('member-list').classList.toggle('compact-members', compact); }); +function syncAudioModes() { for (const button of document.querySelectorAll('[data-audio-mode]')) button.setAttribute('aria-pressed', String(button.dataset.audioMode === $('voice-mode').value)); } +for (const button of document.querySelectorAll('[data-audio-mode]')) button.addEventListener('click', () => { $('voice-mode').value = button.dataset.audioMode; $('voice-mode').dispatchEvent(new Event('change')); }); +$('voice-mode').addEventListener('change', syncAudioModes); syncAudioModes(); +for (const button of document.querySelectorAll('[data-close]')) button.addEventListener('click', () => $(button.dataset.close).close()); +$('message-input').addEventListener('keydown', event => { if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) { event.preventDefault(); if (!$('message-send').disabled) $('message-form').requestSubmit(); } }); +$('theme-toggle').addEventListener('click', async () => { theme = themes[(themes.indexOf(theme) + 1) % themes.length]; applyTheme(); if (preferences) try { await savePreferences({ ...preferences, theme }); } catch (error) { $('notice').textContent = error.message; } }); +window.addEventListener('voxharbor-speaking', ({ detail }) => { activeSpeakers = new Set(detail); for (const card of $('member-list').querySelectorAll('[data-member]')) { const active = activeSpeakers.has(Number(card.dataset.member)); card.classList.toggle('speaking', active); const status = card.querySelector('[data-base-status]'); if (status) status.textContent = active ? 'Speaking' : status.dataset.baseStatus; } }); +window.addEventListener('voxharbor-state', ({ detail }) => { + state = detail; const current = own()?.channelId; + if (previousOwnChannel && previousOwnChannel !== current && scope() === 'channel') { $('message-input').value = ''; $('message-status').textContent = 'Channel changed. The previous draft was cleared.'; } + if (previousOwnChannel !== current) recent = [current, ...recent].filter(Boolean).slice(0, 4); + if (!selected || !state.channels.some(channel => channel.id === selected)) selected = current; + previousOwnChannel = current; if (document.activeElement !== $('profile-nickname')) $('profile-nickname').value = own()?.name || ''; + $('away-toggle').textContent = own()?.awayMessage !== null && own()?.awayMessage !== undefined ? 'Return from away' : 'Set away'; + $('server-name').textContent = state.server.name; renderChannel(); renderBrowser(); renderMessages(); +}); +window.addEventListener('voxharbor-connection', ({ detail }) => { + connected = detail.state === 'connected'; connectionActive = ['connected', 'connecting', 'retrying', 'offline'].includes(detail.state); + $('lab').dataset.connection = detail.state; + $('connection-badge').textContent = ({connected:'Connected',connecting:'Connecting',retrying:'Reconnecting',stopped:'Offline',offline:'Network offline',failed:'Connection failed',expired:'Signed out'})[detail.state] || detail.state; + $('connection-badge').dataset.state = detail.state; $('ribbon-status').textContent = $('connection-badge').textContent; + $('session-ribbon').hidden = !connectionActive || page === 'console'; $('nickname-update').disabled = !connected; $('away-toggle').disabled = !connected; + if (!connected) { privatePeer = undefined; privatePeerUid = undefined; $('chat-scope').querySelector('option[value="private"]')?.remove(); if (scope() === 'private') $('chat-scope').value = 'channel'; $('message-input').value = ''; } + if (detail.state === 'stopped') { messages.length = 0; drafts.clear(); draftKey = undefined; threads.clear(); unread.clear(); } + if (['stopped','failed','expired'].includes(detail.state)) { state = undefined; selected = undefined; recent = []; emptyRoom(); $('selected-channel-name').textContent = 'Your place to talk.'; $('channel-context').textContent = 'READY WHEN YOU ARE'; $('subscription-toggle').hidden = true; } + renderBookmarks(); renderChannel(); renderBrowser(); renderMessages(); +}); +window.addEventListener('voxharbor-message', ({ detail }) => { + if ((detail.target === 'private' || detail.target === 'poke') && detail.clientId !== state?.ownClientId && !(page === 'conversation' && privatePeer === detail.clientId)) { const key = detail.uid || String(detail.clientId); unread.set(key, (unread.get(key) || 0) + 1); } + const outgoing = detail.clientId === state?.ownClientId; const peerId = outgoing ? detail.targetClientId : detail.clientId; + const peerUid = (outgoing ? detail.targetUid : detail.uid) || state?.participants.find(client => client.id === peerId)?.uid; + appendMessage({ ...detail, peerId, peerUid, at: Date.now(), outgoing }); + if ((detail.target === 'private' || detail.target === 'poke') && scope() !== 'private') $('message-status').textContent = `New ${detail.target === 'poke' ? 'poke' : 'private message'} from ${detail.name}. Open Private to read it.`; +}); +window.addEventListener('voxharbor-reset', () => { state = undefined; connected = false; connectionActive = false; selected = undefined; recent = []; privatePeer = undefined; privatePeerUid = undefined; previousOwnChannel = undefined; messages.length = 0; drafts.clear(); draftKey = undefined; threads.clear(); unread.clear(); sending = false; $('messages').replaceChildren(); $('message-input').value = ''; $('message-status').textContent = ''; $('channel-search').value = ''; $('away-message').value = ''; $('profile-status').textContent = ''; $('poke-message').value = ''; $('server-name').textContent = 'Your destinations'; $('session-ribbon').hidden = true; emptyRoom(); renderRooms(); renderBrowser(); renderMessages(); syncAudioModes(); for (const dialog of document.querySelectorAll('dialog[open]')) dialog.close(); }); +applyTheme(); + +const phoneLayout = matchMedia('(max-width: 660px)'); +function layoutEditorActions() { const target = phoneLayout.matches ? $('editor-mobile-actions') : $('editor-primary'); for (const element of [document.querySelector('.editor-actions'), $('editor-status'), $('native-status')]) target.append(element); } +phoneLayout.addEventListener('change', layoutEditorActions); layoutEditorActions(); +$('direct-tools-toggle').addEventListener('click', () => { const expanded = $('direct-tools-toggle').getAttribute('aria-expanded') !== 'true'; $('direct-tools-toggle').setAttribute('aria-expanded', String(expanded)); $('direct-grid').classList.toggle('show-direct-controls', expanded); }); diff --git a/scripts/audio-browser-qa.mjs b/scripts/audio-browser-qa.mjs new file mode 100644 index 0000000..4b93872 --- /dev/null +++ b/scripts/audio-browser-qa.mjs @@ -0,0 +1,22 @@ +// Local, disposable QA page. Synthetic audio only: no microphone, owner data or network server. +import { createServer } from 'node:http'; +import { readFile } from 'node:fs/promises'; +const root = new URL('../', import.meta.url); +const files = new Map([ + ['/qa.mjs', 'tests/fixtures/audio-browser-qa.mjs'], + ['/probe.mjs', 'tests/fixtures/playback-probe.mjs'], + ...['voice-worker.mjs', 'voice-frame.mjs', 'voice-worklet.mjs', 'jitter-buffer.mjs', 'vendor/opus/index.js', 'vendor/opus/generated/libopus.generated.mjs'].map(file => [`/${file}`, `public/${file}`]), +]); +const server = createServer(async (req, res) => { + res.setHeader('Content-Security-Policy', "default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; connect-src 'self'; style-src 'self'; base-uri 'none'; frame-ancestors 'none'"); + res.setHeader('Cache-Control', 'no-store'); res.setHeader('X-Content-Type-Options', 'nosniff'); + if (req.method !== 'GET') { res.writeHead(405); res.end(); return; } + if (req.url === '/') { + res.setHeader('Content-Type', 'text/html; charset=utf-8'); + res.end('VoxHarbor silent audio QA

Silent browser audio test

Synthetic signal only. No microphone access, audible playback or TeamSpeak connection.

Ready
'); return; + } + if (!files.has(req.url)) { res.writeHead(404); res.end(); return; } + try { res.setHeader('Content-Type', 'text/javascript; charset=utf-8'); res.end(await readFile(new URL(files.get(req.url), root))); } + catch { res.writeHead(404); res.end(); } +}); +server.listen(3147, '127.0.0.1', () => console.log('Silent audio QA: http://localhost:3147')); diff --git a/scripts/bootstrap-rust.sh b/scripts/bootstrap-rust.sh new file mode 100644 index 0000000..758012b --- /dev/null +++ b/scripts/bootstrap-rust.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eu +# Build-time toolchain only. No credentials are sent to the Rust distribution service. +if ! command -v rustup >/dev/null 2>&1 && [ ! -x "$HOME/.cargo/bin/rustup" ]; then + installer="$(mktemp)" + curl --proto '=https' --tlsv1.2 --fail --silent --show-error https://sh.rustup.rs -o "$installer" + sh "$installer" -y --profile minimal --default-toolchain 1.96.0 --no-modify-path + rm -f "$installer" +else + if [ -x "$HOME/.cargo/bin/rustup" ]; then + "$HOME/.cargo/bin/rustup" toolchain install 1.96.0 --profile minimal --no-self-update + else + rustup toolchain install 1.96.0 --profile minimal --no-self-update + fi +fi diff --git a/scripts/build-native.mjs b/scripts/build-native.mjs new file mode 100644 index 0000000..c9ba7e7 --- /dev/null +++ b/scripts/build-native.mjs @@ -0,0 +1,26 @@ +import { spawnSync } from 'node:child_process'; +import { chmod, copyFile, mkdir } from 'node:fs/promises'; +import { existsSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; + +const root = fileURLToPath(new URL('../', import.meta.url)); +function run(command, args, env = process.env) { + const result = spawnSync(command, args, { cwd: root, env, stdio: 'inherit' }); + if (result.status !== 0) throw new Error(`Native build step failed: ${command}`); +} +const allowed = ['PATH', 'HOME', 'TMPDIR', 'CARGO_HOME', 'RUSTUP_HOME', 'LANG', 'LC_ALL', 'CC', 'CXX', 'AR', 'CFLAGS', 'CXXFLAGS', 'MACOSX_DEPLOYMENT_TARGET', 'SDKROOT', 'RUSTUP_OVERRIDE_UNIX_FALLBACK_SETTINGS']; +let env = { ...Object.fromEntries(allowed.filter(key => process.env[key]).map(key => [key, process.env[key]])), CARGO_REGISTRIES_CRATES_IO_PROTOCOL: 'sparse' }; +if (process.env.VERCEL === '1') { + run('bash', ['scripts/bootstrap-rust.sh'], env); + env.PATH = `${process.env.HOME}/.cargo/bin:${env.PATH}`; + env.RUSTUP_TOOLCHAIN = '1.96.0'; +} else if (existsSync('/opt/homebrew/opt/rustup/bin/cargo')) { + env.PATH = `/opt/homebrew/opt/rustup/bin:${env.PATH}`; +} +run('cargo', ['build', '--manifest-path', 'native/Cargo.toml', '--locked', '--release'], env); +await mkdir(new URL('../native/bin/', import.meta.url), { recursive: true }); +const target = new URL('../native/bin/voxharbor-protocol', import.meta.url); +await copyFile(new URL('../native/target/release/voxharbor-protocol', import.meta.url), target); +await chmod(target, 0o755); +console.log('Native protocol executable packaged for this platform.'); +if (process.platform === 'linux') run('ldd', [fileURLToPath(target)]); diff --git a/scripts/check.mjs b/scripts/check.mjs new file mode 100644 index 0000000..cb22457 --- /dev/null +++ b/scripts/check.mjs @@ -0,0 +1,11 @@ +import { readdir } from 'node:fs/promises'; +import { spawnSync } from 'node:child_process'; +async function files(path) { + const entries = await readdir(path, { withFileTypes: true }); + return (await Promise.all(entries.map(entry => entry.isDirectory() ? files(`${path}/${entry.name}`) : `${path}/${entry.name}`))).flat(); +} +for (const file of (await Promise.all(['api', 'src', 'scripts', 'tests', 'public'].map(files))).flat().filter(file => file.endsWith('.mjs'))) { + const result = spawnSync(process.execPath, ['--check', file], { stdio: 'inherit' }); + if (result.status !== 0) process.exit(1); +} +console.log('JavaScript syntax checks passed'); diff --git a/scripts/dev.mjs b/scripts/dev.mjs new file mode 100644 index 0000000..67ed22f --- /dev/null +++ b/scripts/dev.mjs @@ -0,0 +1,14 @@ +import { readConfig } from '../src/config.mjs'; +import { createApp } from '../src/http-adapter.mjs'; +let config; +try { config = readConfig(); } +catch (error) { + console.error(`Cannot start VoxHarbor: ${error.message}`); + console.error('For local owner setup, run: npm run owner:setup'); + console.error('Review .env.example for the remaining configuration.'); + process.exit(1); +} +const { server } = createApp(config); +const url = new URL(config.origin); +if (url.hostname !== 'localhost' || url.protocol !== 'http:') throw new Error('Local dev requires http://localhost:'); +server.listen(Number(url.port || 80), '127.0.0.1', () => console.log(`VoxHarbor feasibility lab: ${config.origin}`)); diff --git a/scripts/generate-app-icons.mjs b/scripts/generate-app-icons.mjs new file mode 100644 index 0000000..64ec286 --- /dev/null +++ b/scripts/generate-app-icons.mjs @@ -0,0 +1,51 @@ +// Reproducible vector and raster versions of VoxHarbor's waveform mark. +// Uses Node built-ins only; no external image service or build-time dependency. +import { mkdir, writeFile } from 'node:fs/promises'; +import { deflateSync } from 'node:zlib'; +const root = new URL('../public/', import.meta.url); +const background = [23, 24, 24]; const accent = [236, 131, 81]; +const bars = [[14, 20, 4, 24], [22, 14, 4, 36], [30, 18, 4, 28], [38, 10, 4, 44], [46, 23, 4, 18]]; +const shapes = bars.map(([x, y, width, height]) => ``).join(''); +await mkdir(new URL('icons/', root), { recursive: true }); +await writeFile(new URL('favicon.svg', root), `${shapes}\n`); +await writeFile(new URL('icons/safari-pinned-tab.svg', root), `${shapes}\n`); +const table = Array.from({ length: 256 }, (_, n) => { for (let k = 0; k < 8; k++) n = (n & 1) ? 0xedb88320 ^ (n >>> 1) : n >>> 1; return n >>> 0; }); +function chunk(type, data) { + const tag = Buffer.from(type); let crc = 0xffffffff; + for (const byte of Buffer.concat([tag, data])) crc = table[(crc ^ byte) & 255] ^ (crc >>> 8); + const length = Buffer.alloc(4); length.writeUInt32BE(data.length); + const checksum = Buffer.alloc(4); checksum.writeUInt32BE((crc ^ 0xffffffff) >>> 0); + return Buffer.concat([length, tag, data, checksum]); +} +function inside(x, y, left, top, width, height, radius) { + const dx = Math.max(left + radius - x, 0, x - (left + width - radius)); + const dy = Math.max(top + radius - y, 0, y - (top + height - radius)); + return dx * dx + dy * dy <= radius * radius; +} +function png(size, { rounded = false, scale = 1 } = {}) { + const stride = size * 4 + 1; const pixels = Buffer.alloc(stride * size); const samples = 4; + for (let y = 0; y < size; y++) for (let x = 0; x < size; x++) { + let red = 0, green = 0, blue = 0, alpha = 0; + for (let sy = 0; sy < samples; sy++) for (let sx = 0; sx < samples; sx++) { + const px = (x + (sx + .5) / samples) * 64 / size; const py = (y + (sy + .5) / samples) * 64 / size; + if (rounded && !inside(px, py, 0, 0, 64, 64, 14)) continue; + const mx = (px - 32) / scale + 32; const my = (py - 32) / scale + 32; + const color = bars.some(([left, top, width, height]) => inside(mx, my, left, top, width, height, 2)) ? accent : background; + red += color[0]; green += color[1]; blue += color[2]; alpha++; + } + const offset = y * stride + 1 + x * 4; + if (alpha) { pixels[offset] = Math.round(red / alpha); pixels[offset + 1] = Math.round(green / alpha); pixels[offset + 2] = Math.round(blue / alpha); pixels[offset + 3] = Math.round(alpha * 255 / (samples * samples)); } + } + const header = Buffer.alloc(13); header.writeUInt32BE(size, 0); header.writeUInt32BE(size, 4); header[8] = 8; header[9] = 6; + return Buffer.concat([Buffer.from([137,80,78,71,13,10,26,10]), chunk('IHDR', header), chunk('IDAT', deflateSync(pixels, { level: 9 })), chunk('IEND', Buffer.alloc(0))]); +} +for (const [path, size, options] of [ + ['favicon-16x16.png', 16, { rounded: true }], ['favicon-32x32.png', 32, { rounded: true }], + ['apple-touch-icon.png', 180, {}], ['icons/app-192.png', 192, {}], ['icons/app-512.png', 512, {}], ['icons/app-maskable-512.png', 512, { scale: .8 }], +]) await writeFile(new URL(path, root), png(size, options)); +const sizes = [16, 32, 48]; const images = sizes.map(size => png(size, { rounded: true })); +const icoHeader = Buffer.alloc(6); icoHeader.writeUInt16LE(1, 2); icoHeader.writeUInt16LE(sizes.length, 4); +let offset = 6 + sizes.length * 16; +const directory = sizes.map((size, i) => { const entry = Buffer.alloc(16); entry[0] = size; entry[1] = size; entry.writeUInt16LE(1, 4); entry.writeUInt16LE(32, 6); entry.writeUInt32LE(images[i].length, 8); entry.writeUInt32LE(offset, 12); offset += images[i].length; return entry; }); +await writeFile(new URL('favicon.ico', root), Buffer.concat([icoHeader, ...directory, ...images])); +console.log('Generated VoxHarbor favicons, touch icons, app icons and pinned-tab mark.'); diff --git a/scripts/hash-password.mjs b/scripts/hash-password.mjs new file mode 100644 index 0000000..968e74c --- /dev/null +++ b/scripts/hash-password.mjs @@ -0,0 +1,29 @@ +import { hashPassword } from '../src/auth/password.mjs'; +import { saveLocalOwner } from './local-owner-config.mjs'; +if (!process.stdin.isTTY) throw new Error('Run in an interactive terminal'); +process.stdout.write('Owner password (16+ characters, hidden): '); +process.stdin.setRawMode(true); +process.stdin.resume(); +let password = ''; +process.stdin.setEncoding('utf8'); +process.stdin.on('data', async data => { + for (const character of data) { + if (character === '\u0003') process.exit(130); + if (character === '\r' || character === '\n') { + process.stdin.setRawMode(false); + process.stdin.pause(); + try { + const hash = await hashPassword(password); + password = ''; + if (process.argv.includes('--save')) { + await saveLocalOwner(hash); + console.log('\nOwner password hash saved to .env.local; session secret rotated. Run npm run dev, then sign in with the password you entered.'); + } else console.log(`\nOWNER_PASSWORD_HASH=${hash}`); + } + catch (error) { console.error(`\n${error.message}`); process.exitCode = 1; } + return; + } + if (character === '\u007f') password = password.slice(0, -1); + else if (password.length <= 256) password += character; + } +}); diff --git a/scripts/hidden-prompt.mjs b/scripts/hidden-prompt.mjs new file mode 100644 index 0000000..a2c0151 --- /dev/null +++ b/scripts/hidden-prompt.mjs @@ -0,0 +1,20 @@ +export function hiddenPrompt(label) { + if (!process.stdin.isTTY) throw new Error('Run in an interactive terminal'); + process.stdout.write(`${label} (hidden): `); + return new Promise(resolve => { + let value = ''; + process.stdin.setRawMode(true); process.stdin.setEncoding('utf8'); process.stdin.resume(); + function input(data) { + for (const character of data) { + if (character === '\u0003') process.exit(130); + if (character === '\r' || character === '\n') { + process.stdin.removeListener('data', input); process.stdin.setRawMode(false); process.stdin.pause(); + process.stdout.write('\n'); resolve(value); return; + } + if (character === '\u007f') value = value.slice(0, -1); + else if (value.length < 256) value += character; + } + } + process.stdin.on('data', input); + }); +} diff --git a/scripts/identity-key.mjs b/scripts/identity-key.mjs new file mode 100644 index 0000000..f66781d --- /dev/null +++ b/scripts/identity-key.mjs @@ -0,0 +1,22 @@ +import { randomBytes } from 'node:crypto'; +import { readFile, writeFile, rename } from 'node:fs/promises'; +import { parseEnv } from 'node:util'; + +const path = new URL('../.env.local', import.meta.url); +let source; +try { source = await readFile(path, 'utf8'); } +catch (error) { + if (error.code !== 'ENOENT') throw error; + source = await readFile(new URL('../.env.example', import.meta.url), 'utf8'); +} +const existing = parseEnv(source).IDENTITY_ENCRYPTION_KEY; +if (/^[a-f0-9]{64}$/i.test(existing || '')) { + console.log('IDENTITY_ENCRYPTION_KEY is already configured; it was preserved.'); +} else { + if (existing) throw new Error('An existing identity key value is invalid; correct it manually instead of regenerating it.'); + source = source.replace(/^[\t ]*(?:export[\t ]+)?IDENTITY_ENCRYPTION_KEY[\t ]*=.*$/gm, '').trimEnd(); + const temporary = new URL(`../.env.local.${randomBytes(8).toString('hex')}.tmp`, import.meta.url); + await writeFile(temporary, `${source}\nIDENTITY_ENCRYPTION_KEY=${randomBytes(32).toString('hex')}\n`, { mode: 0o600, flag: 'wx' }); + await rename(temporary, path); + console.log('Added a separate identity encryption key to .env.local. Back it up securely; no private identity was created.'); +} diff --git a/scripts/local-owner-config.mjs b/scripts/local-owner-config.mjs new file mode 100644 index 0000000..85436ef --- /dev/null +++ b/scripts/local-owner-config.mjs @@ -0,0 +1,34 @@ +import { randomBytes } from 'node:crypto'; +import { readFile, writeFile, rename, unlink } from 'node:fs/promises'; + +export function updateOwnerConfig(source, hash, secret) { + if (!/^scrypt:[a-f0-9]{32}:[a-f0-9]{128}$/.test(hash)) throw new Error('Invalid owner password hash'); + if (!/^[a-f0-9]{64}$/.test(secret)) throw new Error('Invalid session secret'); + let result = source; + for (const [key, value] of Object.entries({ OWNER_PASSWORD_HASH: hash, SESSION_SECRET: secret })) { + // Replace all active assignments, including duplicates and optional dotenv export syntax. + const assignment = new RegExp(`^[\\t ]*(?:export[\\t ]+)?${key}[\\t ]*=.*$`, 'gm'); + result = result.replace(assignment, '').trimEnd(); + result += `\n${key}=${value}\n`; + } + return result; +} + +export async function saveLocalOwner(hash, directory = new URL('../', import.meta.url)) { + const destination = new URL('.env.local', directory); + let source; + try { source = await readFile(destination, 'utf8'); } + catch (error) { + if (error.code !== 'ENOENT') throw error; + source = await readFile(new URL('.env.example', directory), 'utf8'); + } + // Replacing the password also revokes sessions using the previous credentials. + const updated = updateOwnerConfig(source, hash, randomBytes(32).toString('hex')); + const temporary = new URL(`.env.local.${randomBytes(8).toString('hex')}.tmp`, directory); + try { + await writeFile(temporary, updated, { mode: 0o600, flag: 'wx' }); + await rename(temporary, destination); + } finally { + await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); + } +} diff --git a/scripts/package-deployment.mjs b/scripts/package-deployment.mjs new file mode 100644 index 0000000..ef3e853 --- /dev/null +++ b/scripts/package-deployment.mjs @@ -0,0 +1,2 @@ +import { packageSource } from './package-source.mjs'; +await packageSource('deployment'); diff --git a/scripts/package-publication.mjs b/scripts/package-publication.mjs new file mode 100644 index 0000000..ad69438 --- /dev/null +++ b/scripts/package-publication.mjs @@ -0,0 +1,2 @@ +import { packageSource } from './package-source.mjs'; +await packageSource('publication'); diff --git a/scripts/package-source.mjs b/scripts/package-source.mjs new file mode 100644 index 0000000..5e437c4 --- /dev/null +++ b/scripts/package-source.mjs @@ -0,0 +1,21 @@ +import { createHash } from 'node:crypto'; +import { mkdir, writeFile } from 'node:fs/promises'; +import { join } from 'node:path'; +import { auditPublication } from './publication-audit.mjs'; +import { projectRoot } from './source-files.mjs'; +export async function packageSource(kind) { + const report = await auditPublication({ checkGit: kind === 'publication' }); + if (!report.passed) { console.error(JSON.stringify({ passed: false, issues: report.issues }, null, 2)); throw new Error('Source audit failed. No package was published or pushed.'); } + const stamp = new Date().toISOString().replace(/[:.]/g, '-'); + const destination = join(projectRoot, '.local', `${kind}-${stamp}`, 'VoxHarbor'); + await mkdir(destination, { recursive: true, mode: 0o700 }); const manifest = []; + for (const path of report.files) { + const bytes = report.sources.get(path); // Copy the exact audited bytes, not a later filesystem version. + await mkdir(join(destination, path, '..'), { recursive: true }); await writeFile(join(destination, path), bytes); + manifest.push({ path, bytes: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex') }); + } + await writeFile(join(destination, 'SOURCE_MANIFEST.json'), JSON.stringify({ createdAt: new Date().toISOString(), files: manifest }, null, 2) + '\n'); + console.log(`${kind === 'publication' ? 'Public source' : 'Deployment source'}: ${destination}`); + console.log(`${manifest.length} source files. No Git metadata, private configuration, identities, evidence, dependencies or local binaries.`); + return destination; +} diff --git a/scripts/prepare-audio.mjs b/scripts/prepare-audio.mjs new file mode 100644 index 0000000..7ffae3c --- /dev/null +++ b/scripts/prepare-audio.mjs @@ -0,0 +1,8 @@ +import { copyFile, mkdir } from 'node:fs/promises'; +const dest = new URL('../public/vendor/opus/', import.meta.url); +const source = new URL('../node_modules/libopus-wasm/', import.meta.url); +await mkdir(new URL('generated/', dest), { recursive: true }); +for (const [from, to] of [['dist/index.js', 'index.js'], ['dist/generated/libopus.generated.mjs', 'generated/libopus.generated.mjs'], ['LICENSE', 'LICENSE'], ['THIRD_PARTY_NOTICES.md', 'THIRD_PARTY_NOTICES.md']]) { + await copyFile(new URL(from, source), new URL(to, dest)); +} +console.log('Pinned Opus browser codec and license notices packaged.'); diff --git a/scripts/publication-audit.mjs b/scripts/publication-audit.mjs new file mode 100644 index 0000000..7cc3fe6 --- /dev/null +++ b/scripts/publication-audit.mjs @@ -0,0 +1,60 @@ +import { createHash } from 'node:crypto'; +import { readFile } from 'node:fs/promises'; +import { parseEnv } from 'node:util'; +import { spawnSync } from 'node:child_process'; +import { join } from 'node:path'; +import { collectSourceFiles, privatePath, projectRoot } from './source-files.mjs'; + +export function inspectContent(path, bytes, privateValues = []) { + const findings = new Set(); const text = bytes.toString('utf8'); + for (const value of privateValues) { + if (typeof value !== 'string' || value.length < 4) continue; + if ([value, Buffer.from(value).toString('base64'), encodeURIComponent(value)].some(encoded => bytes.includes(Buffer.from(encoded)))) findings.add('local-private-value'); + } + if (/\b(?:gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{40,}|AKIA[0-9A-Z]{16})\b/.test(text)) findings.add('credential-format'); + if (/scrypt:[a-f0-9]{32}:[a-f0-9]{128}/i.test(text)) findings.add('password-hash'); + if (/^\s*identity\s*=\s*["']?[A-Za-z0-9+/]{40,}/m.test(text)) findings.add('identity-export'); + // Upstream crypto tests contain intentional published fixtures. Local-value matching still applies there. + if (!path.startsWith('native/vendor/') && /-----BEGIN (?:EC |RSA |OPENSSH )?PRIVATE KEY-----/.test(text)) findings.add('private-key'); + const publishedCodec = path === 'public/vendor/opus/generated/libopus.generated.mjs' && createHash('sha256').update(bytes).digest('hex') === '0041fc800ccd26f56b27eaeb1834c8c6854e5167d48cd628a4f98ec5b590c6f1'; + if (!path.startsWith('native/vendor/') && !publishedCodec && /\/Users\/[^/\s]+\//.test(text)) findings.add('personal-filesystem-path'); + if (/https:\/\/[a-z0-9-]+-[a-z0-9]{9}-[a-z0-9-]+\.vercel\.app/i.test(text)) findings.add('private-deployment-url'); + return [...findings].map(rule => ({ path, rule })); +} +async function knownPrivateValues(root) { + const values = [root]; + try { + const env = parseEnv(await readFile(join(root, '.env.local'), 'utf8')); + for (const [key, value] of Object.entries(env)) if (/SECRET|TOKEN|PASSWORD|ENCRYPTION_KEY|REDIS.*URL|TS3.*HOST/.test(key)) values.push(value); + } catch (error) { if (error.code !== 'ENOENT') throw new Error('Private configuration could not be checked; no values were printed.'); } + try { + const identity = JSON.parse(await readFile(join(root, '.local/identity.enc.json'), 'utf8')); + if (identity.ciphertext) values.push(identity.ciphertext); + } catch (error) { if (error.code !== 'ENOENT') throw new Error('Local identity exclusion check failed; no contents were printed.'); } + return values; +} +function git(root, args) { return spawnSync('git', args, { cwd: root, encoding: null, maxBuffer: 16 * 1024 * 1024 }); } +export async function auditPublication({ root = projectRoot, checkGit = true } = {}) { + const files = await collectSourceFiles(root); const privateValues = await knownPrivateValues(root); const issues = []; + const allowed = new Set(files); const sources = new Map(); + for (const path of files) { const bytes = await readFile(join(root, path)); sources.set(path, bytes); issues.push(...inspectContent(path, bytes, privateValues)); } + let history = 'not-checked'; let gitCandidateCount = null; + if (checkGit) { + const candidates = git(root, ['ls-files', '--cached', '--others', '--exclude-standard', '-z']); + if (candidates.status !== 0) throw new Error('Cannot inspect Git publication candidates. No Git state was changed.'); + const paths = [...new Set(candidates.stdout.toString('utf8').split('\0').filter(Boolean))]; gitCandidateCount = paths.length; + for (const path of paths) { + if (privatePath(path)) issues.push({ path, rule: 'private-git-path' }); + if (!allowed.has(path)) issues.push({ path, rule: 'outside-source-allowlist' }); + } + const staged = git(root, ['diff', '--cached', '--name-only', '--diff-filter=ACMR', '-z']); + if (staged.status !== 0) throw new Error('Cannot inspect staged publication paths.'); + for (const path of staged.stdout.toString('utf8').split('\0').filter(Boolean)) { + const blob = git(root, ['show', `:${path}`]); + if (blob.status !== 0) issues.push({ path, rule: 'staged-content-unavailable' }); + else issues.push(...inspectContent(path, blob.stdout, privateValues).map(issue => ({ ...issue, snapshot: 'staged' }))); + } + history = git(root, ['rev-parse', '--verify', 'HEAD']).status === 0 ? 'existing-history-requires-separate-review' : 'no-commits'; + } + return { passed: issues.length === 0, sourceFileCount: files.length, gitCandidateCount, history, issues, files, sources }; +} diff --git a/scripts/publication-check.mjs b/scripts/publication-check.mjs new file mode 100644 index 0000000..ae76813 --- /dev/null +++ b/scripts/publication-check.mjs @@ -0,0 +1,6 @@ +import { auditPublication } from './publication-audit.mjs'; +try { + const { files, sources, ...report } = await auditPublication(); + console.log(JSON.stringify(report, null, 2)); + if (!report.passed) process.exitCode = 1; +} catch (error) { console.error(error.message); process.exitCode = 1; } diff --git a/scripts/source-files.mjs b/scripts/source-files.mjs new file mode 100644 index 0000000..1fc602a --- /dev/null +++ b/scripts/source-files.mjs @@ -0,0 +1,32 @@ +import { readdir, lstat } from 'node:fs/promises'; +import { resolve, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +export const projectRoot = fileURLToPath(new URL('../', import.meta.url)); +const roots = ['api', 'src', 'public', 'scripts', 'tests', 'docs', 'native/src', 'native/vendor']; +const top = ['.gitignore', '.vercelignore', '.env.example', 'LICENSE', 'THIRD_PARTY_NOTICES.md', 'SECURITY.md', 'CONTRIBUTING.md', 'README.md', 'IMPLEMENTATION_PLAN.md', 'package.json', 'package-lock.json', 'vercel.json', 'native/Cargo.toml', 'native/Cargo.lock', 'native/README.md']; +export function privatePath(path) { + return /(^|\/)(\.git|\.local|\.idea|\.vscode|node_modules|target|coverage|evidence)(\/|$)/.test(path) || + /^(native\/bin|docs\/verification)(\/|$)/.test(path) || + /(^|\/)\.env(?:\.|$)/.test(path) && path !== '.env.example' || + /\.(?:log|har|pem|key|p12|pfx|wav|mp3|ogg|enc\.json)$/i.test(path) || /(^|\/)identity\.ini$/i.test(path); +} +export async function collectSourceFiles(root = projectRoot) { + root = resolve(root); const files = []; + async function add(path) { + const info = await lstat(join(root, path)); + if (!info.isFile() || info.isSymbolicLink() || privatePath(path)) throw new Error(`Unsupported public source path: ${path}`); + files.push(path); + } + async function walk(path) { + if (!(await lstat(join(root, path))).isDirectory()) throw new Error(`Not a source directory: ${path}`); + for (const entry of await readdir(join(root, path), { withFileTypes: true })) { + if (entry.name.startsWith('.') || ['node_modules', 'target', 'bin'].includes(entry.name)) continue; + const child = `${path}/${entry.name}`; + if (privatePath(child)) throw new Error(`Private material inside source tree: ${child}`); + if (entry.isDirectory()) await walk(child); else await add(child); + } + } + for (const directory of roots) await walk(directory); + for (const path of top) await add(path); + return files.sort(); +} diff --git a/scripts/verify-production-protocol.mjs b/scripts/verify-production-protocol.mjs new file mode 100644 index 0000000..0ab8ee7 --- /dev/null +++ b/scripts/verify-production-protocol.mjs @@ -0,0 +1,74 @@ +import { hiddenPrompt } from './hidden-prompt.mjs'; +import { writeFile } from 'node:fs/promises'; +import { WebSocket } from 'ws'; + +// Explicit owner login; never read browser cookies or save passwords/session tokens. +const origin = new URL(process.argv[2]); +if (origin.protocol !== 'https:' || origin.origin !== process.argv[2]) throw new Error('Pass the exact production HTTPS origin'); +const seconds = Number(process.argv[3] || 60); +if (!Number.isInteger(seconds) || seconds < 5 || seconds > 280) throw new Error('Duration must be 5..280 seconds'); +if (!process.stdin.isTTY) throw new Error('An interactive hidden password prompt is required'); +let password = await hiddenPrompt('Owner password'); +let cookie; +let csrf; +async function request(path, body) { + const response = await fetch(new URL(path, origin), { + method: body === undefined ? 'GET' : 'POST', redirect: 'error', signal: AbortSignal.timeout(15000), + headers: { Origin: origin.origin, ...(cookie ? { Cookie: cookie } : {}), + ...(body === undefined ? {} : { 'Content-Type': 'application/json', ...(csrf ? { 'X-CSRF-Token': csrf } : {}) }) }, + ...(body === undefined ? {} : { body: JSON.stringify(body) }), + }); + if (!response.ok) throw new Error(`HTTP ${response.status} on ${path}`); + if (path === '/api/login') cookie = response.headers.get('set-cookie')?.split(';')[0]; + return response.json(); +} +const result = { testedAt: new Date().toISOString(), origin: origin.origin, environment: 'actual-vercel-production', + microphoneEnabled: false, listening: false, events: [], snapshots: 0, maxChannels: 0, maxParticipants: 0, incomingVoicePackets: 0 }; +const record = event => result.events.push({ at: new Date().toISOString(), ...event }); +try { + ({ csrf } = await request('/api/login', { password })); password = ''; + result.runtime = (await request('/api/session')).runtime; + result.capabilities = await request('/api/protocol'); + result.identityBefore = (await request('/api/identity')).identity; + if (!result.identityBefore) throw new Error('Create/import the production identity through the owner UI first'); + const settings = await request('/api/preferences'); + if (!settings.connection) throw new Error('Save a connection through the owner UI before verification'); + await new Promise((resolve, reject) => { + const socket = new WebSocket(new URL('/api/ts3', origin).href.replace('https:', 'wss:'), { + origin: origin.origin, headers: { Cookie: cookie }, handshakeTimeout: 15000, + }); + const deadline = setTimeout(() => { record({ type: 'test_stop' }); socket.close(1000, 'Verification window finished'); }, seconds * 1000); + const watchdog = setTimeout(() => { socket.terminate(); reject(new Error('Protocol transport did not close')); }, (seconds + 10) * 1000); + socket.on('open', () => socket.send(JSON.stringify({ type: 'connect', csrf, connectionId: settings.connection.id }))); + socket.on('message', (data, binary) => { + if (binary) { result.incomingVoicePackets++; return; } + const event = JSON.parse(data.toString()); + if (event.type === 'ts3_state') { + result.snapshots++; + result.maxChannels = Math.max(result.maxChannels, event.channels.length); + result.maxParticipants = Math.max(result.maxParticipants, event.participants.length); + result.lastSequence = event.sequence; + } else if (event.type === 'ts3_status') record({ type: event.type, status: event.status }); + else if (event.type === 'ts3_error') record({ type: event.type, code: event.code, inconclusive: event.inconclusive === true }); + else if (event.type === 'ts3_audio_status') record({ type: event.type, canSend: event.canSend, canReceive: event.canReceive }); + else if (event.type === 'ts3_identity') result.connectedIdentity = { uid: event.uid, level: event.level }; + }); + socket.on('error', () => record({ type: 'transport_error' })); + socket.on('close', code => { + clearTimeout(deadline); clearTimeout(watchdog); record({ type: 'transport_close', code }); resolve(); + }); + }); + result.identityAfter = (await request('/api/identity')).identity; + result.identityPreserved = result.identityAfter?.uid === result.identityBefore.uid; + result.connected = result.events.some(event => event.status === 'connected'); +} catch (error) { + result.failure = error.message; + process.exitCode = 1; +} finally { + if (cookie && csrf) await request('/api/logout', {}).catch(() => {}); +} +result.passed = Boolean(result.connected && result.identityPreserved && !result.failure && !result.events.some(event => ['ts3_error', 'transport_error'].includes(event.type))); +if (!result.passed) process.exitCode = 1; +const json = JSON.stringify(result, null, 2) + '\n'; +if (process.argv[4]) await writeFile(process.argv[4], json); +console.log(json); diff --git a/scripts/verify-public-deployment.mjs b/scripts/verify-public-deployment.mjs new file mode 100644 index 0000000..c061ba0 --- /dev/null +++ b/scripts/verify-public-deployment.mjs @@ -0,0 +1,45 @@ +import assert from 'node:assert/strict'; +import { WebSocket } from 'ws'; + +const url = new URL(process.argv[2]); +if (url.protocol !== 'https:' || url.origin !== process.argv[2]) throw new Error('Pass the exact HTTPS deployment origin'); +const checks = []; +async function http(name, path, expected, options = {}) { + const response = await fetch(new URL(path, url), { ...options, redirect: 'error', signal: AbortSignal.timeout(15000) }); + assert.equal(response.status, expected, `${name}: expected ${expected}, got ${response.status}`); + checks.push({ name, status: response.status }); + return response; +} +function upgrade(name, origin, expected) { + return new Promise((resolve, reject) => { + const client = new WebSocket(`${url.origin.replace('https:', 'wss:')}/api/ts3`, { origin, handshakeTimeout: 15000 }); + client.on('error', () => {}); + client.once('unexpected-response', (_req, response) => { + response.resume(); + client.terminate(); + try { + assert.equal(response.statusCode, expected, name); + checks.push({ name, status: response.statusCode }); + resolve(); + } catch (error) { reject(error); } + }); + client.once('open', () => { client.terminate(); reject(new Error(`${name}: unauthorized upgrade succeeded`)); }); + client.once('error', reject); + }); +} +try { + const shell = await http('public-sign-in-shell', '/', 200); + assert.match(await shell.text(), /