diff --git a/eyespot/protocolts/protocols.go b/eyespot/protocolts/protocols.go new file mode 100644 index 0000000..7425ceb --- /dev/null +++ b/eyespot/protocolts/protocols.go @@ -0,0 +1,35 @@ +package protocolts + +import ( + "crypto/tls" +) + +func Run(protocol string, host string) (map[uint16]bool) { + result := map[uint16]bool{} + + for _, v := range []uint16{ + tls.VersionSSL30, + tls.VersionTLS10, + tls.VersionTLS11, + tls.VersionTLS12, + } { + r, _ := test(protocol, host, v) + result[v] = r + } + + return result +} + +func test(protocol string, host string, version uint16) (bool, error) { + conn, err := tls.Dial(protocol, host, &tls.Config{ + MinVersion: version, + MaxVersion: version, + InsecureSkipVerify: true, + }) + if err != nil { + return false, err + } + defer conn.Close(); + + return true, nil +}