feat(config): switch proxy to SOCKS5 and add auth options

The proxy configuration now uses a SOCKS5 scheme instead of MTProto. The default port is updated to 1080 and optional username/password fields are supported. Docker compose comments are updated accordingly.

BREAKING CHANGE: existing MTProto proxy settings (scheme "mtproto", port 443) are no longer supported and must be migrated to SOCKS5.
This commit is contained in:
vvzvlad
2026-04-05 18:18:34 +03:00
parent 09692edf06
commit 17ec871d7c
2 changed files with 11 additions and 7 deletions
+7 -4
View File
@@ -47,15 +47,18 @@ def get_settings() -> dict[str, Any]:
log_level = os.getenv("LOG_LEVEL", "INFO")
# Build MTProto proxy config if proxy host is provided
# Build MTProto proxy config if proxy host is provided.
# Telegram MTProto proxy (telegrammessenger/proxy) exposes a SOCKS5 interface,
# so Pyrogram connects to it via SOCKS5 scheme.
proxy_host = os.getenv("TG_PROXY_HOST")
proxy: dict[str, Any] | None = None
if proxy_host:
proxy = {
"scheme": "mtproto",
"scheme": "SOCKS5",
"hostname": proxy_host,
"port": int(os.getenv("TG_PROXY_PORT") or 443),
"secret": os.getenv("TG_PROXY_SECRET", ""),
"port": int(os.getenv("TG_PROXY_PORT") or 1080),
"username": os.getenv("TG_PROXY_USERNAME") or None,
"password": os.getenv("TG_PROXY_PASSWORD") or None,
}
return {
+4 -3
View File
@@ -8,9 +8,10 @@ services:
environment:
TG_API_ID: XXX
TG_API_HASH: XXX
# TG_PROXY_HOST: 127.0.0.1 # MTProto proxy host (optional)
# TG_PROXY_PORT: 443 # MTProto proxy port (default: 443)
# TG_PROXY_SECRET: XXX # MTProto proxy secret
# TG_PROXY_HOST: 127.0.0.1 # MTProto proxy host, SOCKS5 interface (optional)
# TG_PROXY_PORT: 1080 # MTProto proxy SOCKS5 port (default: 1080)
# TG_PROXY_USERNAME: XXX # SOCKS5 username (optional)
# TG_PROXY_PASSWORD: XXX # SOCKS5 password (optional)
PYROGRAM_BRIDGE_URL: https://pgbridge.example.com
API_PORT: 80
TOKEN: ХХХ