mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-26 10:31:27 +00:00
Allow IP address ServerName when "serverName" is not configured
In this case, TLS Client Hello will not have SNI (RFC 6066, Section 3)
This commit is contained in:
parent
a0d06f3a97
commit
beb603af06
|
@ -107,8 +107,8 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
SessionTicketsDisabled: true,
|
SessionTicketsDisabled: true,
|
||||||
}
|
}
|
||||||
if utlsConfig.ServerName == "" && dest.Address.Family().IsDomain() {
|
if utlsConfig.ServerName == "" {
|
||||||
utlsConfig.ServerName = dest.Address.Domain()
|
utlsConfig.ServerName = dest.Address.String()
|
||||||
}
|
}
|
||||||
uConn.ServerName = utlsConfig.ServerName
|
uConn.ServerName = utlsConfig.ServerName
|
||||||
fingerprint := tls.GetFingerprint(config.Fingerprint)
|
fingerprint := tls.GetFingerprint(config.Fingerprint)
|
||||||
|
|
|
@ -373,8 +373,8 @@ type Option func(*tls.Config)
|
||||||
// WithDestination sets the server name in TLS config.
|
// WithDestination sets the server name in TLS config.
|
||||||
func WithDestination(dest net.Destination) Option {
|
func WithDestination(dest net.Destination) Option {
|
||||||
return func(config *tls.Config) {
|
return func(config *tls.Config) {
|
||||||
if dest.Address.Family().IsDomain() && config.ServerName == "" {
|
if config.ServerName == "" {
|
||||||
config.ServerName = dest.Address.Domain()
|
config.ServerName = dest.Address.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue