myTS avatar, badges and User Tag from a saved session; banners; gateway logs and speed

Own account on TeamSpeak 6 servers:
- With only a saved session, the account's avatar and its certificate come
  from myTeamSpeak's avatar service (requestContactsAvatar for the own myTS
  ID), the signed badges from getSignedBadges and the User Tag's token from
  /tschat requestSignedAllowedIdentifierList; no password sign-in needed.
- tsproto::myts::Certificate checks a certificate chain as the server does
  (block types 4-7, leaf type 6, validity, key from the root, cofactorless
  Ed25519); each part is sent with a certificate that verifies it, in
  separate updatemytsdata commands when they differ, and cleared on sign-out.
- client_user_tag is set as the official client sets it
  ({"myts_token","tag","updated"}) on TeamSpeak 6 servers, after a
  self-check of the token; cleared on sign-out or an account change.
- Settings -> My Account shows the User Tag and lets the user choose up to
  three badges to show. The log says what the server published.

Banners:
- The URL (without query) is logged on the first failure; stalls, connect
  failures and missing answers are named; 400/404/410 are retried after
  15 minutes, then hourly; 429/503 honour Retry-After.
- Cached pictures are revalidated (ETag, Last-Modified); at most 6
  downloads per host; a User-Agent with the app version.
- The desktop portal's proxy (Linux) and the system proxy (Windows, macOS)
  are used, SOCKS included; redirects are followed hop by hop.

Gateway, client side:
- Only a refused login stops observing; retries after 1, 2, 5, 10, 20, then
  30 s with jitter, at once when voice connects; a 30 s keepalive.
- Discovery asks DNS and the well-known endpoints at once; observing is not
  restarted when the found list still holds the gateway in use.
- Info logs for discovery, attempts (with the stage that hung), connections,
  losses and the first presence.

tsgw:
- Logging setup (log.level, log.file with size rotation, colour only on a
  terminal) and lifecycle logs: startup summary, the address the server
  sees for queries, WebSocket connections, logins, refusals, slow requests,
  ServerQuery failures, relays and the observer.
- The lookup query connection reconnects after a TeamSpeak restart; query
  connects time out after 10 s; a silent server cannot wedge a connection;
  SIGTERM, startup while TeamSpeak is down and /health are handled.
- TCP_QUICKACK and one write per line: ~45 ms -> <2 ms per SSH command.
- One flood guard shared by all query connections (9 per 3 s, SSH auth
  counted, every connection holds on a 524).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZBWxxMsxUzp4PSTKVzbZN
This commit is contained in:
Claude committed 2026-10-06 18:28:09 +00:00
1 parent 1c2d5efd3a
commit 79a12654c8
56 files changed
+7405 -672

No files matched your search

+43 -3
View File
@@ -24,9 +24,26 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows
- Other users' myTeamSpeak avatars (TeamSpeak 6), as the official client
shows them: where the server has no avatar of them, its avatar could not
be downloaded, or the server is only observed.
- Voice connections show servers the account's avatar and badges, as the
official client does, so other TeamSpeak 6 users see them; again after
a reconnect.
- Voice connections show servers the account's avatar, the badges chosen
in Settings → My Account (up to three) and its User Tag, as the official
client does, so other TeamSpeak 6 users see them; again after a
reconnect or an account change, and cleared on sign-out. A saved session
is enough: the avatar, its certificate, the signed badges and the User
Tag's token come from myTeamSpeak's services, and Voelin checks each
signature as the server does before sending it. The log says what the
server published.
- Settings → My Account shows the account's User Tag and lets you choose the
badges servers show.
- Pictures (banners, avatars) go through the desktop's proxy where the
desktop portal names one (Linux), and through the system proxy on
Windows and macOS; SOCKS proxies work too.
- tsgw logs what it does: a startup summary, the address the TeamSpeak
server sees for its queries (with a hint when that address is not
allowlisted), every app connection with its logins and how long they
took, refused logins, slow requests, ServerQuery failures, relays and the
observer. `log.level` (`TSGW_LOG_LEVEL`) sets what is logged, `log.file`
(`TSGW_LOG_FILE`) also writes to a file that is rotated at 20 MB (five
kept); colour only on a terminal.
- Every gateway a server publishes is tried in turn (TLS first, 20 seconds
each) before waiting to try again, so a TLS proxy that fails falls back to
the plain gateway published next to it.
@@ -63,11 +80,34 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows
it is shown (every 15 minutes at most), and the log says why it is
missing (HTTP status, an HTML page, a video, too large). The picture
cache defaults to 1 GiB, the decoded images to 256 MB.
- Banners that fail: the log names the URL (without its query) the first
time, says when a connection stalled and after how much data, and when it
could not connect at all. A banner that is not there (HTTP 400, 404, 410)
is tried again after 15 minutes and then hourly; a host that asks to wait
(429, 503) is waited for. A banner shown again is only checked for
changes (ETag, Last-Modified), not downloaded again. At most 6 downloads
run per host, so a slow host cannot hold up the others.
- The gateway: only a refused login stops observing; anything else is tried
again after 1, 2, 5, 10, 20, then every 30 seconds, and at once when voice
connects. A connection that stops answering is noticed within 90 seconds.
Finding a server's gateway asks DNS and the gateway at once instead of one
after the other. The log says what was found, which gateway was tried,
how long each step took and why one failed.
- tsgw answers faster: each ServerQuery command takes under 2 ms instead of
about 45 ms (TCP_QUICKACK), so logins and startup take milliseconds.
TeamSpeak's flood protection is shared by all of tsgw's query
connections, so tsgw no longer earns a 600 second ban. It starts while
the TeamSpeak server is still down and connects once it is up, its
`/health` says what is missing, and it stops cleanly on SIGTERM.
### Fixed
- The account's avatar is downloaded from its own link; it was asked for
as an upload link and refused with HTTP 403.
- Observing no longer stops for the whole run the first time a server is
joined with a new identity (the gateway did not know it yet).
- tsgw reconnects its query connection for logins when the TeamSpeak server
restarts; before, every login was refused until tsgw was restarted.
## [0.0.1-alpha] - 2026-10-04