mirror of
https://gitverse.ru/kpa39l/infrastructure.git
synced 2026-11-27 14:33:13 +00:00
93 lines
3.7 KiB
Markdown
93 lines
3.7 KiB
Markdown
# terminal-telegram-client Specification
|
|
|
|
## Purpose
|
|
Терминальный клиент Telegram на bigbox: где он установлен и как обновляется,
|
|
какие системные библиотеки ему нужны, как проверяется подлинность релиза и
|
|
как он ходит в Telegram через SOCKS5-туннель, потому что прямой MTProto с
|
|
этого хоста заблокирован.
|
|
|
|
## Requirements
|
|
|
|
### Requirement: Service Directory Layout
|
|
|
|
The terminal Telegram client MUST be installed under `/opt/tuigram` with the
|
|
binary at `/opt/tuigram/bin/tuigram` and MUST be reachable as `tuigram` from
|
|
`PATH` via the symlink `/usr/local/bin/tuigram`.
|
|
|
|
#### Scenario: Binary and symlink present
|
|
- GIVEN the change is applied
|
|
- WHEN running `ls -l /opt/tuigram/bin/tuigram /usr/local/bin/tuigram`
|
|
- THEN `/opt/tuigram/bin/tuigram` is an executable regular file
|
|
- AND `/usr/local/bin/tuigram` is a symlink pointing to it
|
|
|
|
#### Scenario: Version reported
|
|
- GIVEN the client is installed
|
|
- WHEN running `tuigram --version`
|
|
- THEN it prints the installed version (e.g. `tuigram 1.8.1`)
|
|
- AND exits with status 0
|
|
|
|
### Requirement: Runtime Libraries
|
|
|
|
The system MUST provide the C++ runtime the release binary links against, so
|
|
that the client starts without `error while loading shared libraries`.
|
|
|
|
#### Scenario: No missing shared objects
|
|
- GIVEN the client binary is installed
|
|
- WHEN running `ldd /opt/tuigram/bin/tuigram`
|
|
- THEN no line contains `not found`
|
|
- AND `libc++.so.1`, `libc++abi.so.1`, `libunwind.so.1` resolve to system paths
|
|
|
|
### Requirement: Verified Release Artifacts
|
|
|
|
Installation and update MUST use the upstream GitHub release asset for
|
|
`x86_64-unknown-linux-gnu` and MUST verify its SHA256 against the release's
|
|
`SHA256SUMS` before the binary is replaced.
|
|
|
|
#### Scenario: Checksum matches
|
|
- GIVEN the release tarball and `SHA256SUMS` were downloaded
|
|
- WHEN the installer compares the digest
|
|
- THEN a match installs the new binary atomically (`mv` over the old one)
|
|
- AND `VERSION` records the release tag
|
|
|
|
#### Scenario: Checksum mismatch or missing entry
|
|
- GIVEN the downloaded tarball has a different digest, or its name is absent
|
|
from `SHA256SUMS`
|
|
- WHEN the installer runs
|
|
- THEN it exits non-zero and leaves the existing binary untouched
|
|
|
|
### Requirement: Proxy Preset Before First Login
|
|
|
|
The client MUST default to the existing SOCKS5 tunnel at `127.0.0.1:1080`
|
|
before the first login, because direct MTProto to Telegram datacenters is
|
|
blocked from this host.
|
|
|
|
#### Scenario: Settings file carries the proxy
|
|
- GIVEN `~/.local/share/tuigram/settings.toml` does not exist yet
|
|
- WHEN the proxy preset is applied
|
|
- THEN the file contains `proxy = "socks5://127.0.0.1:1080"`
|
|
- AND an existing file is not overwritten without an explicit decision
|
|
|
|
#### Scenario: Proxy path is reachable
|
|
- GIVEN `telegram-tunnel.service` is active
|
|
- WHEN opening a TCP connection to `149.154.167.51:443` through
|
|
`127.0.0.1:1080`
|
|
- THEN the connection succeeds
|
|
- AND the same connection attempted directly fails, confirming the proxy is
|
|
required rather than optional
|
|
|
|
#### Scenario: One-off override
|
|
- GIVEN the preset points at `127.0.0.1:1080`
|
|
- WHEN the client is started as `TG_PROXY=socks5://host:port tuigram`
|
|
- THEN the environment value takes precedence over the saved setting
|
|
|
|
### Requirement: Operators' Documentation
|
|
|
|
`/opt/tuigram/README.md` MUST document the installed version, how to update
|
|
and roll back, the proxy setting, and where user data lives.
|
|
|
|
#### Scenario: Documented facts match reality
|
|
- GIVEN the README exists
|
|
- WHEN comparing it to the installed artifacts
|
|
- THEN the documented version equals `/opt/tuigram/VERSION`
|
|
- AND the documented data directory equals the path printed by `tuigram --help`
|