Enhance MTProxy checker by introducing a new -probe mode deep-strict for stricter response validation. Update README and Docker documentation to clarify probing modes, exit codes, and the new MTPROXY_TDLIB_HELPER and MTPROXY_TDLIB_TIMEOUT environment variables for external helper integration. Refactor connection handling and error reporting to improve robustness and clarity in response verification.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# TDLib helper для `mtproxy_checkerd` (Node.js)
|
||||
|
||||
> Предпочтительный вариант — нативный **`tdlib_ping`** в корне репозитория (`cmd/tdlib_ping`, `libtdjson`, официальный JSON API TDLib). Этот каталог остаётся как **legacy** на Node + `prebuilt-tdlib`, если так удобнее в образе.
|
||||
|
||||
Внешний процесс: **TDLib** (`addProxy` + `pingProxy`), как в [telegram-mtproto-proxy-checker](https://github.com/AmirTahaMim/telegram-mtproto-proxy-checker). В stdout печатается **одна строка JSON** — её парсит `mtproxy_checkerd`.
|
||||
|
||||
## Установка
|
||||
|
||||
```bash
|
||||
cd contrib/tdlib-ping
|
||||
npm install
|
||||
```
|
||||
|
||||
## Запуск вручную
|
||||
|
||||
```bash
|
||||
node ping.js 'tg://proxy?server=HOST&port=PORT&secret=HEX'
|
||||
```
|
||||
|
||||
Успех: строка `{"ok":true,"error":"","exit_code":0}` и код выхода `0`.
|
||||
Ошибка секрета: `exit_code` `1`.
|
||||
Прочие ошибки: `exit_code` `2` (или `4` при таймауте внутри скрипта).
|
||||
|
||||
## Docker
|
||||
|
||||
Базовый образ `mtproxy_checker` остаётся без Node/TDLib. Соберите свой слой: установите Node 18+, скопируйте `contrib/tdlib-ping`, выполните `npm install`, задайте:
|
||||
|
||||
```text
|
||||
MTPROXY_TDLIB_HELPER=/usr/local/bin/mtproxy-tdlib-ping
|
||||
MTPROXY_TDLIB_TIMEOUT=45s
|
||||
```
|
||||
|
||||
Обёртка-скрипт `mtproxy-tdlib-ping`:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
exec node /opt/tdlib-ping/ping.js "$1"
|
||||
```
|
||||
|
||||
TDLib проверка выполняется только при **`MTPROXY_PROBE=fast`** (или пусто).
|
||||
Reference in New Issue
Block a user