From eae39b13c2f5dcaf2a27b45f1e27041a2e5f4c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Wed, 27 Feb 2019 02:36:04 +0100 Subject: [PATCH] hid: mention Go 1.12 alternative to TLS autodetection --- hid/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hid/main.go b/hid/main.go index cf54ab0..8fcb6c2 100644 --- a/hid/main.go +++ b/hid/main.go @@ -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