MCPcopy Create free account
hub / github.com/XTLS/Go / mutualVersion

Method mutualVersion

common.go:1041–1051  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1039// mutualVersion returns the protocol version to use given the advertised
1040// versions of the peer. Priority is given to the peer preference order.
1041func (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
1053var errNoCertificates = errors.New("tls: no certificates configured")
1054

Callers 3

SupportsCertificateMethod · 0.80
pickTLSVersionMethod · 0.80
readClientHelloMethod · 0.80

Calls 1

supportedVersionsMethod · 0.95

Tested by

no test coverage detected