mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 15:25:01 +03:00
feat(sub): make the host "Mihomo X25519" switch drop ML-KEM (#6803)
The per-host Mihomo X25519 switch has been stored since managed hosts landed, but no renderer read it, while every REALITY proxy was forced to support-x25519mlkem768: true. On some networks DPI drops the second segment of an ML-KEM ClientHello and blackholes the server for that client. A host with the switch on now gets support-x25519mlkem768: false and no ML-KEM hint in its vless link; switches saved while they had no effect are cleared once, so upgrading does not silently change existing subscriptions. A REALITY host's fingerprint now reaches the Clash and JSON outputs, and every host endpoint gets its own deep copy of the stream, so one host's blank SNI, fingerprint, Host header or path no longer inherits another host's value.
This commit is contained in:
+28
-14
@@ -2121,24 +2121,38 @@ func applyExternalProxyHysteriaParams(ep map[string]any, params map[string]strin
|
||||
}
|
||||
}
|
||||
|
||||
// cloneStreamForExternalProxy returns a shallow clone of stream with
|
||||
// tlsSettings (and its nested settings map) deep-copied. The external
|
||||
// proxy loop mutates tlsSettings per iteration, so without isolating
|
||||
// those maps each proxy's SNI/fingerprint/ALPN would leak into the next.
|
||||
// cloneStreamForExternalProxy deep-copies stream: every endpoint overrides nested
|
||||
// maps in place, so a shared map leaks one host's SNI/fp/host/path into the next.
|
||||
func cloneStreamForExternalProxy(stream map[string]any) map[string]any {
|
||||
out := cloneMap(stream)
|
||||
ts, ok := out["tlsSettings"].(map[string]any)
|
||||
if !ok || ts == nil {
|
||||
return out
|
||||
}
|
||||
clonedTs := cloneMap(ts)
|
||||
if inner, ok := clonedTs["settings"].(map[string]any); ok && inner != nil {
|
||||
clonedTs["settings"] = cloneMap(inner)
|
||||
}
|
||||
out["tlsSettings"] = clonedTs
|
||||
out, _ := deepCopyJSONValue(stream).(map[string]any)
|
||||
return out
|
||||
}
|
||||
|
||||
func deepCopyJSONValue(v any) any {
|
||||
switch val := v.(type) {
|
||||
case map[string]any:
|
||||
if val == nil {
|
||||
return val
|
||||
}
|
||||
out := make(map[string]any, len(val))
|
||||
for k, item := range val {
|
||||
out[k] = deepCopyJSONValue(item)
|
||||
}
|
||||
return out
|
||||
case []any:
|
||||
if val == nil {
|
||||
return val
|
||||
}
|
||||
out := make([]any, len(val))
|
||||
for i, item := range val {
|
||||
out[i] = deepCopyJSONValue(item)
|
||||
}
|
||||
return out
|
||||
default:
|
||||
return v
|
||||
}
|
||||
}
|
||||
|
||||
func applyExternalProxyTLSToStream(ep map[string]any, stream map[string]any, security string) {
|
||||
if security != "tls" {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user