From fa7300e9101c885eba03971b2eb0db5ed77b0063 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:29:46 +0800 Subject: [PATCH] Add warning on using old version of XTLS And checks param `fingerprint` also --- infra/conf/transport_internet.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index f0b067d8..c52a1658 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -458,6 +458,7 @@ type XTLSConfig struct { MaxVersion string `json:"maxVersion"` CipherSuites string `json:"cipherSuites"` PreferServerCipherSuites bool `json:"preferServerCipherSuites"` + Fingerprint string `json:"fingerprint"` RejectUnknownSNI bool `json:"rejectUnknownSni"` PinnedPeerCertificateChainSha256 *[]string `json:"pinnedPeerCertificateChainSha256"` } @@ -487,6 +488,9 @@ func (c *XTLSConfig) Build() (proto.Message, error) { config.MaxVersion = c.MaxVersion config.CipherSuites = c.CipherSuites config.PreferServerCipherSuites = c.PreferServerCipherSuites + if c.Fingerprint != "" { + return nil, newError(`Old version of XTLS does not support fingerprint. Please use flow "xtls-rprx-vision" with "tls & tlsSettings" instead.`) + } config.RejectUnknownSni = c.RejectUnknownSNI if c.PinnedPeerCertificateChainSha256 != nil { @@ -500,6 +504,8 @@ func (c *XTLSConfig) Build() (proto.Message, error) { } } + newError(`You are using an old version of XTLS, which is deprecated now and will be removed soon. Please use flow "xtls-rprx-vision" with "tls & tlsSettings" instead.`).AtWarning().WriteToLog() + return config, nil }