fix(sub): preserve external Hysteria2 Clash options (#6944)

An external hy2:// link turned into a bare Clash Hysteria2 node: obfs, obfs-password, the port-hopping range and the certificate pin were dropped, so Mihomo could not reach servers that require them. External and panel Hysteria2 nodes now share one converter.
This commit is contained in:
Hamed
2026-11-02 17:40:24 +03:30
committed by GitHub
parent 05199dda00
commit 34a762f7c8
3 changed files with 240 additions and 75 deletions
+3 -11
View File
@@ -131,17 +131,9 @@ func clashHysteriaFromExternal(settings, stream map[string]any, name string) map
"password": auth,
"udp": true,
}
if tls, _ := stream["tlsSettings"].(map[string]any); tls != nil {
if sni, _ := tls["serverName"].(string); sni != "" {
proxy["sni"] = sni
}
if alpn := clashStringList(tls["alpn"]); len(alpn) > 0 {
proxy["alpn"] = alpn
}
if fp, _ := tls["fingerprint"].(string); fp != "" {
proxy["client-fingerprint"] = fp
}
}
tls, _ := stream["tlsSettings"].(map[string]any)
applyHysteriaTLS(proxy, tls, tls)
applyHysteriaFinalMask(proxy, stream)
return proxy
}