From bd72c65b5e93c0790abb09b95d519aaf644c4b81 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Tue, 2 Jun 2026 10:29:48 +0800 Subject: [PATCH] feat: remove `global-client-fingerprint`, please set `client-fingerprint` directly on the proxy instead --- component/tls/utls.go | 13 -------- config/config.go | 69 ++++++++++++++++++++-------------------- hub/executor/executor.go | 33 ++++++++----------- 3 files changed, 48 insertions(+), 67 deletions(-) diff --git a/component/tls/utls.go b/component/tls/utls.go index 6cf9fc68..d48a1ba6 100644 --- a/component/tls/utls.go +++ b/component/tls/utls.go @@ -40,9 +40,6 @@ func NewListener(inner net.Listener, config *Config) net.Listener { } func GetFingerprint(clientFingerprint string) (UClientHelloID, bool) { - if len(clientFingerprint) == 0 { - clientFingerprint = globalFingerprint - } if len(clientFingerprint) == 0 || clientFingerprint == "none" { return UClientHelloID{}, false } @@ -319,13 +316,3 @@ func GetTLSConnectionState(conn net.Conn) (tlsState tls.ConnectionState) { } return } - -var globalFingerprint string - -func SetGlobalFingerprint(fingerprint string) { - globalFingerprint = fingerprint -} - -func GetGlobalFingerprint() string { - return globalFingerprint -} diff --git a/config/config.go b/config/config.go index d08dd713..21261480 100644 --- a/config/config.go +++ b/config/config.go @@ -45,27 +45,26 @@ import ( // General config type General struct { Inbound - Mode T.TunnelMode `json:"mode"` - UnifiedDelay bool `json:"unified-delay"` - LogLevel log.LogLevel `json:"log-level"` - IPv6 bool `json:"ipv6"` - Interface string `json:"interface-name"` - RoutingMark int `json:"routing-mark"` - GeoXUrl GeoXUrl `json:"geox-url"` - GeoAutoUpdate bool `json:"geo-auto-update"` - GeoUpdateInterval int `json:"geo-update-interval"` - GeodataMode bool `json:"geodata-mode"` - GeodataLoader string `json:"geodata-loader"` - GeositeMatcher string `json:"geosite-matcher"` - TCPConcurrent bool `json:"tcp-concurrent"` - FindProcessMode process.FindProcessMode `json:"find-process-mode"` - Sniffing bool `json:"sniffing"` - GlobalClientFingerprint string `json:"global-client-fingerprint"` - GlobalUA string `json:"global-ua"` - ETagSupport bool `json:"etag-support"` - KeepAliveIdle int `json:"keep-alive-idle"` - KeepAliveInterval int `json:"keep-alive-interval"` - DisableKeepAlive bool `json:"disable-keep-alive"` + Mode T.TunnelMode `json:"mode"` + UnifiedDelay bool `json:"unified-delay"` + LogLevel log.LogLevel `json:"log-level"` + IPv6 bool `json:"ipv6"` + Interface string `json:"interface-name"` + RoutingMark int `json:"routing-mark"` + GeoXUrl GeoXUrl `json:"geox-url"` + GeoAutoUpdate bool `json:"geo-auto-update"` + GeoUpdateInterval int `json:"geo-update-interval"` + GeodataMode bool `json:"geodata-mode"` + GeodataLoader string `json:"geodata-loader"` + GeositeMatcher string `json:"geosite-matcher"` + TCPConcurrent bool `json:"tcp-concurrent"` + FindProcessMode process.FindProcessMode `json:"find-process-mode"` + Sniffing bool `json:"sniffing"` + GlobalUA string `json:"global-ua"` + ETagSupport bool `json:"etag-support"` + KeepAliveIdle int `json:"keep-alive-idle"` + KeepAliveInterval int `json:"keep-alive-interval"` + DisableKeepAlive bool `json:"disable-keep-alive"` } // Inbound config @@ -739,6 +738,9 @@ func ParseRawConfig(rawCfg *RawConfig) (*Config, error) { func temporaryUpdateGeneral(general *General) func() func parseGeneral(cfg *RawConfig) (*General, error) { + if cfg.GlobalClientFingerprint != "" { + log.Errorln("The `global-client-fingerprint` configuration is removed, please set `client-fingerprint` directly on the proxy instead") + } return &General{ Inbound: Inbound{ Port: cfg.Port, @@ -768,19 +770,18 @@ func parseGeneral(cfg *RawConfig) (*General, error) { ASN: cfg.GeoXUrl.ASN, GeoSite: cfg.GeoXUrl.GeoSite, }, - GeoAutoUpdate: cfg.GeoAutoUpdate, - GeoUpdateInterval: cfg.GeoUpdateInterval, - GeodataMode: cfg.GeodataMode, - GeodataLoader: cfg.GeodataLoader, - GeositeMatcher: cfg.GeositeMatcher, - TCPConcurrent: cfg.TCPConcurrent, - FindProcessMode: cfg.FindProcessMode, - GlobalClientFingerprint: cfg.GlobalClientFingerprint, - GlobalUA: cfg.GlobalUA, - ETagSupport: cfg.ETagSupport, - KeepAliveIdle: cfg.KeepAliveIdle, - KeepAliveInterval: cfg.KeepAliveInterval, - DisableKeepAlive: cfg.DisableKeepAlive, + GeoAutoUpdate: cfg.GeoAutoUpdate, + GeoUpdateInterval: cfg.GeoUpdateInterval, + GeodataMode: cfg.GeodataMode, + GeodataLoader: cfg.GeodataLoader, + GeositeMatcher: cfg.GeositeMatcher, + TCPConcurrent: cfg.TCPConcurrent, + FindProcessMode: cfg.FindProcessMode, + GlobalUA: cfg.GlobalUA, + ETagSupport: cfg.ETagSupport, + KeepAliveIdle: cfg.KeepAliveIdle, + KeepAliveInterval: cfg.KeepAliveInterval, + DisableKeepAlive: cfg.DisableKeepAlive, }, nil } diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 0ffb6c6b..8e0d09e6 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -26,7 +26,6 @@ import ( "github.com/metacubex/mihomo/component/resolver" "github.com/metacubex/mihomo/component/resource" "github.com/metacubex/mihomo/component/sniffer" - tlsC "github.com/metacubex/mihomo/component/tls" "github.com/metacubex/mihomo/component/trie" "github.com/metacubex/mihomo/component/updater" "github.com/metacubex/mihomo/config" @@ -166,20 +165,19 @@ func GetGeneral() *config.General { ASN: geodata.ASNUrl(), GeoSite: geodata.GeoSiteUrl(), }, - GeoAutoUpdate: updater.GeoAutoUpdate(), - GeoUpdateInterval: updater.GeoUpdateInterval(), - GeodataMode: geodata.GeodataMode(), - GeodataLoader: geodata.LoaderName(), - GeositeMatcher: geodata.SiteMatcherName(), - TCPConcurrent: dialer.GetTcpConcurrent(), - FindProcessMode: tunnel.FindProcessMode(), - Sniffing: tunnel.IsSniffing(), - GlobalClientFingerprint: tlsC.GetGlobalFingerprint(), - GlobalUA: mihomoHttp.UA(), - ETagSupport: resource.ETag(), - KeepAliveInterval: int(keepalive.KeepAliveInterval() / time.Second), - KeepAliveIdle: int(keepalive.KeepAliveIdle() / time.Second), - DisableKeepAlive: keepalive.DisableKeepAlive(), + GeoAutoUpdate: updater.GeoAutoUpdate(), + GeoUpdateInterval: updater.GeoUpdateInterval(), + GeodataMode: geodata.GeodataMode(), + GeodataLoader: geodata.LoaderName(), + GeositeMatcher: geodata.SiteMatcherName(), + TCPConcurrent: dialer.GetTcpConcurrent(), + FindProcessMode: tunnel.FindProcessMode(), + Sniffing: tunnel.IsSniffing(), + GlobalUA: mihomoHttp.UA(), + ETagSupport: resource.ETag(), + KeepAliveInterval: int(keepalive.KeepAliveInterval() / time.Second), + KeepAliveIdle: int(keepalive.KeepAliveIdle() / time.Second), + DisableKeepAlive: keepalive.DisableKeepAlive(), } return general @@ -425,11 +423,6 @@ func updateGeneral(general *config.General, logging bool) { geodata.SetASNUrl(general.GeoXUrl.ASN) mihomoHttp.SetUA(general.GlobalUA) resource.SetETag(general.ETagSupport) - - if general.GlobalClientFingerprint != "" { - log.Warnln("The `global-client-fingerprint` configuration is deprecated, please set `client-fingerprint` directly on the proxy instead") - } - tlsC.SetGlobalFingerprint(general.GlobalClientFingerprint) } func updateUsers(users []auth.AuthUser) {