MCPcopy
hub / github.com/XTLS/REALITY / supportedVersions

Method supportedVersions

common.go:1204–1225  ·  view source on GitHub ↗

supportedVersions returns the list of supported TLS versions, sorted from highest to lowest (and hence also in preference order).

(isClient bool)

Source from the content-addressed store, hash-verified

1202// supportedVersions returns the list of supported TLS versions, sorted from
1203// highest to lowest (and hence also in preference order).
1204func (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
1227func (c *Config) maxSupportedVersion(isClient bool) uint16 {
1228 supportedVersions := c.supportedVersions(isClient)

Callers 3

maxSupportedVersionMethod · 0.95
mutualVersionMethod · 0.95
makeClientHelloMethod · 0.80

Calls 1

RequiredFunction · 0.92

Tested by

no test coverage detected