The upstream --proxy option only affects outgoing webhook requests, leaving
no way to route connections to Telegram MTProto datacenters through a proxy.
This is a blocker in restricted network environments where direct egress to
149.154.x.x is unavailable but a SOCKS5/HTTP CONNECT proxy is reachable.
Add a new --td-proxy=URL option that parses one of:
- socks5://[user:pass@]host:port
- socks5h://[user:pass@]host:port (same as socks5 — TDLib always resolves remotely)
- http://[user:pass@]host:port
- mtproto://secret@host:port
The parsed parameters are passed to TDLib via td_api::addProxy with
enable=true, sent before setTdlibParameters so the very first network
attempt is already routed through the proxy.
Verified end-to-end with gost: both socks5 and http modes route MTProto
to DC IPs (149.154.x.x:443) via the proxy with no direct egress.