mutualVersion returns the protocol version to use given the advertised versions of the peer. Priority is given to the peer preference order.
(isClient bool, peerVersions []uint16)
| 1039 | // mutualVersion returns the protocol version to use given the advertised |
| 1040 | // versions of the peer. Priority is given to the peer preference order. |
| 1041 | func (c *Config) mutualVersion(isClient bool, peerVersions []uint16) (uint16, bool) { |
| 1042 | supportedVersions := c.supportedVersions(isClient) |
| 1043 | for _, peerVersion := range peerVersions { |
| 1044 | for _, v := range supportedVersions { |
| 1045 | if v == peerVersion { |
| 1046 | return v, true |
| 1047 | } |
| 1048 | } |
| 1049 | } |
| 1050 | return 0, false |
| 1051 | } |
| 1052 | |
| 1053 | var errNoCertificates = errors.New("tls: no certificates configured") |
| 1054 |
no test coverage detected