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:
RPRX 2023-03-26 10:57:20 +00:00 committed by yuhan6665
parent a0d06f3a97
commit beb603af06
2 changed files with 4 additions and 4 deletions

View file

@ -373,8 +373,8 @@ type Option func(*tls.Config)
// WithDestination sets the server name in TLS config.
func WithDestination(dest net.Destination) Option {
return func(config *tls.Config) {
if dest.Address.Family().IsDomain() && config.ServerName == "" {
config.ServerName = dest.Address.Domain()
if config.ServerName == "" {
config.ServerName = dest.Address.String()
}
}
}