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

Method mutualVersion

common.go:1273–1281  ·  view source on GitHub ↗

mutualVersion returns the protocol version to use given the advertised versions of the peer. The highest supported version is preferred.

(isClient bool, peerVersions []uint16)

Source from the content-addressed store, hash-verified

1271// mutualVersion returns the protocol version to use given the advertised
1272// versions of the peer. The highest supported version is preferred.
1273func (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.

Callers 3

SupportsCertificateMethod · 0.80
pickTLSVersionMethod · 0.80
readClientHelloMethod · 0.80

Calls 1

supportedVersionsMethod · 0.95

Tested by

no test coverage detected