Files
VoelinClient/crates/voelin-gateway/tsgw.example.toml
T
Claude 79a12654c8 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
2026-10-06 18:28:09 +00:00

115 lines
3.5 KiB
TOML

# tsgw: companion gateway for invisible presence and channel chat.
# Copy to tsgw.toml and adjust. See docs/gateway-admin.md.
#
# Two kinds of keys:
# - BOOTSTRAP keys (query login, addresses, database path) are read at start
# from this file, TSGW_<KEY> environment variables or `--set key=value`.
# Changing them needs a restart.
# - Everything else is a SEED: the value used unless an admin changes it at
# runtime (Voelin's admin screen / config_set). Values set at runtime are
# stored in the database and win over this file; `config_reset` goes back
# to it. Reload with SIGHUP (or just save: the file is checked every 5 s).
# Precedence: runtime (database) > --set > environment > this file > default.
# BOOTSTRAP. Signed into every login challenge. Defaults to listen.public_url.
# gateway_id = "wss://gw.example.org/v1"
[server]
# BOOTSTRAP. Voice port of the virtual server this gateway serves.
voice_port = 9987
[query]
# BOOTSTRAP. "ssh" (TeamSpeak 3 and 6) or "raw" (TeamSpeak 3 only).
transport = "ssh"
addr = "127.0.0.1:10022"
user = "serveradmin"
# Prefer password_file or the TSGW_QUERY_PASSWORD environment variable.
# password_file = "/run/secrets/tsgw_query_password"
# Set to true once the gateway's IP is in the server's query_ip_allowlist.
allowlisted = false
[listen]
# BOOTSTRAP.
bind = "0.0.0.0:7788"
# public_url = "wss://gw.example.org/v1"
# BOOTSTRAP. The log goes to standard output (journalctl -u tsgw, docker logs).
# Uncomment to change it; tsgw versions before these keys refuse the section.
# [log]
# What to log (TSGW_LOG_LEVEL); default: RUST_LOG, else info.
# level = "info,voelin_query=trace"
# Also write it to this file: appended, moved aside at 20 MB, 5 files kept.
# file = "logs/tsgw.log"
[auth]
# Only these server groups may use the gateway (empty: everyone known to the server).
require_server_groups = []
deny_uids = []
min_security_level = 0
token_ttl_hours = 720
[relay]
nickname = "Chat Relay"
# Posts go out under the user's nickname; this form only when the relay
# cannot take it.
format = "[{nick}] {text}"
idle_teardown_secs = 120
# Each relay is one query connection; stay below the server's per-IP limit.
max_channel_relays = 6
# Channels relayed all the time, so their history is complete.
pinned_channels = []
[history]
# BOOTSTRAP: the database also holds tokens and runtime settings.
path = "tsgw.db"
enabled = true
# 0 keeps messages forever (pinned messages are always kept).
retention_days = 0
# Optional features; Voelin hides what is off.
[features]
pins = true
reactions = true
topics = true
events = true
streams = true
activity = true
[topics]
# How topic posts appear in TeamSpeak; TeamSpeak posts in this form join the topic.
relay_format = "[#{topic}] {text}"
[events]
# Remind subscribers this many minutes before an event (0: when it starts).
reminder_minutes = [15, 0]
stream_link_minutes = 60
[activity]
retention_days = 0
[limits]
# Per connection; 0 turns a limit off.
posts_per_window = 5
post_window_secs = 5
actions_per_window = 30
action_window_secs = 10
# Quotas: 0 means none.
[quota]
history_page = 0
pins_per_channel = 0
topics_per_channel = 0
events_per_user = 0
reactions_per_message = 0
reaction_bytes = 64
message_bytes = 0
streams_per_user = 0
# Who may do what, by TeamSpeak server group or channel group ids. Without
# a rule an action has its default (see docs/gateway-admin.md).
[perm]
# pin = { server_groups = [6], channel_groups = [5] }
# create_event = { server_groups = [6, 7] }
# admin = { server_groups = [6] }
# react = { everyone = true }