supportedVersions returns the list of supported TLS versions, sorted from highest to lowest (and hence also in preference order).
(isClient bool)
| 1202 | // supportedVersions returns the list of supported TLS versions, sorted from |
| 1203 | // highest to lowest (and hence also in preference order). |
| 1204 | func (c *Config) supportedVersions(isClient bool) []uint16 { |
| 1205 | versions := make([]uint16, 0, len(supportedVersions)) |
| 1206 | for _, v := range supportedVersions { |
| 1207 | if fips140tls.Required() && !slices.Contains(allowedSupportedVersionsFIPS, v) { |
| 1208 | continue |
| 1209 | } |
| 1210 | if (c == nil || c.MinVersion == 0) && v < VersionTLS12 { |
| 1211 | continue |
| 1212 | } |
| 1213 | if isClient && c.EncryptedClientHelloConfigList != nil && v < VersionTLS13 { |
| 1214 | continue |
| 1215 | } |
| 1216 | if c != nil && c.MinVersion != 0 && v < c.MinVersion { |
| 1217 | continue |
| 1218 | } |
| 1219 | if c != nil && c.MaxVersion != 0 && v > c.MaxVersion { |
| 1220 | continue |
| 1221 | } |
| 1222 | versions = append(versions, v) |
| 1223 | } |
| 1224 | return versions |
| 1225 | } |
| 1226 | |
| 1227 | func (c *Config) maxSupportedVersion(isClient bool) uint16 { |
| 1228 | supportedVersions := c.supportedVersions(isClient) |
no test coverage detected