[GH-ISSUE #6822] [Bug]: Missing Hysteria2 Gecko obfs parameters in Clash/Mihomo subs #4543

Closed
opened 2026-10-31 20:40:24 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @atolismesh on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6822

Describe the bug

When I use subscription links in Clash/Mihomo clients, panel's Hysteria2 inbounds with Gecko obf never works.
As I can see, panel generates YAML and url subs without required obf parameters like obf-min-packet-size, obfs-max-packet-size etc.

How to reproduce the problem

  1. Create inbound Hysteria2 connection with UDP Mask with Salamander/gecko obfs mode.
  2. Look at panel's generated YAML and url subscriptions - they do not contain required obf parameters like obf-min-packet-size, obfs-max-packet-size etc. But generated JSON subscription contains all required parameters.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.10.0

Xray-core version

26.10.10

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

No response

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @atolismesh on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6822 ### Describe the bug When I use subscription links in Clash/Mihomo clients, panel's Hysteria2 inbounds with Gecko obf never works. As I can see, panel generates YAML and url subs without required obf parameters like obf-min-packet-size, obfs-max-packet-size etc. ### How to reproduce the problem 1. Create inbound Hysteria2 connection with UDP Mask with Salamander/gecko obfs mode. 2. Look at panel's generated YAML and url subscriptions - they do not contain required obf parameters like obf-min-packet-size, obfs-max-packet-size etc. But generated JSON subscription contains all required parameters. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.10.0 ### Xray-core version 26.10.10 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? _No response_ ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:40:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Oct 14, 2026):

You're right about the Clash/Mihomo YAML, and it is still broken on the default branch. The URL (hysteria2://) subscription, though, already carries the Gecko parameters in v3.10.0, so that half of the report doesn't match the current code. Please paste the raw link (details at the end).

Clash/Mihomo YAML: confirmed. buildHysteriaProxy in internal/sub/clash_service.go:543-559 reads the finalmask.udp[salamander] mask but copies out only the password:

if pw, ok := settings["password"].(string); ok && pw != "" {
    proxy["obfs"] = "salamander"
    proxy["obfs-password"] = pw
    break
}

settings["packetSize"] is never read. This is the field the inbound form stores Gecko mode in (FinalMaskForm.tsx:1176: mode = ... packetSize ... ? 'gecko' : 'salamander'). A Gecko inbound therefore gets exported to Clash as plain Salamander with no packet-size range. The client's obfuscation then doesn't match the server's, so the connection fails, which is what you're seeing.

URL subscription: already emits Gecko. genHysteriaLink in internal/sub/service.go:1478-1484 turns packetSize into obfs=gecko&minPacketSize=…&maxPacketSize=…. That code came in with 540caa4e ("fix(hysteria): standard geco share links and persistent uTLS None (#6325)"), which is part of v3.8.0 and v3.10.0. TestGenHysteriaLinkEmitsGeckoParamsForPacketSize (internal/sub/hysteria_geco_uri_test.go:14) pins this behaviour. These are the v2rayN-style field names, not the obfs-min-packet-size style you mention. If your Mihomo client doesn't read minPacketSize/maxPacketSize from a URI, that's a naming mismatch between clients rather than a missing parameter. I can't confirm Mihomo's URI or YAML field names for Gecko from this repository.

To settle the URL side, please post:

  1. One hysteria2:// link from your subscription, with the host, password and obfs password redacted but every query parameter name kept.
  2. The exact Clash/Mihomo client and version you import it into.

Verdict: Confirmed bug (Clash/Mihomo YAML only)
Severity: Medium
Confidence: High
Root cause: internal/sub/clash_service.go:549-556, SubClashService.buildHysteriaProxy, emits only obfs: salamander + obfs-password and drops finalmask.udp[salamander].settings.packetSize, so a Gecko inbound is exported as plain Salamander.
Same class: None found. The Go URI generator (internal/sub/service.go:1480) and the frontend link generator (frontend/src/lib/xray/inbound-link.ts:842-844) both handle packetSize.
Already fixed: Still present on the default branch (Clash). The URI side was fixed in 540caa4e and shipped in v3.8.0.
Duplicate of: Related: #4924 (the original Gecko feature request)
Evidence: clash_service.go:549 if mask == nil || mask["type"] != "salamander" followed by the password-only block quoted above; service.go:1479-1483 packetSize, _ := settings["packetSize"].(string) … params["obfs"] = "gecko"; test TestGenHysteriaLinkEmitsGeckoParamsForPacketSize.
Not determined: Which YAML keys Mihomo expects for Gecko, and whether it supports Gecko at all (check Mihomo's hysteria2 proxy docs). Also why your URL link reportedly lacks the parameters (the raw link above would settle it).

Suggested fix: In buildHysteriaProxy, reuse parseHysteriaPacketSize/splitHysteriaPacketSize (internal/sub/service.go:1595) on settings["packetSize"], and emit Mihomo's Gecko obfs keys when the range is valid, the same way genHysteriaLink does. If Mihomo has no Gecko support, the Clash export should at least warn or skip rather than ship a Salamander entry that can never connect.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6167901668 --> @github-actions[bot] commented on GitHub (Oct 14, 2026): You're right about the **Clash/Mihomo YAML**, and it is still broken on the default branch. The **URL (`hysteria2://`) subscription**, though, already carries the Gecko parameters in v3.10.0, so that half of the report doesn't match the current code. Please paste the raw link (details at the end). **Clash/Mihomo YAML: confirmed.** `buildHysteriaProxy` in `internal/sub/clash_service.go:543-559` reads the `finalmask.udp[salamander]` mask but copies out only the password: ```go if pw, ok := settings["password"].(string); ok && pw != "" { proxy["obfs"] = "salamander" proxy["obfs-password"] = pw break } ``` `settings["packetSize"]` is never read. This is the field the inbound form stores Gecko mode in (`FinalMaskForm.tsx:1176`: `mode = ... packetSize ... ? 'gecko' : 'salamander'`). A Gecko inbound therefore gets exported to Clash as plain Salamander with no packet-size range. The client's obfuscation then doesn't match the server's, so the connection fails, which is what you're seeing. **URL subscription: already emits Gecko.** `genHysteriaLink` in `internal/sub/service.go:1478-1484` turns `packetSize` into `obfs=gecko&minPacketSize=…&maxPacketSize=…`. That code came in with 540caa4e ("fix(hysteria): standard geco share links and persistent uTLS None (#6325)"), which is part of v3.8.0 and v3.10.0. `TestGenHysteriaLinkEmitsGeckoParamsForPacketSize` (`internal/sub/hysteria_geco_uri_test.go:14`) pins this behaviour. These are the v2rayN-style field names, not the `obfs-min-packet-size` style you mention. If your Mihomo client doesn't read `minPacketSize`/`maxPacketSize` from a URI, that's a naming mismatch between clients rather than a missing parameter. I can't confirm Mihomo's URI or YAML field names for Gecko from this repository. To settle the URL side, please post: 1. One `hysteria2://` link from your subscription, with the host, password and obfs password redacted but every query parameter name kept. 2. The exact Clash/Mihomo client and version you import it into. Verdict: Confirmed bug (Clash/Mihomo YAML only) Severity: Medium Confidence: High Root cause: `internal/sub/clash_service.go:549-556`, `SubClashService.buildHysteriaProxy`, emits only `obfs: salamander` + `obfs-password` and drops `finalmask.udp[salamander].settings.packetSize`, so a Gecko inbound is exported as plain Salamander. Same class: None found. The Go URI generator (`internal/sub/service.go:1480`) and the frontend link generator (`frontend/src/lib/xray/inbound-link.ts:842-844`) both handle `packetSize`. Already fixed: Still present on the default branch (Clash). The URI side was fixed in 540caa4e and shipped in v3.8.0. Duplicate of: Related: #4924 (the original Gecko feature request) Evidence: `clash_service.go:549` `if mask == nil || mask["type"] != "salamander"` followed by the password-only block quoted above; `service.go:1479-1483` `packetSize, _ := settings["packetSize"].(string)` … `params["obfs"] = "gecko"`; test `TestGenHysteriaLinkEmitsGeckoParamsForPacketSize`. Not determined: Which YAML keys Mihomo expects for Gecko, and whether it supports Gecko at all (check Mihomo's hysteria2 proxy docs). Also why your URL link reportedly lacks the parameters (the raw link above would settle it). Suggested fix: In `buildHysteriaProxy`, reuse `parseHysteriaPacketSize`/`splitHysteriaPacketSize` (`internal/sub/service.go:1595`) on `settings["packetSize"]`, and emit Mihomo's Gecko obfs keys when the range is valid, the same way `genHysteriaLink` does. If Mihomo has no Gecko support, the Clash export should at least warn or skip rather than ship a Salamander entry that can never connect. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@atolismesh commented on GitHub (Oct 14, 2026):

  1. Generated (redacted) URI is - hysteria2://hyLcIwH37gjV47ghaft@my-server-name.com:443?alpn=h3%2Ch2&maxPacketSize=1200&minPacketSize=512&obfs=gecko&obfs-password=btzdssach9oh3czwz&security=tls&sni=my-server-name.com#Hysteria%20for%20Mihomo
  2. Mihomo version v1.19.32

But, according to https://github.com/MetaCubeX/mihomo/blob/Alpha/common/convert/converter.go, Mihomo do not recognize minPacketSize, maxPacketSize, obfs=gecko URI parameters.

<!-- gh-comment-id:6168631994 --> @atolismesh commented on GitHub (Oct 14, 2026): 1. Generated (redacted) URI is - hysteria2://hyLcIwH37gjV47ghaft@my-server-name.com:443?alpn=h3%2Ch2&maxPacketSize=1200&minPacketSize=512&obfs=gecko&obfs-password=btzdssach9oh3czwz&security=tls&sni=my-server-name.com#Hysteria%20for%20Mihomo 2. Mihomo version v1.19.32 But, according to https://github.com/MetaCubeX/mihomo/blob/Alpha/common/convert/converter.go, Mihomo do not recognize minPacketSize, maxPacketSize, obfs=gecko URI parameters.
Author
Owner

@atolismesh commented on GitHub (Oct 15, 2026):

@ridersaying
Thanks! Now works as expected

<!-- gh-comment-id:6188446209 --> @atolismesh commented on GitHub (Oct 15, 2026): @ridersaying Thanks! Now works as expected
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#4543
No description provided.