MCPcopy
hub / github.com/segmentio/kafka-go / looksLikeUnexpectedTLS

Function looksLikeUnexpectedTLS

protocol/response.go:148–157  ·  view source on GitHub ↗

looksLikeUnexpectedTLS returns true if the size passed in resemble the TLS alert message that is returned to a client which sends an invalid ClientHello message.

(size int32)

Source from the content-addressed store, hash-verified

146// the TLS alert message that is returned to a client which sends
147// an invalid ClientHello message.
148func looksLikeUnexpectedTLS(size int32) bool {
149 var sizeBytes [4]byte
150 binary.BigEndian.PutUint32(sizeBytes[:], uint32(size))
151
152 if sizeBytes[0] != tlsAlertByte {
153 return false
154 }
155 version := int(sizeBytes[1])<<8 | int(sizeBytes[2])
156 return version <= tls.VersionTLS13 && version >= tls.VersionTLS10
157}

Callers 1

ReadResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…