mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5682] [Bug]: Telegram bot isn't routed #3954
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3954
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @XFox111 on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5682
Describe the bug
Since telegram is blocked on my server's ISP, I've set up routing rules, so its traffic goes through another server. I checked my rules with Route Tester.
Recently Telegram proxy option was deprecated, and instead, it was introduced that Telegram egress will be routed through Xray routing table (
5eec1784)How to reproduce the problem
geoip:telegramand outbound from step 1geosite:telegramand outbound from step 1telegram.orggoes through said outboundsudo tshark -i eth0 -f tcp -T fields -e ip.dst(eth0here is your ISP interface)149.154.166.110) is present in tshark output. That means that its traffic goes directly from the current server, and not through configured outboundExpected behavior
Telegram bot traffic is routed through another server.
Actual behavior
Telegram bot traffic is not routed through another server.
Relevant logs
Screenshots
3x-ui version
3.4.2
Xray-core version
26.6.22
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Telegram bot
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No response
Before submitting
@XFox111 commented on GitHub (Jun 30, 2026):
Routing config:
@github-actions[bot] commented on GitHub (Jun 30, 2026):
Commit
5eec1784added routing for MTProto inbound proxy traffic through Xray — that is, connections that the bundledmtgbinary makes to Telegram on behalf of MTProto proxy clients. It has no effect on the Telegram bot's own connections.The Telegram bot is a Go process that dials the Telegram API directly via
fasthttp; those connections originate from the Go runtime and never enter an Xray inbound, so Xray routing rules (geoip:telegram,geosite:telegram, or any other rule) do not apply to them.How to route bot traffic through your proxy outbound
The panel provides a dedicated setting for this: Settings → Panel → "Panel Traffic Outbound" (
panelOutbound). Selecting an outbound tag there causes the panel to:panel-egress, starting at port 62790) into the running Xray config.socks5://127.0.0.1:<bridge-port>.The description in the UI (confirmed in
internal/web/translation/en-US.json) reads:Steps to apply:
One important note: the injected routing rule matches by
inboundTag(panel-egress) and sends that traffic directly to the named outbound, so thegeoip:telegram/geosite:telegramrules you already have will not be evaluated for panel/bot traffic. The panel egress bypasses geo-matching by design. You need to point "Panel Traffic Outbound" at the outbound (or balancer) that reaches your relay server.The relevant code paths are
internal/web/service/tgbot/tgbot.go(lines 293–306, proxy resolution at bot start) andinternal/web/service/setting.go(PanelEgressProxyURL, lines 447–468), with the bridge injection ininternal/web/service/xray.go(injectPanelEgress, lines 362–420).This reply was generated automatically; a maintainer may follow up.