mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6525] [MERGED] fix(panel): probe UDP outbounds and hide the block outbound from the mtproto egress picker #6331
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#6331
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6525
Author: @BlindMaster24
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/panel-udp-probe-and-mtproto-egress📝 Commits (2)
fcaac70fix(panel): match the probe and egress readers to what the core loadsa01533cfix(panel): recognise the mkcp transport alias and pin the picker's field id📊 Changes
4 files changed (+118 additions, -10 deletions)
View changed files
📝
frontend/src/hooks/useXraySetting.ts(+13 -9)📝
frontend/src/pages/inbounds/form/protocols/mtproto.tsx(+2 -1)➕
frontend/src/test/mtproto-egress-picker.test.tsx(+58 -0)📝
frontend/src/test/use-xray-setting.test.tsx(+45 -0)📄 Description
Summary
Two remaining panel readers that read an xray template differently from the core: the outbound probe picks a TCP mode for UDP-only outbounds whose protocol id or transport name is spelled in a case the panel did not expect, and the mtproto egress picker still offers the block outbound.
Both were raised by the automated review on #6523, filed as pre-existing and non-blocking there. This PR is that follow-up.
Why
The core normalises both names before it resolves them —
infra/conf/loader.go:46lowercases the outbound protocol id, andTransportProtocol.Build(infra/conf/transport_internet.go:16-17) lowercases the transport name. Every panel reader that compares either string exactly disagrees with the core for a template that is spelled differently, and the template is user-editable JSON, so this is reachable from a paste or a hand edit.Scenario 1 — a working outbound reported as down. An operator upgrades and their
direct/warpoutbound is spelled"WireGuard"(or"Hysteria", or the stream carries"network": "KCP"). The core loads it and builds the UDP handler; nothing warns. In Xray → Outbounds the operator clicks the row's Test button, or Test All Outbounds.isUdpOutboundcomparedo?.protocol === 'wireguard'exactly, returnedfalse, so the outbound was queued into the TCP lane, where a dial-only probe runs against a UDP-only endpoint. The result is a red "down" row for an outbound that is passing traffic right now, and Test All Outbounds shows the same for that entry. The mode is also picked from the same helper by the single-outbound probe, so both the per-row button and the batch run land the same way.Scenario 2 — the block outbound selectable as an mtproto egress. An inbound of protocol mtproto with Route through Xray on offers an Outbound dropdown. That dropdown called
useOutboundTags()without options, so nothing was filtered: the tag of theblackholeoutbound was listed next to the real proxies and could be selected. Choosing it looks like a working selection and silently discards that inbound's Telegram traffic. The two other call sites of this data — the hostdialerProxypicker and the node form — already passexcludeBlackhole: true; the mtproto picker was the one that did not.What changed
isUdpOutboundnow matches the protocol id through the sharedisOutboundProtocolhelper and lowercases the transport name before comparing it, and recognises themkcpalias the core resolves to the same mKCP transport.{ excludeBlackhole: true }, like its two siblings.Scope. The remaining exact
network === …comparisons inlib/xray/*(link builders, inbound tag flags, FinalMask) read values the panel writes itself from a fixed list, so this change does not touch them — they are a different surface and none of them is on the path fixed here. The two write-path readers the same review named (the outbound editor falling through to VLESS for a differently spelled id, and the Basics setters appending a seconddirect) are already fixed on #6522; this PR does not duplicate them.Type of change
Areas affected
How was this tested?
frontend/, all four commands run locally:npm run lint— 0 warnings, 0 errors (567 files).npm run typecheck— clean.npm run build— succeeds;gen:apirewrotefrontend/public/openapi.jsonwith no diff.npx vitest run --project components src/test/use-xray-setting.test.tsx src/test/mtproto-egress-picker.test.tsx— 8 passed.Both tests were confirmed red before their fix, then green with it:
use-xray-setting.test.tsxdrives the real hook: it rendersuseXraySetting, callstestOutbound(0, outbound, 'tcp')and asserts themodethe probe actually posts. With the fix reverted, the"WireGuard","HyStErIa"and"KCP"cases fail withexpected 'tcp' to be 'http'; the canonicalwireguardand a plainvlesscase pass either way.mtproto-egress-picker.test.tsxrenders the realMtprotoFieldswith a spied config response and opens the egress dropdown. With the fix reverted it fails onexpected [ 'direct', 'blocked', 'warp' ] to not include 'blocked'.The picker test addresses the field by an explicit
idon thatSelect, the same handle the inbound form's protocol select uses (InboundFormModal.tsx:645,listSelectOptions('protocol')), and reuseslistSelectOptionsfromtest-utilsinstead of a private copy of the dropdown reader. An earlier revision located the field positionally, which would have stayed green while asserting about a different select the day one above it gainedshowSearch.Screenshots / recordings
N/A — no visual change; the picker simply no longer lists the block tag.
Breaking changes
None. Both changes narrow behaviour to match what the core already does: a probe switches mode for outbounds the core was already loading, and one dropdown loses an entry that could only discard traffic.
Checklist
go build ./...and the test suite pass locally. — No Go file is touched; the Go jobs are left to CI.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.