gateway: invisible to users, and tried again when away

Users never hear of the gateway:
- relayed messages look like everyone else's (no "via relay", no accent
  colour) and group with the author's other messages;
- a gateway that cannot be reached or drops is tried again by itself
  (after 2, 5, 15, 30, then every 60 s) with the open chats opened again
  and messages written meanwhile sent, instead of a WebSocket error
  ("connection refused") on screen; it is logged with its URL, once per
  cause;
- a server whose gateway is away is offline, not connecting, so it can
  always be joined;
- failed requests the app made by itself are quiet; what the user did and
  failed is told in plain words; query relay errors are logged;
- no status line about a found gateway; events and streams texts do not
  mention it.

The gateway is looked up once per run even when one is stored: what the
server publishes takes the place of a stored URL (one that moved, or one
typed into an older version that showed the field, which cannot be
edited any more).

The admin guide says a _tsgws record must point at TLS, not at tsgw's own
plain port.

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-05 20:09:59 +00:00
1 parent f8dcfaf0f5
commit 266148d9cd
16 files changed
+384 -78

No files matched your search

+15 -6
View File
@@ -86,9 +86,10 @@ Every login, post and settings change is written to the audit table.
5. Install tsgw ([below](#install)), copy the example config to
`/etc/tsgw/tsgw.toml` and set the query address and credentials
(`TSGW_QUERY_PASSWORD` or `password_file`).
6. Run it behind TLS (Caddy, nginx) and publish it in DNS
([below](#letting-voelin-find-the-gateway)), so users only add the
server's address; or give them the `wss://…/v1` URL.
6. Run it behind TLS (Caddy, nginx) and publish it in DNS, or let it
answer on its default port next to the server
([below](#letting-voelin-find-the-gateway)): users only add the
server's address and never see the gateway.
## Letting Voelin find the gateway
@@ -98,9 +99,12 @@ for its gateway the way TeamSpeak looks for the voice server (SRV
user selects the server (users do not type gateway URLs or query logins).
It asks at the server's host name and then at each parent domain down to the
registered domain, the most specific name first; for `ts.example.org` that
is `ts.example.org`, then `example.org`. It looks again when the server is
selected or saved without a gateway (a new address drops the old one) and
when it connects with voice.
is `ts.example.org`, then `example.org`. It looks once per run when the
server is selected or connects with voice, and again when its address
changes: what is published takes the place of what was found before (a
lookup that finds nothing keeps it). A gateway that cannot be reached is
tried again by itself (after 2, 5, 15, 30, then every 60 seconds); users
see nothing of it, the log file has the URL and the error.
**DNS records** (preferred). An SRV record names the gateway's host and
port, the service name says whether it speaks TLS:
@@ -126,6 +130,11 @@ _tsgw._tcp.ts.example.org. 3600 IN SRV 0 0 7788 ts.example.org.
; -> ws://ts.example.org:7788/v1, only for ts.example.org
```
The record's service name must match what listens on the port: tsgw
itself speaks plain WebSocket, so its own port (7788) is published as
`_tsgw`; a `_tsgws` record there makes Voelin start TLS with it, which
fails. Publish `_tsgws` only for a port with TLS in front.
One domain with several servers and several gateways: publish one record
per server host (`_tsgws._tcp.ts1.example.org`, `_tsgws._tcp.ts2.example.org`);
a record at the domain itself applies to every host below it that has none