hid: mention Go 1.12 alternative to TLS autodetection

This commit is contained in:
Přemysl Eric Janouch 2019-02-27 02:36:04 +01:00
parent c285f3a266
commit a1994865a9
1 changed files with 4 additions and 0 deletions

View File

@ -172,6 +172,10 @@ func splitString(s, delims string, ignoreEmpty bool) (result []string) {
// SSL3/TLS: <22> | <3> | xxxx xxxx
// (handshake)| (protocol version)
//
// Note that Go 1.12's crypto/tls offers a slightly more straight-forward
// solution: "If a client sends an initial message that does not look like TLS,
// the server will no longer reply with an alert, and it will expose the
// underlying net.Conn in the new field Conn of RecordHeaderError."
func detectTLS(sysconn syscall.RawConn) (isTLS bool) {
sysconn.Read(func(fd uintptr) (done bool) {
var buf [3]byte