mutualVersion returns the protocol version to use given the advertised versions of the peer. The highest supported version is preferred.
(isClient bool, peerVersions []uint16)
| 1271 | // mutualVersion returns the protocol version to use given the advertised |
| 1272 | // versions of the peer. The highest supported version is preferred. |
| 1273 | func (c *Config) mutualVersion(isClient bool, peerVersions []uint16) (uint16, bool) { |
| 1274 | supportedVersions := c.supportedVersions(isClient) |
| 1275 | for _, v := range supportedVersions { |
| 1276 | if slices.Contains(peerVersions, v) { |
| 1277 | return v, true |
| 1278 | } |
| 1279 | } |
| 1280 | return 0, false |
| 1281 | } |
| 1282 | |
| 1283 | // errNoCertificates should be an internal detail, |
| 1284 | // but widely used packages access it using linkname. |
no test coverage detected