Double-hop with xray
Hello, friends. Is there any way to create a cascade for MTG (RU-EU) using Xray? I've been trying for hours, but it's not working.
Панель Hiddify-Manager помимо Xray умеет в MTProxy (правда не знаю, умеет ли он в Fake-TLS), а панелях обычно удобно перенеправлять трафик и делать каскад, попробуй.
Hiddify-Manager Panel can both Xray and MTProxy (but I'm not sure about Fake-TLS), it should be easy to setup cascade with it, try it.
Have no idea which language to answer. Yes, there is a way, and I hope to get some time soon to implement some one-lick solution for that. Right now for family purposes I use https://wiki.metacubex.one/en/ that provides local socks5 proxy interface, uses a subscription for one of the myriad of paid vless-providers and round-robins across many uplinks
mtg has native SOCKS5 upstream support — no extra panel needed.
Topology
Telegram client → mtg → xray (SOCKS5 inbound + VLESS/Reality outbound) → exit → Telegram
mtg (config.toml):
[network]
proxies = ["socks5://127.0.0.1:1080"]
# multiple entries → round-robin / load-balance
xray-core inbound (pair with your existing VLESS/Reality outbound and a route mtg-in → vless-out):
{
"tag": "mtg-in",
"listen": "127.0.0.1",
"port": 1080,
"protocol": "socks",
"settings": { "auth": "noauth", "udp": false }
}
Heads up: the latest release v2.2.8 (2026-04-07) silently bypasses the SOCKS5 upstream on some code paths. Fixed in master by #483 (merged 2026-05-03), not yet in a tagged release — build from master or wait for the next release. Symptoms in the wiki: FAQ Q21.
По-русски кратко. В mtg уже встроена поддержка SOCKS5-апстрима, отдельная панель не нужна. В config.toml под [network] добавьте proxies = ["socks5://127.0.0.1:1080"]. Поднимите xray-core рядом с mtg: SOCKS5 inbound на этом порту, VLESS/Reality outbound в EU, маршрут mtg-in → vless-out. Несколько адресов в proxies → балансировка по кругу. В релизе v2.2.8 есть баг: mtg игнорирует SOCKS5-апстрим в некоторых путях. Починено в master через #483, в релиз ещё не попало — соберите из master или ждите следующего релиза. Подробности — FAQ Q21.
Correction to my comment above — I conflated two separate bugs, and the "build from master" advice was a false alarm for the config I posted. Apologies.
- The "socks5 upstream silently ignored" symptom (FAQ Q21) was fixed by #367 (merged 2026-03-16) and is already in the current release v2.2.8 (verified: the #367 merge commit is an ancestor of the
v2.2.8tag). v2.2.8 routes traffic through the SOCKS5 upstream correctly. - #483 (merged 2026-05-03, not yet in a tagged release) is a different, narrower fix: it stops mtg from using a custom DoH/DoT resolver to resolve the SOCKS upstream's address. It only bites if you address the upstream by a non-public hostname (a docker-compose service name, a k8s name, an
/etc/hostsentry) and you have a customdns =set under[network].
The config in my comment — proxies = ["socks5://127.0.0.1:1080"] — uses a literal IP, so there is nothing to resolve and #483 does not apply. That setup works on the current stable v2.2.8; no need to build from master.
If you instead run xray in a separate container and want mtg to reach it by service name, simplest is to keep addressing it by IP (publish xray's SOCKS port on 127.0.0.1 and point mtg there). That stays on the stable release and sidesteps #483 entirely.
По-русски. Поправка к моему комментарию выше — я смешал два разных бага, и совет «собрать из master» для приведённого конфига оказался ложной тревогой.
Симптом «mtg игнорирует SOCKS5-апстрим» (FAQ Q21) починен в #367 и уже есть в текущем релизе v2.2.8. #483 — отдельный, более узкий фикс: mtg перестаёт резолвить адрес SOCKS-апстрима кастомным DoH/DoT-резолвером; он важен, только если апстрим адресуется по непубличному hostname (имя docker-compose-сервиса, k8s, /etc/hosts) и у вас задан кастомный dns = под [network]. Конфиг из моего комментария — socks5://127.0.0.1:1080, литеральный IP, резолвить нечего → #483 не применим, всё работает на стабильном v2.2.8, собирать из master не нужно.