// FillTLSClientConfig fills cfg (a client-side TLS config) with information
// from chi. It does not overwrite any fields in cfg that are already non-zero.
FillTLSClientConfig fills cfg (a client-side TLS config) with information
from chi. It does not overwrite any fields in cfg that are already non-zero.
// FillTLSClientConfig fills cfg ( a client - side TLS config ) with information // from chi . It does not overwrite any fields in cfg that are already non - zero .
func (chi ClientHelloInfo) FillTLSClientConfig(cfg *tls.Config) {
	if cfg.NextProtos == nil {
		cfg.NextProtos = chi.ClientHelloInfo.SupportedProtos
	}
	if cfg.ServerName == "" {
		cfg.ServerName = chi.ClientHelloInfo.ServerName
	}
	if cfg.CipherSuites == nil {
		cfg.CipherSuites = chi.ClientHelloInfo.CipherSuites
	}
	if cfg.CurvePreferences == nil {
		cfg.CurvePreferences = chi.ClientHelloInfo.SupportedCurves
	}
	var minVer, maxVer uint16
	for _, ver := range chi.ClientHelloInfo.SupportedVersions {
		if minVer == 0 || ver < minVer {
			minVer = ver
		}
		if maxVer == 0 || ver > maxVer {
			maxVer = ver
		}
	}
	if cfg.MinVersion == 0 {
		cfg.MinVersion = minVer
	}
	if cfg.MaxVersion == 0 {
		cfg.MaxVersion = maxVer
	}
}
func ( chi ClientHelloInfo ) FillTLSClientConfig ( cfg * tls . Config ) { if cfg . NextProtos == nil { cfg . NextProtos = chi . ClientHelloInfo . SupportedProtos } if cfg . ServerName == " " { cfg . ServerName = chi . ClientHelloInfo . ServerName } if cfg . CipherSuites == nil { cfg . CipherSuites = chi . ClientHelloInfo . CipherSuites } if cfg . CurvePreferences == nil { cfg . CurvePreferences = chi . ClientHelloInfo . SupportedCurves } var minVer , maxVer uint16 for _ , ver := range chi . ClientHelloInfo . SupportedVersions { if minVer == 0 || ver < minVer { minVer = ver } if maxVer == 0 || ver > maxVer { maxVer = ver } } if cfg . MinVersion == 0 { cfg . MinVersion = minVer } if cfg . MaxVersion == 0 { cfg . MaxVersion = maxVer } }
FillTLSClientConfig fills cfg (a client-side TLS config) with information
from chi.
FillTLSClientConfig fills cfg ( a client - side TLS config ) with information from chi .