mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6166] [MERGED] fix(outbound): import Hysteria2 salamander properly from standard obfs params #6127
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#6127
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/6166
Author: @xMasterX
Created: 7/31/2026
Status: ✅ Merged
Merged: 8/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/hysteria2-obfs-import📝 Commits (3)
9e43e16fix(outbound): import Hysteria2 salamander from standard obfs params505144dfix(outbound): address review — mport hop, password-less fm mask, tests85d608bMerge branch 'main' into fix/hysteria2-obfs-import📊 Changes
4 files changed (+362 additions, -0 deletions)
View changed files
📝
frontend/src/lib/xray/outbound-link-parser.ts(+43 -0)📝
frontend/src/test/outbound-link-parser.test.ts(+87 -0)📝
internal/util/link/outbound.go(+65 -0)📝
internal/util/link/outbound_test.go(+167 -0)📄 Description
Problem
The outbound share-link importers only reconstructed the salamander obfuscation from 3x-ui's private
fm=<json>finalmask dump. They never parsed the standard Hysteria2obfs=salamander+obfs-password=<pw>pair.Since the subscription/link generator (
internal/sub) already emits the standardobfs/obfs-passwordfields (and dropsfm=, which broke mihomo & other clients), the obfuscation only round-trips 3x-ui→3x-ui. Importing any normal Hysteria2 link — every other client, and even our own generated links — silently dropped the salamander config. You end up with an outbound that negotiates plain QUIC while the server expects salamander, so it just fails to connect.This affects both import paths:
outbound-link-parser.ts)internal/util/link)Fix
Parse the standard
obfs=salamander+obfs-passwordpair in both importers and fold it intofinalmask.udpas{ type: "salamander", settings: { password } }— the same shape the UI and generator already use. Also accept theobfs_password/obfsPasswordaliases.If a link still carries a full
fm=finalmask with a salamander mask, that wins and the obfs pair is a no-op, so existing 3x-ui→3x-ui links are unchanged.Tests
internal/util/link/outbound_test.go— standard obfs imported, no-obfs untouched, obfs-without-password ignored, andfm=wins overobfs.outbound-link-parser.test.ts— obfs-only reconstruction, no-obfs, and obfs-without-password.npm run testandgo test ./internal/util/link/both green.No schema/DB/route/i18n changes;
make genoutput unaffected.Why
Was trying to fill the issue but found them missing completely. Why issues section are removed from repo?
Type of change
Areas affected
How was this tested?
1 - Import sub with hysteria into Outbounds screen
Click test, see (failed)
2 - Import hysteria link manually via JSON screen on add outbound
See no salamander was added, if you continue it will fail to connect too
If you add salamander and enter password manually after link import - everything works correctly
Checklist
go build ./...and the test suite pass locally.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.