[PR #6944] [MERGED] fix(sub): preserve external Hysteria2 Clash options #6532

Closed
opened 2026-11-02 04:09:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6944
Author: @HamedSanaei
Created: 10/26/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @MHSanaei

Base: main ← Head: codex/fix-hysteria2-external-clash


📝 Commits (1)

  • c272e5c fix(sub): preserve external Hysteria2 Clash options

📊 Changes

3 files changed (+237 additions, -72 deletions)

View changed files

📝 internal/sub/clash_external.go (+3 -11)
➕ internal/sub/clash_external_hysteria_test.go (+186 -0)
📝 internal/sub/clash_service.go (+48 -61)

📄 Description

Summary

Preserve Hysteria2 obfuscation, packet-size ranges, UDP port hopping, and certificate fingerprints when external hy2:// or hysteria2:// links are converted to Mihomo/Clash subscriptions. Share the TLS and finalmask mapping with the inbound Hysteria2 converter.

Why

The link parser retains these options in the outbound stream settings, but the external Clash converter previously omitted finalmask settings and the TLS certificate pin. That can produce unusable subscription nodes for servers requiring these options. Closes #6941.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • Added table-driven regressions using parsed external links for Salamander and Gecko, packet-size ranges, port hopping, TLS pins, malformed inputs, and inbound compatibility. Confirmed the new tests failed against the original converter before implementing the fix.
  • make verify passed on a Linux filesystem mirror with byte-identical changed files (including 215 frontend test files, Go checks, builds, and Storybook).
  • make race passed.
  • go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s ./internal/util/link passed.
  • go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s ./internal/web/runtime passed.

Screenshots / recordings

N/A (subscription output only).

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass. (N/A: no frontend changes; these checks passed in make verify.)
  • I updated the Wiki / README / API docs if user-facing behavior changed. (N/A: this restores existing URI options in subscription output; no new options or API surface.)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6944 **Author:** [@HamedSanaei](https://github.com/HamedSanaei) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `codex/fix-hysteria2-external-clash` --- ### 📝 Commits (1) - [`c272e5c`](https://github.com/MHSanaei/3x-ui/commit/c272e5ccc3d1267673479a03a559016ac7af950d) fix(sub): preserve external Hysteria2 Clash options ### 📊 Changes **3 files changed** (+237 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `internal/sub/clash_external.go` (+3 -11) ➕ `internal/sub/clash_external_hysteria_test.go` (+186 -0) 📝 `internal/sub/clash_service.go` (+48 -61) </details> ### 📄 Description ## Summary Preserve Hysteria2 obfuscation, packet-size ranges, UDP port hopping, and certificate fingerprints when external `hy2://` or `hysteria2://` links are converted to Mihomo/Clash subscriptions. Share the TLS and finalmask mapping with the inbound Hysteria2 converter. ## Why The link parser retains these options in the outbound stream settings, but the external Clash converter previously omitted finalmask settings and the TLS certificate pin. That can produce unusable subscription nodes for servers requiring these options. Closes #6941. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [ ] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [x] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - Added table-driven regressions using parsed external links for Salamander and Gecko, packet-size ranges, port hopping, TLS pins, malformed inputs, and inbound compatibility. Confirmed the new tests failed against the original converter before implementing the fix. - `make verify` passed on a Linux filesystem mirror with byte-identical changed files (including 215 frontend test files, Go checks, builds, and Storybook). - `make race` passed. - `go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s ./internal/util/link` passed. - `go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s ./internal/web/runtime` passed. ## Screenshots / recordings N/A (subscription output only). ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. (N/A: no frontend changes; these checks passed in `make verify`.) - [x] I updated the Wiki / README / API docs if user-facing behavior changed. (N/A: this restores existing URI options in subscription output; no new options or API surface.) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #6944] fix(sub): preserve external Hysteria2 Clash options to [PR #6944] [MERGED] fix(sub): preserve external Hysteria2 Clash options 2026-11-07 14:33:51 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6532
No description provided.